summaryrefslogtreecommitdiff
path: root/source3/nsswitch/wbinfo.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2002-01-26 09:55:38 +0000
committerAndrew Bartlett <abartlet@samba.org>2002-01-26 09:55:38 +0000
commit06c79a1757fa953237239288a8736f30db61f193 (patch)
tree24b1107bd70b045ec1eef4dadf8db57a85744d37 /source3/nsswitch/wbinfo.c
parent4691c931e8a75b01d461395239f463258c1b12be (diff)
downloadsamba-06c79a1757fa953237239288a8736f30db61f193.tar.gz
samba-06c79a1757fa953237239288a8736f30db61f193.tar.bz2
samba-06c79a1757fa953237239288a8736f30db61f193.zip
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)
Diffstat (limited to 'source3/nsswitch/wbinfo.c')
-rw-r--r--source3/nsswitch/wbinfo.c28
1 files changed, 25 insertions, 3 deletions
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;