summaryrefslogtreecommitdiff
path: root/source4/torture/rpc
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-07-04 02:46:24 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:09:46 -0500
commit3c9281f0148c7aa9dfe7d4fd2184e749604321b6 (patch)
treef758003f692969401f5e299b1dbdc7e44bbc64cb /source4/torture/rpc
parent464e352380865b44e67b7c5526adb94d15274955 (diff)
downloadsamba-3c9281f0148c7aa9dfe7d4fd2184e749604321b6.tar.gz
samba-3c9281f0148c7aa9dfe7d4fd2184e749604321b6.tar.bz2
samba-3c9281f0148c7aa9dfe7d4fd2184e749604321b6.zip
r16794: Make Samba4 pass it's own RPC-SAMR test, at least in part. There are
still a couple of unimplemented functions, but this is far better than not testing this at all. In particular, this exercises the password_hash module. Specific changes: - Add support for SetDomainInfo - Add many more info levels to QueryDomainInfo - Set a domain comment in RPC-SAMR, and verify it is kept - Refactor QueryUserInfo not to always serach for all attributes - Add QueryDiplayInfo3 and QueryDomainInfo2 as aliased calls - Make OemChangePassword2 search under the samdb_base_dn(), so it finds the user when partitions are active. - Skip SetSecurity, DisplayIndex, MemberAttributesOfGroup and 'Multiple' alias operations in RPC-SAMR for Samba4 - Add RPC-SAMR as a 'slow' RPC test (it is quite slow) Andrew Bartlett (This used to be commit 01d25c9d6ca8d036d40040e5ee87a330e5b84d55)
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r--source4/torture/rpc/samr.c79
1 files changed, 67 insertions, 12 deletions
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
index 456acaa462..5049381b21 100644
--- a/source4/torture/rpc/samr.c
+++ b/source4/torture/rpc/samr.c
@@ -22,6 +22,7 @@
#include "includes.h"
#include "torture/torture.h"
+#include "system/time.h"
#include "librpc/gen_ndr/lsa.h"
#include "librpc/gen_ndr/ndr_samr_c.h"
#include "smb.h"
@@ -1472,6 +1473,11 @@ static BOOL test_alias_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
ret = False;
}
+ if (lp_parm_bool(-1, "target", "samba4", False)) {
+ printf("skipping MultipleMembers Alias tests against Samba4\n");
+ return ret;
+ }
+
if (!test_AddMultipleMembersToAlias(p, mem_ctx, alias_handle)) {
ret = False;
}
@@ -1586,7 +1592,7 @@ static BOOL test_DeleteAlias_byname(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return True;
failed:
- printf("DeleteUser_byname(%s) failed - %s\n", name, nt_errstr(status));
+ printf("DeleteAlias_byname(%s) failed - %s\n", name, nt_errstr(status));
return False;
}
@@ -2663,6 +2669,21 @@ static BOOL test_QueryDomainInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
uint16_t set_ok[] = {1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0};
int i;
BOOL ret = True;
+ const char *domain_comment = talloc_asprintf(mem_ctx,
+ "Tortured by Samba4 RPC-SAMR: %s",
+ timestring(mem_ctx, time(NULL)));
+
+ s.in.domain_handle = handle;
+ s.in.level = 4;
+ s.in.info = talloc(mem_ctx, union samr_DomainInfo);
+
+ s.in.info->info4.comment.string = domain_comment;
+ status = dcerpc_samr_SetDomainInfo(p, mem_ctx, &s);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("SetDomainInfo level %u (set comment) failed - %s\n",
+ r.in.level, nt_errstr(status));
+ return False;
+ }
for (i=0;i<ARRAY_SIZE(levels);i++) {
printf("Testing QueryDomainInfo level %u\n", levels[i]);
@@ -2678,6 +2699,30 @@ static BOOL test_QueryDomainInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
continue;
}
+ switch (levels[i]) {
+ case 2:
+ if (strcmp(r.out.info->info2.comment.string, domain_comment) != 0) {
+ printf("QueryDomainInfo level %u returned different comment (%s, expected %s)\n",
+ levels[i], r.out.info->info2.comment.string, domain_comment);
+ ret = False;
+ }
+ break;
+ case 4:
+ if (strcmp(r.out.info->info4.comment.string, domain_comment) != 0) {
+ printf("QueryDomainInfo level %u returned different comment (%s, expected %s)\n",
+ levels[i], r.out.info->info4.comment.string, domain_comment);
+ ret = False;
+ }
+ break;
+ case 11:
+ if (strcmp(r.out.info->info11.info2.comment.string, domain_comment) != 0) {
+ printf("QueryDomainInfo level %u returned different comment (%s, expected %s)\n",
+ levels[i], r.out.info->info11.info2.comment.string, domain_comment);
+ ret = False;
+ }
+ break;
+ }
+
printf("Testing SetDomainInfo level %u\n", levels[i]);
s.in.domain_handle = handle;
@@ -2987,16 +3032,21 @@ static BOOL test_AddGroupMember(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return False;
}
- /* this one is quite strange. I am using random inputs in the
- hope of triggering an error that might give us a clue */
- s.in.group_handle = group_handle;
- s.in.unknown1 = random();
- s.in.unknown2 = random();
+ if (lp_parm_bool(-1, "target", "samba4", False)) {
+ printf("skipping SetMemberAttributesOfGroup test against Samba4\n");
+ } else {
+ /* this one is quite strange. I am using random inputs in the
+ hope of triggering an error that might give us a clue */
- status = dcerpc_samr_SetMemberAttributesOfGroup(p, mem_ctx, &s);
- if (!NT_STATUS_IS_OK(status)) {
- printf("SetMemberAttributesOfGroup failed - %s\n", nt_errstr(status));
- return False;
+ s.in.group_handle = group_handle;
+ s.in.unknown1 = random();
+ s.in.unknown2 = random();
+
+ status = dcerpc_samr_SetMemberAttributesOfGroup(p, mem_ctx, &s);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("SetMemberAttributesOfGroup failed - %s\n", nt_errstr(status));
+ return False;
+ }
}
q.in.group_handle = group_handle;
@@ -3150,8 +3200,13 @@ static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
ret &= test_QueryDisplayInfo2(p, mem_ctx, &domain_handle);
ret &= test_QueryDisplayInfo3(p, mem_ctx, &domain_handle);
ret &= test_QueryDisplayInfo_continue(p, mem_ctx, &domain_handle);
- ret &= test_GetDisplayEnumerationIndex(p, mem_ctx, &domain_handle);
- ret &= test_GetDisplayEnumerationIndex2(p, mem_ctx, &domain_handle);
+
+ if (lp_parm_bool(-1, "target", "samba4", False)) {
+ printf("skipping GetDisplayEnumerationIndex test against Samba4\n");
+ } else {
+ ret &= test_GetDisplayEnumerationIndex(p, mem_ctx, &domain_handle);
+ ret &= test_GetDisplayEnumerationIndex2(p, mem_ctx, &domain_handle);
+ }
ret &= test_GroupList(p, mem_ctx, &domain_handle);
ret &= test_TestPrivateFunctionsDomain(p, mem_ctx, &domain_handle);
ret &= test_RidToSid(p, mem_ctx, sid, &domain_handle);