summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2009-05-29 08:35:41 +1000
committerAndrew Bartlett <abartlet@samba.org>2009-05-29 11:56:27 +1000
commita3f619f9d9f0e6425c453a9e8dc97794e74c4a42 (patch)
treeb8dfe4abc00d6869076f9df3266e907b0fdd99b1 /source4/torture
parent98ff29291b26abe35efc6cc2552b9e49c4330983 (diff)
downloadsamba-a3f619f9d9f0e6425c453a9e8dc97794e74c4a42.tar.gz
samba-a3f619f9d9f0e6425c453a9e8dc97794e74c4a42.tar.bz2
samba-a3f619f9d9f0e6425c453a9e8dc97794e74c4a42.zip
s4:torture Clean up users and groups added in RPC-SAMR-LARGE-DC
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/rpc/samr.c48
1 files changed, 37 insertions, 11 deletions
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
index 1f7bb67eca..c5050edc52 100644
--- a/source4/torture/rpc/samr.c
+++ b/source4/torture/rpc/samr.c
@@ -6176,6 +6176,8 @@ static bool test_ManyObjects(struct dcerpc_pipe *p,
NTSTATUS status;
uint32_t i;
+ struct policy_handle *handles = talloc_zero_array(tctx, struct policy_handle, num_total);
+
/* query */
{
@@ -6208,29 +6210,25 @@ static bool test_ManyObjects(struct dcerpc_pipe *p,
for (i=0; i < num_total; i++) {
- struct policy_handle handle;
const char *name = NULL;
- ZERO_STRUCT(handle);
-
switch (which_ops) {
case TORTURE_SAMR_MANY_ACCOUNTS:
name = talloc_asprintf(tctx, "%s%04d", TEST_ACCOUNT_NAME, i);
- ret &= test_CreateUser(p, tctx, domain_handle, name, &handle, domain_sid, 0, NULL, false);
+ ret &= test_CreateUser(p, tctx, domain_handle, name, &handles[i], domain_sid, 0, NULL, false);
break;
case TORTURE_SAMR_MANY_GROUPS:
name = talloc_asprintf(tctx, "%s%04d", TEST_GROUPNAME, i);
- ret &= test_CreateDomainGroup(p, tctx, domain_handle, name, &handle, domain_sid, false);
+ ret &= test_CreateDomainGroup(p, tctx, domain_handle, name, &handles[i], domain_sid, false);
break;
case TORTURE_SAMR_MANY_ALIASES:
name = talloc_asprintf(tctx, "%s%04d", TEST_ALIASNAME, i);
- ret &= test_CreateAlias(p, tctx, domain_handle, name, &handle, domain_sid, false);
+ ret &= test_CreateAlias(p, tctx, domain_handle, name, &handles[i], domain_sid, false);
break;
default:
return false;
}
- if (!policy_handle_empty(&handle)) {
- ret &= test_samr_handle_Close(p, tctx, &handle);
+ if (!policy_handle_empty(&handles[i])) {
num_created++;
}
}
@@ -6251,9 +6249,6 @@ static bool test_ManyObjects(struct dcerpc_pipe *p,
return false;
}
- torture_assert_int_equal(tctx, num_enum, num_anounced + num_created,
- "unexpected number of results returned in enum call");
-#if 0
/* TODO: dispinfo */
switch (which_ops) {
@@ -6267,9 +6262,40 @@ static bool test_ManyObjects(struct dcerpc_pipe *p,
return false;
}
+
+ /* delete */
+
+ for (i=0; i < num_total; i++) {
+
+ if (policy_handle_empty(&handles[i])) {
+ continue;
+ }
+
+ switch (which_ops) {
+ case TORTURE_SAMR_MANY_ACCOUNTS:
+ ret &= test_DeleteUser(p, tctx, &handles[i]);
+ break;
+ case TORTURE_SAMR_MANY_GROUPS:
+ ret &= test_DeleteDomainGroup(p, tctx, &handles[i]);
+ break;
+ case TORTURE_SAMR_MANY_ALIASES:
+ ret &= test_DeleteAlias(p, tctx, &handles[i]);
+ break;
+ default:
+ return false;
+ }
+
+ ret &= test_samr_handle_Close(p, tctx, &handles[i]);
+ }
+
+ talloc_free(handles);
+
+#if 0
torture_assert_int_equal(tctx, num_disp, num_anounced + num_created,
"unexpected number of results returned in dispinfo call");
#endif
+ torture_assert_int_equal(tctx, num_enum, num_anounced + num_created,
+ "unexpected number of results returned in enum call");
return ret;
}