From f6e585d69bda48ef7625ce57b78978f77bb9c04c Mon Sep 17 00:00:00 2001 From: Rafal Szczesniak Date: Thu, 21 Apr 2005 12:22:48 +0000 Subject: r6420: Close user account handle before calling tested function to better simulate real conditions of calling the function. rafal (This used to be commit 2518122c9e230639db253ff02de1843cb3448198) --- source4/torture/libnet/userman.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'source4/torture') diff --git a/source4/torture/libnet/userman.c b/source4/torture/libnet/userman.c index 75b05153d4..947d671ae0 100644 --- a/source4/torture/libnet/userman.c +++ b/source4/torture/libnet/userman.c @@ -159,25 +159,37 @@ static BOOL test_createuser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, NTSTATUS status; struct policy_handle h, domain_handle, user_handle; struct samr_String username; - struct samr_CreateUser r4; + struct samr_CreateUser r1; + struct samr_Close r2; uint32_t user_rid; username.string = user; - r4.in.domain_handle = handle; - r4.in.account_name = &username; - r4.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; - r4.out.user_handle = &user_handle; - r4.out.rid = &user_rid; + r1.in.domain_handle = handle; + r1.in.account_name = &username; + r1.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED; + r1.out.user_handle = &user_handle; + r1.out.rid = &user_rid; printf("creating user '%s'\n", username.string); - status = dcerpc_samr_CreateUser(p, mem_ctx, &r4); + status = dcerpc_samr_CreateUser(p, mem_ctx, &r1); if (!NT_STATUS_IS_OK(status)) { printf("CreateUser failed - %s\n", nt_errstr(status)); return False; } + r2.in.handle = &user_handle; + r2.out.handle = &user_handle; + + printf("closing user '%s'\n", username.string); + + status = dcerpc_samr_Close(p, mem_ctx, &r2); + if (!NT_STATUS_IS_OK(status)) { + printf("Close failed - %s\n", nt_errstr(status)); + return False; + } + return True; } -- cgit