From 1d08dbbd4c999a7b913954aa35d3ea441f4f43b6 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sun, 6 Apr 2008 11:58:58 +0200 Subject: wbinfo: make use of wbcGetGroups() metze (This used to be commit c78f4dc043523842cf42f1a3fd4e8f3855518efa) --- source3/nsswitch/wbinfo.c | 28 ++++++++++++---------------- 1 file 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; } -- cgit