From 06c79a1757fa953237239288a8736f30db61f193 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 26 Jan 2002 09:55:38 +0000 Subject: Change the winbind interface to use seperate 'domain' and 'username' feilds for the sid->uid and uid->sid conversions. Remove some duplicate arguments from these funcitons, and update the request/response structures for this and the 'winbind domain name' feature. As such 'winbindd_lookup_name' now takes both a domain and username. (This used to be commit ce1b4d4c309e4a60bec5a53224585bd504264672) --- source3/nsswitch/wbinfo.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'source3/nsswitch/wbinfo.c') diff --git a/source3/nsswitch/wbinfo.c b/source3/nsswitch/wbinfo.c index 35d85fe186..d2f923b9a4 100644 --- a/source3/nsswitch/wbinfo.c +++ b/source3/nsswitch/wbinfo.c @@ -58,6 +58,27 @@ static char get_winbind_separator(void) } +static char *get_winbind_domain(void) +{ + struct winbindd_response response; + static fstring winbind_domain; + + ZERO_STRUCT(response); + + /* Send off request */ + + if (winbindd_request(WINBINDD_DOMAIN_NAME, NULL, &response) != + NSS_STATUS_SUCCESS) { + printf("could not obtain winbind domain name!\n"); + exit(1); + } + + fstrcpy(winbind_domain, response.data.domain_name); + + return winbind_domain; + +} + /* Copy of parse_domain_user from winbindd_util.c. Parse a string of the form DOMAIN/user into a domain and a user */ @@ -68,7 +89,7 @@ static BOOL parse_wbinfo_domain_user(const char *domuser, fstring domain, fstrin if (!p) { fstrcpy(user, domuser); - domain[0]=0; + fstrcpy(domain, get_winbind_domain()); return True; } @@ -282,7 +303,7 @@ static BOOL wbinfo_lookupsid(char *sid) /* Display response */ - printf("%s %d\n", response.data.name.name, response.data.name.type); + printf("[%s]\\[%s] %d\n", response.data.name.dom_name, response.data.name.name, response.data.name.type); return True; } @@ -299,7 +320,8 @@ static BOOL wbinfo_lookupname(char *name) ZERO_STRUCT(request); ZERO_STRUCT(response); - fstrcpy(request.data.name, name); + parse_wbinfo_domain_user(name, request.data.name.dom_name, request.data.name.name); + if (winbindd_request(WINBINDD_LOOKUPNAME, &request, &response) != NSS_STATUS_SUCCESS) { return False; -- cgit