wbinfo: use wbcSidToGid()
authorStefan Metzmacher <metze@samba.org>
Fri, 28 Mar 2008 18:38:24 +0000 (19:38 +0100)
committerStefan Metzmacher <metze@samba.org>
Mon, 31 Mar 2008 10:17:36 +0000 (12:17 +0200)
metze

source/nsswitch/wbinfo.c

index ecceb92928255c2a92a20038e675fad7131770b2..261d9bd2b80e732a1905485095f0afee0f2fa292 100644 (file)
@@ -643,25 +643,27 @@ static bool wbinfo_sid_to_uid(const char *sid_str)
        return true;
 }
 
-static bool wbinfo_sid_to_gid(char *sid)
+static bool wbinfo_sid_to_gid(const char *sid_str)
 {
-       struct winbindd_request request;
-       struct winbindd_response response;
-
-       ZERO_STRUCT(request);
-       ZERO_STRUCT(response);
+       wbcErr wbc_status = WBC_ERR_UNKNOWN_FAILURE;
+       struct wbcDomainSid sid;
+       gid_t gid;
 
        /* Send request */
 
-       fstrcpy(request.data.sid, sid);
+       wbc_status = wbcStringToSid(sid_str, &sid);
+       if (!WBC_ERROR_IS_OK(wbc_status)) {
+               return false;
+       }
 
-       if (winbindd_request_response(WINBINDD_SID_TO_GID, &request, &response) !=
-           NSS_STATUS_SUCCESS)
+       wbc_status = wbcSidToGid(&sid, &gid);
+       if (!WBC_ERROR_IS_OK(wbc_status)) {
                return false;
+       }
 
        /* Display response */
 
-       d_printf("%d\n", (int)response.data.gid);
+       d_printf("%d\n", (int)gid);
 
        return true;
 }