diff options
author | Rafal Szczesniak <mimir@samba.org> | 2005-04-22 05:11:53 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:11:36 -0500 |
commit | 03cae64229f19c950bfacffe76c9ab7cfe919861 (patch) | |
tree | e73c43b86682c8452ddbc1ea8c5c21f28f74f4c5 | |
parent | f531686dc4c708b9e1563ba112430291ae9f61bf (diff) | |
download | samba-03cae64229f19c950bfacffe76c9ab7cfe919861.tar.gz samba-03cae64229f19c950bfacffe76c9ab7cfe919861.tar.bz2 samba-03cae64229f19c950bfacffe76c9ab7cfe919861.zip |
r6430: Delete existing test account if, for some reason, it hasn't been
deleted last time running the test.
rafal
(This used to be commit 91df25a795b3754c9445af6ade53cbc89ec4a545)
-rw-r--r-- | source4/torture/libnet/userman.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/source4/torture/libnet/userman.c b/source4/torture/libnet/userman.c index c472f00e46..978cff35c1 100644 --- a/source4/torture/libnet/userman.c +++ b/source4/torture/libnet/userman.c @@ -176,6 +176,22 @@ static BOOL test_createuser(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, status = dcerpc_samr_CreateUser(p, mem_ctx, &r1); if (!NT_STATUS_IS_OK(status)) { printf("CreateUser failed - %s\n", nt_errstr(status)); + + if (NT_STATUS_EQUAL(status, NT_STATUS_USER_EXISTS)) { + printf("User (%s) already exists - attempting to delete and recreate account again\n", user); + if (!test_cleanup(p, mem_ctx, handle, TEST_USERNAME)) { + return False; + } + + printf("creating user account\n"); + + status = dcerpc_samr_CreateUser(p, mem_ctx, &r1); + if (!NT_STATUS_IS_OK(status)) { + printf("CreateUser failed - %s\n", nt_errstr(status)); + return False; + } + return True; + } return False; } @@ -292,12 +308,12 @@ BOOL torture_userdel(void) ret = False; goto done; } - - if (!test_userdel(p, mem_ctx, &h, name)) { + + if (!test_userdel(p, mem_ctx, &h, name)) { ret = False; goto done; } - + done: talloc_free(mem_ctx); return ret; |