summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-11-15 10:03:12 +0000
committerAndrew Tridgell <tridge@samba.org>2003-11-15 10:03:12 +0000
commit42a25ebb75f29c9d67232312c99ecbd5555e50b2 (patch)
treebc1eab00d99c771b02f7b496220f91753cbc4ea1 /source4/torture
parent4063fd08d4be4b9c91db092b0028f91941700d86 (diff)
downloadsamba-42a25ebb75f29c9d67232312c99ecbd5555e50b2.tar.gz
samba-42a25ebb75f29c9d67232312c99ecbd5555e50b2.tar.bz2
samba-42a25ebb75f29c9d67232312c99ecbd5555e50b2.zip
added samr_OpenUser, samr_EnumDomainAliases and samr_QueryUserInfo level 1
(This used to be commit e7edeec60e274c1460f7c8cc0fb4121b37e1bcd7)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/rpc/samr.c94
1 files changed, 92 insertions, 2 deletions
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
index d4827e2504..21e2005d96 100644
--- a/source4/torture/rpc/samr.c
+++ b/source4/torture/rpc/samr.c
@@ -21,12 +21,63 @@
#include "includes.h"
+static BOOL test_QueryUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle)
+{
+ NTSTATUS status;
+ struct samr_QueryUserInfo r;
+
+ printf("Testing QueryUserInfo\n");
+
+ r.in.handle = handle;
+ r.in.level = 1;
+
+ status = dcerpc_samr_QueryUserInfo(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("QueryUserInfo failed - %s\n", nt_errstr(status));
+ return False;
+ }
+
+ NDR_PRINT_UNION_DEBUG(samr_UserInfo, r.in.level, r.out.info);
+
+ return True;
+}
+
+static BOOL test_OpenUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle, uint32 rid)
+{
+ NTSTATUS status;
+ struct samr_OpenUser r;
+ struct policy_handle acct_handle;
+
+ printf("Testing OpenUser(%u)\n", rid);
+
+ r.in.handle = handle;
+ r.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED;
+ r.in.rid = rid;
+ r.out.acct_handle = &acct_handle;
+
+ status = dcerpc_samr_OpenUser(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("OpenUser(%u) failed - %s\n", rid, nt_errstr(status));
+ return False;
+ }
+
+ if (!test_QueryUserInfo(p, mem_ctx, &acct_handle)) {
+ return False;
+ }
+
+ return True;
+}
+
static BOOL test_EnumDomainUsers(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct policy_handle *handle)
{
NTSTATUS status;
struct samr_EnumDomainUsers r;
uint32 resume_handle=0;
+ int i;
+ BOOL ret = True;
printf("Testing EnumDomainUsers\n");
@@ -44,7 +95,17 @@ static BOOL test_EnumDomainUsers(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
NDR_PRINT_DEBUG(samr_SamArray, r.out.sam);
- return True;
+ if (!r.out.sam) {
+ return False;
+ }
+
+ for (i=0;i<r.out.sam->count;i++) {
+ if (!test_OpenUser(p, mem_ctx, handle, r.out.sam->entries[i].idx)) {
+ ret = False;
+ }
+ }
+
+ return ret;
}
static BOOL test_EnumDomainGroups(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
@@ -72,6 +133,31 @@ static BOOL test_EnumDomainGroups(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return True;
}
+static BOOL test_EnumDomainAliases(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
+ struct policy_handle *handle)
+{
+ NTSTATUS status;
+ struct samr_EnumDomainAliases r;
+ uint32 resume_handle=0;
+
+ printf("Testing EnumDomainAliases\n");
+
+ r.in.handle = handle;
+ r.in.resume_handle = &resume_handle;
+ r.in.max_size = (uint32)-1;
+ r.out.resume_handle = &resume_handle;
+
+ status = dcerpc_samr_EnumDomainAliases(p, mem_ctx, &r);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("EnumDomainAliases failed - %s\n", nt_errstr(status));
+ return False;
+ }
+
+ NDR_PRINT_DEBUG(samr_SamArray, r.out.sam);
+
+ return True;
+}
+
static BOOL test_QueryDomainInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
struct policy_handle *handle)
{
@@ -125,11 +211,15 @@ static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
return False;
}
+ if (!test_EnumDomainUsers(p, mem_ctx, &domain_handle)) {
+ return False;
+ }
+
if (!test_EnumDomainGroups(p, mem_ctx, &domain_handle)) {
return False;
}
- if (!test_EnumDomainUsers(p, mem_ctx, &domain_handle)) {
+ if (!test_EnumDomainAliases(p, mem_ctx, &domain_handle)) {
return False;
}