mirror of
https://github.com/samba-team/samba.git
synced 2025-03-05 20:58:40 +03:00
s4-samr: merge samr_GetGroupsForUser from s3 idl. (fixme: python)
Guenther
This commit is contained in:
parent
f20dd953ef
commit
68a2ca11dc
@ -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
|
||||
);
|
||||
|
||||
/************************/
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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");
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user