summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/common/ldb_modules.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/ldb/common/ldb_modules.c')
-rw-r--r--source4/lib/ldb/common/ldb_modules.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c
index 05dffd005a..b792daa913 100644
--- a/source4/lib/ldb/common/ldb_modules.c
+++ b/source4/lib/ldb/common/ldb_modules.c
@@ -472,10 +472,14 @@ int ldb_load_modules(struct ldb_context *ldb, const char *options[])
which makes writing a module simpler, and makes it more likely to keep working
when ldb is extended
*/
-#define FIND_OP(module, op) do { \
- struct ldb_context *ldb = module->ldb; \
+#define FIND_OP_NOERR(module, op) do { \
module = module->next; \
while (module && module->ops->op == NULL) module = module->next; \
+} while (0)
+
+#define FIND_OP(module, op) do { \
+ struct ldb_context *ldb = module->ldb; \
+ FIND_OP_NOERR(module, op); \
if (module == NULL) { \
ldb_asprintf_errstring(ldb, "Unable to find backend operation for " #op ); \
return LDB_ERR_OPERATIONS_ERROR; \
@@ -595,6 +599,17 @@ int ldb_next_end_trans(struct ldb_module *module)
return module->ops->end_transaction(module);
}
+int ldb_next_prepare_commit(struct ldb_module *module)
+{
+ FIND_OP_NOERR(module, prepare_commit);
+ if (module == NULL) {
+ /* we are allowed to have no prepare commit in
+ backends */
+ return LDB_SUCCESS;
+ }
+ return module->ops->prepare_commit(module);
+}
+
int ldb_next_del_trans(struct ldb_module *module)
{
FIND_OP(module, del_transaction);