summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-04-06 11:58:58 +0200
committerStefan Metzmacher <metze@samba.org>2008-04-06 13:42:00 +0200
commit1d08dbbd4c999a7b913954aa35d3ea441f4f43b6 (patch)
treed51719fcc11bd4c69611fa93e8e8e2abf17a03a2 /source3
parentcb4e77d991ae41ff112b14bb8043a896efedc72f (diff)
downloadsamba-1d08dbbd4c999a7b913954aa35d3ea441f4f43b6.tar.gz
samba-1d08dbbd4c999a7b913954aa35d3ea441f4f43b6.tar.bz2
samba-1d08dbbd4c999a7b913954aa35d3ea441f4f43b6.zip
wbinfo: make use of wbcGetGroups()
metze (This used to be commit c78f4dc043523842cf42f1a3fd4e8f3855518efa)
Diffstat (limited to 'source3')
-rw-r--r--source3/nsswitch/wbinfo.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/source3/nsswitch/wbinfo.c b/source3/nsswitch/wbinfo.c
index d3988ca6a5..80a7290343 100644
--- a/source3/nsswitch/wbinfo.c
+++ b/source3/nsswitch/wbinfo.c
@@ -200,29 +200,25 @@ static bool wbinfo_get_groupinfo(const char *group)
/* List groups a user is a member of */
-static bool wbinfo_get_usergroups(char *user)
+static bool wbinfo_get_usergroups(const char *user)
{
- struct winbindd_request request;
- struct winbindd_response response;
- NSS_STATUS result;
- int i;
-
- ZERO_STRUCT(request);
- ZERO_STRUCT(response);
+ wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+ uint32_t num_groups;
+ uint32_t i;
+ gid_t *groups = NULL;
/* Send request */
- fstrcpy(request.data.username, user);
-
- result = winbindd_request_response(WINBINDD_GETGROUPS, &request, &response);
-
- if (result != NSS_STATUS_SUCCESS)
+ wbc_status = wbcGetGroups(user, &num_groups, &groups);
+ if (!WBC_ERROR_IS_OK(wbc_status)) {
return false;
+ }
- for (i = 0; i < response.data.num_entries; i++)
- d_printf("%d\n", (int)((gid_t *)response.extra_data.data)[i]);
+ for (i = 0; i < num_groups; i++) {
+ d_printf("%d\n", (int)groups[i]);
+ }
- SAFE_FREE(response.extra_data.data);
+ wbcFreeMemory(groups);
return true;
}