diff options
author | Kamen Mazdrashki <kamenim@samba.org> | 2010-06-11 15:44:34 +0300 |
---|---|---|
committer | Kamen Mazdrashki <kamenim@samba.org> | 2010-06-11 17:46:35 +0300 |
commit | 9baa73053e9119991d3ad6c72b153a006e153b89 (patch) | |
tree | 9d258e414535f58a2839c2fde3ee892ec3d30a69 | |
parent | 6eecb968cb0eeea7212477dcee8148f093d8c88f (diff) | |
download | samba-9baa73053e9119991d3ad6c72b153a006e153b89.tar.gz samba-9baa73053e9119991d3ad6c72b153a006e153b89.tar.bz2 samba-9baa73053e9119991d3ad6c72b153a006e153b89.zip |
s4/test-libnet: Refactor test_group_create() a little to:
- Close unused policy handle for created group
- re-align code - it is more readable this way IMHO
-rw-r--r-- | source4/torture/libnet/utils.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/source4/torture/libnet/utils.c b/source4/torture/libnet/utils.c index b4b2374acf..09298054dc 100644 --- a/source4/torture/libnet/utils.c +++ b/source4/torture/libnet/utils.c @@ -366,8 +366,10 @@ bool test_group_cleanup(struct torture_context *tctx, * which case RID is not required by caller */ bool test_group_create(struct torture_context *tctx, - struct dcerpc_binding_handle *b, TALLOC_CTX *mem_ctx, - struct policy_handle *handle, const char *name, + struct dcerpc_binding_handle *b, + TALLOC_CTX *mem_ctx, + struct policy_handle *handle, + const char *group_name, uint32_t *rid) { uint32_t group_rid; @@ -375,7 +377,7 @@ bool test_group_create(struct torture_context *tctx, struct samr_CreateDomainGroup r; struct policy_handle group_handle; - groupname.string = name; + groupname.string = group_name; r.in.domain_handle = handle; r.in.name = &groupname; @@ -385,33 +387,42 @@ bool test_group_create(struct torture_context *tctx, * don't care about the group RID */ r.out.rid = rid ? rid : &group_rid; - torture_comment(tctx, "creating group account %s\n", name); + torture_comment(tctx, "creating group account %s\n", group_name); torture_assert_ntstatus_ok(tctx, - dcerpc_samr_CreateDomainGroup_r(b, mem_ctx, &r), - "CreateGroup failed"); + dcerpc_samr_CreateDomainGroup_r(b, mem_ctx, &r), + "CreateGroup failed"); if (!NT_STATUS_IS_OK(r.out.result)) { torture_comment(tctx, "CreateGroup failed - %s\n", nt_errstr(r.out.result)); if (NT_STATUS_EQUAL(r.out.result, NT_STATUS_GROUP_EXISTS)) { - torture_comment(tctx, "Group (%s) already exists - attempting to delete and recreate group again\n", name); - if (!test_group_cleanup(tctx, b, mem_ctx, handle, name)) { + torture_comment(tctx, + "Group (%s) already exists - " + "attempting to delete and recreate group again\n", + group_name); + if (!test_group_cleanup(tctx, b, mem_ctx, handle, group_name)) { return false; } torture_comment(tctx, "creating group account\n"); torture_assert_ntstatus_ok(tctx, - dcerpc_samr_CreateDomainGroup_r(b, mem_ctx, &r), - "CreateGroup failed"); + dcerpc_samr_CreateDomainGroup_r(b, mem_ctx, &r), + "CreateGroup failed"); torture_assert_ntstatus_ok(tctx, r.out.result, - "CreateGroup failed"); + "CreateGroup failed"); + + /* be nice and close opened handles */ + test_samr_close_handle(tctx, b, mem_ctx, &group_handle); return true; } return false; } + /* be nice and close opened handles */ + test_samr_close_handle(tctx, b, mem_ctx, &group_handle); + return true; } |