summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-09-03 18:33:17 +1000
committerAndrew Tridgell <tridge@samba.org>2009-09-03 18:36:10 +1000
commitb72b8f6e7d6a83999153b71edd6f50a1803eff95 (patch)
tree267724f6cccc714cd5a26bb64d19307b9876b32a
parent47f52e7a337f1f0e35c77f480146bbee3ac1d309 (diff)
downloadsamba-b72b8f6e7d6a83999153b71edd6f50a1803eff95.tar.gz
samba-b72b8f6e7d6a83999153b71edd6f50a1803eff95.tar.bz2
samba-b72b8f6e7d6a83999153b71edd6f50a1803eff95.zip
hook on prepare_commit instead of transaction_end
This allows for safe transaction end aborts
-rw-r--r--source4/dsdb/samdb/ldb_modules/repl_meta_data.c11
-rw-r--r--source4/dsdb/samdb/ldb_modules/update_keytab.c8
2 files changed, 11 insertions, 8 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
index 7d8635b46e..da9087acbf 100644
--- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
+++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
@@ -1736,10 +1736,10 @@ static int replmd_start_transaction(struct ldb_module *module)
}
/*
- on end transaction we loop over our queued la_context structures and
+ on prepare commit we loop over our queued la_context structures and
apply each of them
*/
-static int replmd_end_transaction(struct ldb_module *module)
+static int replmd_prepare_commit(struct ldb_module *module)
{
struct replmd_private *replmd_private =
talloc_get_type(ldb_module_get_private(module), struct replmd_private);
@@ -1757,8 +1757,11 @@ static int replmd_end_transaction(struct ldb_module *module)
return ret;
}
}
+
+ talloc_free(replmd_private);
+ ldb_module_set_private(module, NULL);
- return ldb_next_end_trans(module);
+ return ldb_next_prepare_commit(module);
}
static int replmd_del_transaction(struct ldb_module *module)
@@ -1777,6 +1780,6 @@ _PUBLIC_ const struct ldb_module_ops ldb_repl_meta_data_module_ops = {
.modify = replmd_modify,
.extended = replmd_extended,
.start_transaction = replmd_start_transaction,
- .end_transaction = replmd_end_transaction,
+ .prepare_commit = replmd_prepare_commit,
.del_transaction = replmd_del_transaction,
};
diff --git a/source4/dsdb/samdb/ldb_modules/update_keytab.c b/source4/dsdb/samdb/ldb_modules/update_keytab.c
index 302c1c8911..f08600ea32 100644
--- a/source4/dsdb/samdb/ldb_modules/update_keytab.c
+++ b/source4/dsdb/samdb/ldb_modules/update_keytab.c
@@ -378,8 +378,8 @@ static int update_kt_rename(struct ldb_module *module, struct ldb_request *req)
return ldb_next_request(module, down_req);
}
-/* end a transaction */
-static int update_kt_end_trans(struct ldb_module *module)
+/* prepare for a commit */
+static int update_kt_prepare_commit(struct ldb_module *module)
{
struct ldb_context *ldb;
struct update_kt_private *data = talloc_get_type(ldb_module_get_private(module), struct update_kt_private);
@@ -401,7 +401,7 @@ static int update_kt_end_trans(struct ldb_module *module)
talloc_free(data->changed_dns);
data->changed_dns = NULL;
- return ldb_next_end_trans(module);
+ return ldb_next_prepare_commit(module);
}
/* end a transaction */
@@ -442,6 +442,6 @@ _PUBLIC_ const struct ldb_module_ops ldb_update_keytab_module_ops = {
.modify = update_kt_modify,
.rename = update_kt_rename,
.del = update_kt_delete,
- .end_transaction = update_kt_end_trans,
+ .prepare_commit = update_kt_prepare_commit,
.del_transaction = update_kt_del_trans,
};