s4-samr: merge samr_GetGroupsForUser from s3 idl. (fixme: python)
authorGünther Deschner <gd@samba.org>
Wed, 5 Nov 2008 09:58:35 +0000 (10:58 +0100)
committerGünther Deschner <gd@samba.org>
Mon, 10 Nov 2008 20:46:29 +0000 (21:46 +0100)
Guenther

librpc/idl/samr.idl
source4/rpc_server/samr/dcesrv_samr.c
source4/torture/rpc/samr.c
source4/torture/rpc/samsync.c
source4/winbind/wb_async_helpers.c

index 11beb7bac303469663cbd36e95de9eef2c2ab6e0..453908546d9b4a15c2bd85e1e13f713845033471 100644 (file)
@@ -1048,7 +1048,7 @@ import "misc.idl", "lsa.idl", "security.idl";
 
        NTSTATUS samr_GetGroupsForUser(
                [in,ref]   policy_handle *user_handle,
-               [out,unique] samr_RidWithAttributeArray  *rids
+               [out,ref]  samr_RidWithAttributeArray  **rids
                );
 
        /************************/
index bc21d9425a9506f96ba1c05af181339c0db9ff68..0f16320a8cc7d334b54c20772bc67a124cda0827 100644 (file)
@@ -3671,7 +3671,7 @@ static NTSTATUS dcesrv_samr_GetGroupsForUser(struct dcesrv_call_state *dce_call,
                }
        }
 
-       r->out.rids = array;
+       *r->out.rids = array;
 
        return NT_STATUS_OK;
 }
index b01abf1ba8f816bc8288967a9925dd3e9b07924e..b3002c9ab33fa2f1981d1c98d5d1a0c7f1eff8f0 100644 (file)
@@ -891,11 +891,13 @@ static bool test_GetGroupsForUser(struct dcerpc_pipe *p, struct torture_context
                                  struct policy_handle *user_handle)
 {
        struct samr_GetGroupsForUser r;
+       struct samr_RidWithAttributeArray *rids = NULL;
        NTSTATUS status;
 
        torture_comment(tctx, "testing GetGroupsForUser\n");
 
        r.in.user_handle = user_handle;
+       r.out.rids = &rids;
 
        status = dcerpc_samr_GetGroupsForUser(p, tctx, &r);
        torture_assert_ntstatus_ok(tctx, status, "GetGroupsForUser");
index 502b879584e99927c72451942bdea1ebadd8958a..ba5b9f78d7bd44d32d7aeaa8bdf690c4cb8cc645 100644 (file)
@@ -442,6 +442,8 @@ static bool samsync_handle_user(struct torture_context *tctx, TALLOC_CTX *mem_ct
        struct policy_handle user_handle;
 
        struct samr_GetGroupsForUser getgroups;
+       struct samr_RidWithAttributeArray *rids;
+
        if (!samsync_state->domain_name || !samsync_state->domain_handle[database_id]) {
                printf("SamSync needs domain information before the users\n");
                return false;
@@ -471,6 +473,7 @@ static bool samsync_handle_user(struct torture_context *tctx, TALLOC_CTX *mem_ct
        }
 
        getgroups.in.user_handle = &user_handle;
+       getgroups.out.rids = &rids;
        
        nt_status = dcerpc_samr_GetGroupsForUser(samsync_state->p_samr, mem_ctx, &getgroups);
        if (!NT_STATUS_IS_OK(nt_status)) {
@@ -681,28 +684,28 @@ static bool samsync_handle_user(struct torture_context *tctx, TALLOC_CTX *mem_ct
                        TEST_TIME_EQUAL(user->last_logoff, info3->base.last_logoff);
                }
 
-               TEST_INT_EQUAL(getgroups.out.rids->count, info3->base.groups.count);
-               if (getgroups.out.rids->count == info3->base.groups.count) {
+               TEST_INT_EQUAL(rids->count, info3->base.groups.count);
+               if (rids->count == info3->base.groups.count) {
                        int i, j;
-                       int count = getgroups.out.rids->count;
-                       bool *matched = talloc_zero_array(mem_ctx, bool, getgroups.out.rids->count);
+                       int count = rids->count;
+                       bool *matched = talloc_zero_array(mem_ctx, bool, rids->count);
                                
                        for (i = 0; i < count; i++) {
                                for (j = 0; j < count; j++) {
-                                       if ((getgroups.out.rids->rids[i].rid == 
+                                       if ((rids->rids[i].rid ==
                                             info3->base.groups.rids[j].rid)
-                                           && (getgroups.out.rids->rids[i].attributes == 
+                                           && (rids->rids[i].attributes ==
                                                info3->base.groups.rids[j].attributes)) {
                                                        matched[i] = true;
                                                }
                                }
                        }
 
-                       for (i = 0; i < getgroups.out.rids->count; i++) {
+                       for (i = 0; i < rids->count; i++) {
                                if (matched[i] == false) {
                                        ret = false;
                                        printf("Could not find group RID %u found in getgroups in NETLOGON reply\n",
-                                              getgroups.out.rids->rids[i].rid); 
+                                              rids->rids[i].rid);
                                }
                        }
                }
index 48a2a4d882d0b1c072cf753046b1962b7493bd9e..a50a0fe4737f70f4ba2a84f994cc233dcf3269b1 100644 (file)
@@ -325,6 +325,8 @@ struct samr_getuserdomgroups_state {
        int num_rids;
        uint32_t *rids;
 
+       struct samr_RidWithAttributeArray *rid_array;
+
        struct policy_handle *user_handle;
        struct samr_OpenUser o;
        struct samr_GetGroupsForUser g;
@@ -386,6 +388,7 @@ static void samr_usergroups_recv_open(struct rpc_request *req)
        if (!composite_is_ok(state->ctx)) return;
 
        state->g.in.user_handle = state->user_handle;
+       state->g.out.rids = &state->rid_array;
 
        req = dcerpc_samr_GetGroupsForUser_send(state->samr_pipe, state,
                                                &state->g);
@@ -438,7 +441,7 @@ NTSTATUS wb_samr_userdomgroups_recv(struct composite_context *ctx,
        NTSTATUS status = composite_wait(ctx);
        if (!NT_STATUS_IS_OK(status)) goto done;
 
-       *num_rids = state->g.out.rids->count;
+       *num_rids = state->rid_array->count;
        *rids = talloc_array(mem_ctx, uint32_t, *num_rids);
        if (*rids == NULL) {
                status = NT_STATUS_NO_MEMORY;
@@ -446,7 +449,7 @@ NTSTATUS wb_samr_userdomgroups_recv(struct composite_context *ctx,
        }
 
        for (i=0; i<*num_rids; i++) {
-               (*rids)[i] = state->g.out.rids->rids[i].rid;
+               (*rids)[i] = state->rid_array->rids[i].rid;
        }
 
  done: