summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2005-12-26 23:47:19 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:47:46 -0500
commit9a3be162b8365127f9683965a5eecc8f3fc9d523 (patch)
tree3d8395b731f00d5cbb8acee0cd8e2cca2b4216a1
parent90535d31c69df440b0c0e7ed9e75b5dbf239974b (diff)
downloadsamba-9a3be162b8365127f9683965a5eecc8f3fc9d523.tar.gz
samba-9a3be162b8365127f9683965a5eecc8f3fc9d523.tar.bz2
samba-9a3be162b8365127f9683965a5eecc8f3fc9d523.zip
r12504: Fix one more transaction cancel bail-out path, and correct comments.
Andrew Bartlett (This used to be commit 07b885d0c7b56f40f89955f6c49af49ac9085d74)
-rw-r--r--source4/rpc_server/samr/dcesrv_samr.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source4/rpc_server/samr/dcesrv_samr.c b/source4/rpc_server/samr/dcesrv_samr.c
index 7ff36c5d82..11d9bca068 100644
--- a/source4/rpc_server/samr/dcesrv_samr.c
+++ b/source4/rpc_server/samr/dcesrv_samr.c
@@ -706,7 +706,9 @@ static NTSTATUS samr_EnumDomainGroups(struct dcesrv_call_state *dce_call, TALLOC
/*
samr_CreateUser2
- TODO: This should do some form of locking, especially around the rid allocation
+ This call uses transactions to ensure we don't get a new conflicting
+ user while we are processing this, and to ensure the user either
+ completly exists, or does not.
*/
static NTSTATUS samr_CreateUser2(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
struct samr_CreateUser2 *r)
@@ -771,7 +773,11 @@ static NTSTATUS samr_CreateUser2(struct dcesrv_call_state *dce_call, TALLOC_CTX
}
cn_name = talloc_strdup(mem_ctx, account_name);
- NT_STATUS_HAVE_NO_MEMORY(cn_name);
+ if (!cn_name) {
+ ldb_transaction_cancel(d_state->sam_ctx);
+ return NT_STATUS_NO_MEMORY;
+ }
+
cn_name_len = strlen(cn_name);
/* This must be one of these values *only* */