summaryrefslogtreecommitdiff
path: root/source4/dsdb/common
diff options
context:
space:
mode:
authorKamen Mazdrashki <kamen.mazdrashki@postpath.com>2009-12-18 18:11:48 +0200
committerAndrew Tridgell <tridge@samba.org>2009-12-21 23:44:47 +1100
commit11e2c5777dc1bd8af1f696e04d0712fe43e7a21a (patch)
treeebcedd9963e9c41f38e7be9474a84de0cb57f12f /source4/dsdb/common
parent516316b107e309a32362b7de9b010b73545480e0 (diff)
downloadsamba-11e2c5777dc1bd8af1f696e04d0712fe43e7a21a.tar.gz
samba-11e2c5777dc1bd8af1f696e04d0712fe43e7a21a.tar.bz2
samba-11e2c5777dc1bd8af1f696e04d0712fe43e7a21a.zip
s4-dsdb-util: Utility function to process ldb_request in transaction
This function is to be used later for manually crafted ldb_requests from within dsdb layer Signed-off-by: Andrew Tridgell <tridge@samba.org>
Diffstat (limited to 'source4/dsdb/common')
-rw-r--r--source4/dsdb/common/util.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index b0f9ef0f35..4f7ddde14c 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -997,6 +997,32 @@ int samdb_replace(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, struct ldb_m
}
/*
+ * Handle ldb_request in transaction
+ */
+static int dsdb_autotransaction_request(struct ldb_context *sam_ldb,
+ struct ldb_request *req)
+{
+ int ret;
+
+ ret = ldb_transaction_start(sam_ldb);
+ if (ret != LDB_SUCCESS) {
+ return ret;
+ }
+
+ ret = ldb_request(sam_ldb, req);
+ if (ret == LDB_SUCCESS) {
+ ret = ldb_wait(req->handle, LDB_WAIT_ALL);
+ }
+
+ if (ret == LDB_SUCCESS) {
+ return ldb_transaction_commit(sam_ldb);
+ }
+ ldb_transaction_cancel(sam_ldb);
+
+ return ret;
+}
+
+/*
return a default security descriptor
*/
struct security_descriptor *samdb_default_security_descriptor(TALLOC_CTX *mem_ctx)