diff options
author | Volker Lendecke <vlendec@samba.org> | 2006-04-23 11:11:27 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:16:28 -0500 |
commit | 817aa0bea3fde1a260d96e17a01f59fdc8d5df77 (patch) | |
tree | 1592b7841a9b6caf23d9708c2ce3e3b0fa529898 /source3/nsswitch | |
parent | 22c4ad8a10c920f74d7a1ac5ce0e186303f754ac (diff) | |
download | samba-817aa0bea3fde1a260d96e17a01f59fdc8d5df77.tar.gz samba-817aa0bea3fde1a260d96e17a01f59fdc8d5df77.tar.bz2 samba-817aa0bea3fde1a260d96e17a01f59fdc8d5df77.zip |
r15174: Check in Ronan Waide's wbinfo -i. Thanks :-)
Volker
(This used to be commit c4cdb8086a3aa8a2e1f724e70616143adfea6e87)
Diffstat (limited to 'source3/nsswitch')
-rw-r--r-- | source3/nsswitch/wbinfo.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/source3/nsswitch/wbinfo.c b/source3/nsswitch/wbinfo.c index ad5ef71523..c004b842f4 100644 --- a/source3/nsswitch/wbinfo.c +++ b/source3/nsswitch/wbinfo.c @@ -119,6 +119,38 @@ static BOOL parse_wbinfo_domain_user(const char *domuser, fstring domain, return True; } +/* pull pwent info for a given user */ + +static BOOL wbinfo_get_userinfo(char *user) +{ + struct winbindd_request request; + struct winbindd_response response; + NSS_STATUS result; + + ZERO_STRUCT(request); + ZERO_STRUCT(response); + + /* Send request */ + + fstrcpy(request.data.username, user); + + result = winbindd_request_response(WINBINDD_GETPWNAM, &request, &response); + + if (result != NSS_STATUS_SUCCESS) + return False; + + d_printf( "%s:%s:%d:%d:%s:%s:%s\n", + response.data.pw.pw_name, + response.data.pw.pw_passwd, + response.data.pw.pw_uid, + response.data.pw.pw_gid, + response.data.pw.pw_gecos, + response.data.pw.pw_dir, + response.data.pw.pw_shell ); + + return True; +} + /* List groups a user is a member of */ static BOOL wbinfo_get_usergroups(char *user) @@ -1086,6 +1118,7 @@ int main(int argc, char **argv) { "all-domains", 0, POPT_ARG_NONE, 0, OPT_LIST_ALL_DOMAINS, "List all domains (trusted and own domain)" }, { "sequence", 0, POPT_ARG_NONE, 0, OPT_SEQUENCE, "Show sequence numbers of all domains" }, { "domain-info", 'D', POPT_ARG_STRING, &string_arg, 'D', "Show most of the info we have about the domain" }, + { "user-info", 'i', POPT_ARG_STRING, &string_arg, 'i', "Get user info", "USER" }, { "user-groups", 'r', POPT_ARG_STRING, &string_arg, 'r', "Get user groups", "USER" }, { "user-domgroups", 0, POPT_ARG_STRING, &string_arg, OPT_USERDOMGROUPS, "Get user domain groups", "SID" }, @@ -1245,6 +1278,13 @@ int main(int argc, char **argv) goto done; } break; + case 'i': + if (!wbinfo_get_userinfo(string_arg)) { + d_fprintf(stderr, "Could not get info for user %s\n", + string_arg); + goto done; + } + break; case 'r': if (!wbinfo_get_usergroups(string_arg)) { d_fprintf(stderr, "Could not get groups for user %s\n", |