r21399: need to zero the request and response structures
[samba.git] / source3 / nsswitch / wbinfo.c
index cabf995042a237eee04cc772fbc09d669e6e91a3..3ae97cfea0a4c15ad4bc57f3298347740bfa4f13 100644 (file)
@@ -638,7 +638,7 @@ static BOOL wbinfo_lookupsid(char *sid)
 
 /* Lookup a list of RIDs */
 
-static BOOL wbinfo_lookuprids(char *domain_sid, char *arg)
+static BOOL wbinfo_lookuprids(char *domain, char *arg)
 {
        size_t i;
        DOM_SID sid;
@@ -650,9 +650,27 @@ static BOOL wbinfo_lookuprids(char *domain_sid, char *arg)
        enum lsa_SidType *types;
        const char *domain_name;
        TALLOC_CTX *mem_ctx;
+       struct winbindd_request request;
+       struct winbindd_response response;
+
+       ZERO_STRUCT(request);
+       ZERO_STRUCT(response);
+
+       if ((domain == NULL) || (strequal(domain, ".")) || (domain[0] == '\0'))
+               fstrcpy(request.domain_name, get_winbind_domain());
+       else
+               fstrcpy(request.domain_name, domain);
+
+       /* Send request */
+
+       if (winbindd_request_response(WINBINDD_DOMAIN_INFO, &request, &response) !=
+           NSS_STATUS_SUCCESS) {
+               d_printf("Could not get domain sid for %s\n", request.domain_name);
+               return False;
+       }
 
-       if (!string_to_sid(&sid, domain_sid)) {
-               d_printf("Could not convert %s to sid\n", domain_sid);
+       if (!string_to_sid(&sid, response.data.domain_info.sid)) {
+               d_printf("Could not convert %s to sid\n", response.data.domain_info.sid);
                return False;
        }