diff options
author | Günther Deschner <gd@samba.org> | 2009-06-24 00:27:33 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2009-06-24 00:37:51 +0200 |
commit | 46167c1d1b2ee4d77338214494decd9326b7ab93 (patch) | |
tree | 4a4a6a2a1a50cb95dc6efe2f1599c03540e65f01 | |
parent | 05459cf833aebc8402ef9b58580aa05e0b5f653f (diff) | |
download | samba-46167c1d1b2ee4d77338214494decd9326b7ab93.tar.gz samba-46167c1d1b2ee4d77338214494decd9326b7ab93.tar.bz2 samba-46167c1d1b2ee4d77338214494decd9326b7ab93.zip |
s4-smbtorture: more paranoid checks while testing group membership in RPC-SAMR.
Guenther
-rw-r--r-- | source4/torture/rpc/samr.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c index bd88c3bdf0..e3d12453ee 100644 --- a/source4/torture/rpc/samr.c +++ b/source4/torture/rpc/samr.c @@ -5909,6 +5909,8 @@ static bool test_AddGroupMember(struct dcerpc_pipe *p, struct torture_context *t struct samr_RidTypeArray *rids = NULL; struct samr_SetMemberAttributesOfGroup s; uint32_t rid; + bool found_member = false; + int i; status = test_LookupName(p, tctx, domain_handle, TEST_ACCOUNT_NAME, &rid); torture_assert_ntstatus_ok(tctx, status, "test_AddGroupMember looking up name " TEST_ACCOUNT_NAME); @@ -5917,7 +5919,7 @@ static bool test_AddGroupMember(struct dcerpc_pipe *p, struct torture_context *t r.in.rid = rid; r.in.flags = 0; /* ??? */ - torture_comment(tctx, "Testing AddGroupMember and DeleteGroupMember\n"); + torture_comment(tctx, "Testing AddGroupMember, QueryGroupMember and DeleteGroupMember\n"); d.in.group_handle = group_handle; d.in.rid = rid; @@ -5951,10 +5953,34 @@ static bool test_AddGroupMember(struct dcerpc_pipe *p, struct torture_context *t status = dcerpc_samr_QueryGroupMember(p, tctx, &q); torture_assert_ntstatus_ok(tctx, status, "QueryGroupMember"); + torture_assert(tctx, rids, "QueryGroupMember did not fill in rids structure"); + + for (i=0; i < rids->count; i++) { + if (rids->rids[i] == rid) { + found_member = true; + } + } + + torture_assert(tctx, found_member, "QueryGroupMember did not list newly added member"); status = dcerpc_samr_DeleteGroupMember(p, tctx, &d); torture_assert_ntstatus_ok(tctx, status, "DeleteGroupMember"); + rids = NULL; + found_member = false; + + status = dcerpc_samr_QueryGroupMember(p, tctx, &q); + torture_assert_ntstatus_ok(tctx, status, "QueryGroupMember"); + torture_assert(tctx, rids, "QueryGroupMember did not fill in rids structure"); + + for (i=0; i < rids->count; i++) { + if (rids->rids[i] == rid) { + found_member = true; + } + } + + torture_assert(tctx, !found_member, "QueryGroupMember does still list removed member"); + status = dcerpc_samr_AddGroupMember(p, tctx, &r); torture_assert_ntstatus_ok(tctx, status, "AddGroupMember"); |