summaryrefslogtreecommitdiff
path: root/source4/torture/rpc/samr.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-11-18 10:21:05 +0000
committerAndrew Tridgell <tridge@samba.org>2003-11-18 10:21:05 +0000
commitbdf0578621520ca52c7f6834fb337a761ada1dad (patch)
tree6057204bfa742e631887576e3c887901a0d623e9 /source4/torture/rpc/samr.c
parentd1667d5799a873d2fe55d9ba58dc776ddd0b90f5 (diff)
downloadsamba-bdf0578621520ca52c7f6834fb337a761ada1dad.tar.gz
samba-bdf0578621520ca52c7f6834fb337a761ada1dad.tar.bz2
samba-bdf0578621520ca52c7f6834fb337a761ada1dad.zip
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)
Diffstat (limited to 'source4/torture/rpc/samr.c')
-rw-r--r--source4/torture/rpc/samr.c44
1 files changed, 42 insertions, 2 deletions
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;