s3-auth Change type of num_sids to uint32_t
[abartlet/samba.git/.git] / source3 / winbindd / winbindd_getsidaliases.c
index 788c88f5506c90cd9977734af6e296fd62802f4b..5fcb8922ce4b8ab4e27a8b5a968b34c79b79df1c 100644 (file)
@@ -30,12 +30,13 @@ static void winbindd_getsidaliases_done(struct tevent_req *subreq);
 
 struct tevent_req *winbindd_getsidaliases_send(TALLOC_CTX *mem_ctx,
                                               struct tevent_context *ev,
+                                              struct winbindd_cli_state *cli,
                                               struct winbindd_request *request)
 {
        struct tevent_req *req, *subreq;
        struct winbindd_getsidaliases_state *state;
        struct winbindd_domain *domain;
-       size_t num_sids;
+       uint32_t num_sids;
        struct dom_sid *sids;
 
        req = tevent_req_create(mem_ctx, &state,
@@ -67,13 +68,28 @@ struct tevent_req *winbindd_getsidaliases_send(TALLOC_CTX *mem_ctx,
        num_sids = 0;
        sids = NULL;
 
-       if ((request->extra_data.data != NULL)
-           && !parse_sidlist(state, request->extra_data.data,
-                             &sids, &num_sids)) {
-               DEBUG(1, ("Could not parse SID list: %s\n",
-                         request->extra_data.data));
-               tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
-               return tevent_req_post(req, ev);
+       if (request->extra_data.data != NULL) {
+               if (request->extra_data.data[request->extra_len-1] != '\0') {
+                       DEBUG(1, ("Got non-NULL terminated sidlist\n"));
+                       tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
+                       return tevent_req_post(req, ev);
+               }
+               if (!parse_sidlist(state, request->extra_data.data,
+                                  &sids, &num_sids)) {
+                       DEBUG(1, ("Could not parse SID list: %s\n",
+                                 request->extra_data.data));
+                       tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER);
+                       return tevent_req_post(req, ev);
+               }
+       }
+
+       if (DEBUGLEVEL >= 10) {
+               size_t i;
+               for (i=0; i<num_sids; i++) {
+                       fstring sidstr;
+                       sid_to_fstring(sidstr, &sids[i]);
+                       DEBUGADD(10, ("%s\n", sidstr));
+               }
        }
 
        subreq = wb_lookupuseraliases_send(state, ev, domain, num_sids, sids);