From bdf0578621520ca52c7f6834fb337a761ada1dad Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 18 Nov 2003 10:21:05 +0000 Subject: added samr_CreateUser() samr_DeleteUser(). The test suite creates a test user called "samrtorturetest" and then deletes it. The next step is to do all possible user operations on that temporary user. (This used to be commit 41fc922954bd8ec461a79a22cc903e63902c7401) --- source4/torture/rpc/samr.c | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) (limited to 'source4/torture/rpc') diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c index 79f64005be..415f899947 100644 --- a/source4/torture/rpc/samr.c +++ b/source4/torture/rpc/samr.c @@ -59,6 +59,48 @@ static BOOL test_QuerySecurity(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, } +static BOOL test_CreateUser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, + struct policy_handle *handle) +{ + NTSTATUS status; + struct samr_CreateUser r; + struct samr_DeleteUser d; + struct policy_handle acct_handle; + uint32 rid; + struct samr_Name name; + + name.name = "samrtorturetest"; + + r.in.handle = handle; + r.in.username = &name; + r.in.access_mask = SEC_RIGHTS_MAXIMUM_ALLOWED; + r.out.acct_handle = &acct_handle; + r.out.rid = &rid; + + printf("Testing CreateUser(%s)\n", r.in.username->name); + + status = dcerpc_samr_CreateUser(p, mem_ctx, &r); + if (!NT_STATUS_IS_OK(status) && + !NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { + printf("CreateUser failed - %s\n", nt_errstr(status)); + return False; + } + + + printf("Testing DeleteUser\n"); + + d.in.handle = &acct_handle; + d.out.handle = &acct_handle; + + status = dcerpc_samr_DeleteUser(p, mem_ctx, &d); + if (!NT_STATUS_IS_OK(status)) { + printf("DeleteUser failed - %s\n", nt_errstr(status)); + return False; + } + + return True; +} + static BOOL test_QueryAliasInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct policy_handle *handle) { @@ -400,11 +442,9 @@ static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, return False; } -#if 0 if (!test_CreateUser(p, mem_ctx, &domain_handle)) { ret = False; } -#endif if (!test_QuerySecurity(p, mem_ctx, &domain_handle)) { ret = False; -- cgit