wbinfo: use wbcGetgrnam()
authorStefan Metzmacher <metze@samba.org>
Mon, 24 Mar 2008 19:44:34 +0000 (20:44 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 28 Mar 2008 14:11:42 +0000 (15:11 +0100)
metze
(This used to be commit 8945dce4a18874bdf1a57f1ff8116a66a6f699a0)

source3/nsswitch/wbinfo.c

index f8d77cec60e30a46ed48e95113f8180fd7f8fb45..fad13d292b99604567c646ab5ace0dba5238db3f 100644 (file)
@@ -174,29 +174,22 @@ static bool wbinfo_get_uidinfo(int uid)
 }
 
 /* pull grent for a given group */
-static bool wbinfo_get_groupinfo(char *group)
+static bool wbinfo_get_groupinfo(const char *group)
 {
-       struct winbindd_request request;
-       struct winbindd_response response;
-       NSS_STATUS result;
-
-       ZERO_STRUCT(request);
-       ZERO_STRUCT(response);
-
-       /* Send request */
-
-       fstrcpy(request.data.groupname, group);
-
-       result = winbindd_request_response(WINBINDD_GETGRNAM, &request,
-                                          &response);
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+       struct group *grp;
 
-       if ( result != NSS_STATUS_SUCCESS)
+       wbc_status = wbcGetgrnam(group, &grp);
+       if (!WBC_ERROR_IS_OK(wbc_status)) {
                return false;
+       }
+
+       d_printf("%s:%s:%d\n",
+                grp->gr_name,
+                grp->gr_passwd,
+                grp->gr_gid);
 
-       d_printf( "%s:%s:%d\n",
-                 response.data.gr.gr_name,
-                 response.data.gr.gr_passwd,
-                 response.data.gr.gr_gid );
+       wbcFreeMemory(grp);
 
        return true;
 }