diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-11-15 12:14:22 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-11-15 12:14:22 +0000 |
commit | 4d00dd9d5d0a134804fb1d0e5e24980efee175a8 (patch) | |
tree | b63dde806a8c0c12cc33cd2f321ad501eade3795 /source4/torture/rpc | |
parent | f272eb3139aebe5fb87666779ebaba04209cbc94 (diff) | |
download | samba-4d00dd9d5d0a134804fb1d0e5e24980efee175a8.tar.gz samba-4d00dd9d5d0a134804fb1d0e5e24980efee175a8.tar.bz2 samba-4d00dd9d5d0a134804fb1d0e5e24980efee175a8.zip |
added OpenGroup and QueryGroupInfo levels 1 to 4
(This used to be commit ffe4fcaab0fe4f6e0f64fb2d57c77442aa2e1f6f)
Diffstat (limited to 'source4/torture/rpc')
-rw-r--r-- | source4/torture/rpc/samr.c | 75 |
1 files changed, 72 insertions, 3 deletions
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c index e8771f2e5a..f8b89699e2 100644 --- a/source4/torture/rpc/samr.c +++ b/source4/torture/rpc/samr.c @@ -21,6 +21,34 @@ #include "includes.h" +static BOOL test_QueryGroupInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, + struct policy_handle *handle) +{ + NTSTATUS status; + struct samr_QueryGroupInfo r; + uint16 levels[] = {1, 2, 3, 4}; + int i; + BOOL ret = True; + + for (i=0;i<ARRAY_SIZE(levels);i++) { + printf("Testing QueryGroupInfo level %u\n", levels[i]); + + r.in.handle = handle; + r.in.level = levels[i]; + + status = dcerpc_samr_QueryGroupInfo(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + printf("QueryGroupInfo level %u failed - %s\n", + levels[i], nt_errstr(status)); + ret = False; + } + + NDR_PRINT_UNION_DEBUG(samr_GroupInfo, r.in.level, r.out.info); + } + + return ret; +} + static BOOL test_QueryUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -56,6 +84,7 @@ static BOOL test_OpenUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, NTSTATUS status; struct samr_OpenUser r; struct policy_handle acct_handle; + BOOL ret = True; printf("Testing OpenUser(%u)\n", rid); @@ -71,10 +100,38 @@ static BOOL test_OpenUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } if (!test_QueryUserInfo(p, mem_ctx, &acct_handle)) { + ret = False; + } + + return ret; +} + +static BOOL test_OpenGroup(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, + struct policy_handle *handle, uint32 rid) +{ + NTSTATUS status; + struct samr_OpenGroup r; + struct policy_handle acct_handle; + BOOL ret = True; + + printf("Testing OpenGroup(%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_OpenGroup(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + printf("OpenGroup(%u) failed - %s\n", rid, nt_errstr(status)); return False; } - - return True; + + if (!test_QueryGroupInfo(p, mem_ctx, &acct_handle)) { + ret = False; + } + + return ret; } static BOOL test_EnumDomainUsers(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, @@ -121,6 +178,8 @@ static BOOL test_EnumDomainGroups(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, NTSTATUS status; struct samr_EnumDomainGroups r; uint32 resume_handle=0; + int i; + BOOL ret = True; printf("Testing EnumDomainGroups\n"); @@ -137,7 +196,17 @@ static BOOL test_EnumDomainGroups(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_OpenGroup(p, mem_ctx, handle, r.out.sam->entries[i].idx)) { + ret = False; + } + } + + return ret; } static BOOL test_EnumDomainAliases(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, |