summaryrefslogtreecommitdiff
path: root/source4/torture/rpc
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-12-17 15:34:22 +0100
committerGünther Deschner <gd@samba.org>2009-12-17 15:40:42 +0100
commit619ad0c6ecf88a861ad1a1e1d5564bd1f91855cc (patch)
tree0de839edafd2a8e15e6d4d604e37e0a7b301aa9b /source4/torture/rpc
parenta23084e1e89a44cf692f6e205263ee53371b80c9 (diff)
downloadsamba-619ad0c6ecf88a861ad1a1e1d5564bd1f91855cc.tar.gz
samba-619ad0c6ecf88a861ad1a1e1d5564bd1f91855cc.tar.bz2
samba-619ad0c6ecf88a861ad1a1e1d5564bd1f91855cc.zip
s4-smbtorture: add a samr_GetAliasMembership test to RPC-SAMR.
Guenther
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r--source4/torture/rpc/samr.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
index 986f29346f..03425ea928 100644
--- a/source4/torture/rpc/samr.c
+++ b/source4/torture/rpc/samr.c
@@ -2593,6 +2593,52 @@ static bool test_AddMultipleMembersToAlias(struct dcerpc_pipe *p, struct torture
return true;
}
+static bool test_GetAliasMembership(struct dcerpc_pipe *p,
+ struct torture_context *tctx,
+ struct policy_handle *domain_handle)
+{
+ struct samr_GetAliasMembership r;
+ struct lsa_SidArray sids;
+ struct samr_Ids rids;
+ NTSTATUS status;
+
+ torture_comment(tctx, "Testing GetAliasMembership\n");
+
+ r.in.domain_handle = domain_handle;
+ r.in.sids = &sids;
+ r.out.rids = &rids;
+
+ sids.num_sids = 0;
+ sids.sids = talloc_zero_array(tctx, struct lsa_SidPtr, sids.num_sids);
+
+ status = dcerpc_samr_GetAliasMembership(p, tctx, &r);
+ torture_assert_ntstatus_ok(tctx, status,
+ "samr_GetAliasMembership failed");
+
+ torture_assert_int_equal(tctx, sids.num_sids, rids.count,
+ "protocol misbehaviour");
+
+ sids.num_sids = 1;
+ sids.sids = talloc_zero_array(tctx, struct lsa_SidPtr, sids.num_sids);
+ sids.sids[0].sid = dom_sid_parse_talloc(tctx, "S-1-5-32-1-2-3-1");
+
+ status = dcerpc_samr_GetAliasMembership(p, tctx, &r);
+ torture_assert_ntstatus_ok(tctx, status,
+ "samr_GetAliasMembership failed");
+
+#if 0
+ /* only true for w2k8 it seems
+ * win7, xp, w2k3 will return a 0 length array pointer */
+
+ torture_assert(tctx, (rids.ids && !rids.count),
+ "samr_GetAliasMembership protocol misbehaviour");
+#endif
+ torture_assert(tctx, (!rids.ids && rids.count),
+ "samr_GetAliasMembership protocol misbehaviour");
+
+ return true;
+}
+
static bool test_TestPrivateFunctionsUser(struct dcerpc_pipe *p, struct torture_context *tctx,
struct policy_handle *user_handle)
{
@@ -6504,6 +6550,7 @@ static bool test_OpenDomain(struct dcerpc_pipe *p, struct torture_context *tctx,
ret &= test_RemoveMemberFromForeignDomain(p, tctx, &domain_handle);
ret &= test_CreateAlias(p, tctx, &domain_handle, TEST_ALIASNAME, &alias_handle, sid, true);
ret &= test_CreateDomainGroup(p, tctx, &domain_handle, TEST_GROUPNAME, &group_handle, sid, true);
+ ret &= test_GetAliasMembership(p, tctx, &domain_handle);
ret &= test_QueryDomainInfo(p, tctx, &domain_handle);
ret &= test_QueryDomainInfo2(p, tctx, &domain_handle);
ret &= test_EnumDomainUsers_all(p, tctx, &domain_handle);