diff options
author | Andrew Bartlett <abartlet@samba.org> | 2005-12-15 20:29:02 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:47:26 -0500 |
commit | d8966dcd7e88df9817c81434056628c0beff21e3 (patch) | |
tree | 84d27d080b93a1da43226fda206a46792116be95 /source4/auth | |
parent | 984860f922a02acec1ef0cd080900f037dbbeada (diff) | |
download | samba-d8966dcd7e88df9817c81434056628c0beff21e3.tar.gz samba-d8966dcd7e88df9817c81434056628c0beff21e3.tar.bz2 samba-d8966dcd7e88df9817c81434056628c0beff21e3.zip |
r12268: Use transactions to ensure that the schannel db is consistant.
Andrew Bartlett
(This used to be commit 949137e3122a3163a9fc923a418633a791364afe)
Diffstat (limited to 'source4/auth')
-rw-r--r-- | source4/auth/gensec/schannel_state.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source4/auth/gensec/schannel_state.c b/source4/auth/gensec/schannel_state.c index 8f9a8ef6b5..edc7b8445b 100644 --- a/source4/auth/gensec/schannel_state.c +++ b/source4/auth/gensec/schannel_state.c @@ -122,6 +122,14 @@ NTSTATUS schannel_store_session_key(TALLOC_CTX *mem_ctx, ldb_msg_add_string(msg, "flatname", creds->domain); samdb_msg_add_dom_sid(ldb, mem_ctx, msg, "objectSid", creds->sid); + ret = ldb_transaction_start(ldb); + if (ret != 0) { + DEBUG(0,("Unable to start transaction to add %s to session key db - %s\n", + ldb_dn_linearize(msg, msg->dn), ldb_errstring(ldb))); + talloc_free(ldb); + return NT_STATUS_INTERNAL_DB_CORRUPTION; + } + ldb_delete(ldb, msg->dn); ret = ldb_add(ldb, msg); @@ -133,6 +141,15 @@ NTSTATUS schannel_store_session_key(TALLOC_CTX *mem_ctx, return NT_STATUS_INTERNAL_DB_CORRUPTION; } + ret = ldb_transaction_commit(ldb); + + if (ret != 0) { + DEBUG(0,("Unable to commit adding %s to session key db - %s\n", + ldb_dn_linearize(msg, msg->dn), ldb_errstring(ldb))); + talloc_free(ldb); + return NT_STATUS_INTERNAL_DB_CORRUPTION; + } + talloc_free(ldb); return NT_STATUS_OK; |