From 6eecb968cb0eeea7212477dcee8148f093d8c88f Mon Sep 17 00:00:00 2001 From: Kamen Mazdrashki Date: Fri, 11 Jun 2010 15:37:12 +0300 Subject: s4/test-libnet: Refactor test_user_create() little bit to: - fix a flaw that user RID is not returned in case user is recreated - close unused policy handle to created user - do not take into account the result from test_samr_close_handle - we don't case --- source4/torture/libnet/utils.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/source4/torture/libnet/utils.c b/source4/torture/libnet/utils.c index 58db297a99..b4b2374acf 100644 --- a/source4/torture/libnet/utils.c +++ b/source4/torture/libnet/utils.c @@ -253,7 +253,8 @@ bool test_user_create(struct torture_context *tctx, r.in.account_name = &username; r.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; r.out.user_handle = &user_handle; - r.out.rid = &user_rid; + /* return user's RID only if requested */ + r.out.rid = rid ? rid : &user_rid; torture_comment(tctx, "creating user '%s'\n", username.string); @@ -280,21 +281,16 @@ bool test_user_create(struct torture_context *tctx, torture_assert_ntstatus_ok(tctx, r.out.result, "CreateUser failed"); + /* be nice and close opened handles */ + test_samr_close_handle(tctx, b, mem_ctx, &user_handle); + return true; } return false; } - torture_comment(tctx, "closing user '%s'\n", username.string); - - if (!test_samr_close_handle(tctx, b, mem_ctx, &user_handle)) { - return false; - } - - /* return user RID only if requested */ - if (rid) { - *rid = user_rid; - } + /* be nice and close opened handles */ + test_samr_close_handle(tctx, b, mem_ctx, &user_handle); return true; } -- cgit