summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-09-02 11:17:43 +1000
committerAndrew Tridgell <tridge@samba.org>2009-09-02 18:19:55 +1000
commita19ad210332008c25e24dd6aba6a3479ba9ffe3f (patch)
tree276659ab0b27141659c9048644642442b0c4c03a
parent132242fe7ebbf7bba9fb5a361788b0157cc704ac (diff)
downloadsamba-a19ad210332008c25e24dd6aba6a3479ba9ffe3f.tar.gz
samba-a19ad210332008c25e24dd6aba6a3479ba9ffe3f.tar.bz2
samba-a19ad210332008c25e24dd6aba6a3479ba9ffe3f.zip
Wrap DRS changes in a transaction
We should always apply a whole set of DRS changes or none of them. See [MS-DRSR] 3.3.2
-rw-r--r--source4/dsdb/repl/replicated_objects.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source4/dsdb/repl/replicated_objects.c b/source4/dsdb/repl/replicated_objects.c
index d96a063599..8018254a00 100644
--- a/source4/dsdb/repl/replicated_objects.c
+++ b/source4/dsdb/repl/replicated_objects.c
@@ -245,15 +245,33 @@ WERROR dsdb_extended_replicated_objects_commit(struct ldb_context *ldb,
/* TODO: handle linked attributes */
+ /* wrap the extended operation in a transaction
+ See [MS-DRSR] 3.3.2 Transactions
+ */
+ ret = ldb_transaction_start(ldb);
+ if (ret != LDB_SUCCESS) {
+ DEBUG(0,(__location__ " Failed to start transaction\n"));
+ talloc_free(out);
+ return WERR_FOOBAR;
+ }
+
ret = ldb_extended(ldb, DSDB_EXTENDED_REPLICATED_OBJECTS_OID, out, &ext_res);
if (ret != LDB_SUCCESS) {
DEBUG(0,("Failed to apply records: %s: %s\n",
ldb_errstring(ldb), ldb_strerror(ret)));
talloc_free(out);
+ ldb_transaction_cancel(ldb);
return WERR_FOOBAR;
}
talloc_free(ext_res);
+ ret = ldb_transaction_commit(ldb);
+ if (ret != LDB_SUCCESS) {
+ DEBUG(0,(__location__ " Failed to commit transaction\n"));
+ talloc_free(out);
+ return WERR_FOOBAR;
+ }
+
if (_out) {
*_out = out;
} else {