summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-12-16 11:32:57 +1100
committerAndrew Tridgell <tridge@samba.org>2009-12-16 20:56:21 +1100
commit9fa1f96172ffd2552a0e6b385b63e7d7dca024e7 (patch)
tree6260e80cf04316f2b8aeaf1722ecad4271f4b027 /source4/dsdb/samdb
parent4b970c00ae5a0b89dca4664725ab1fa1650490f0 (diff)
downloadsamba-9fa1f96172ffd2552a0e6b385b63e7d7dca024e7.tar.gz
samba-9fa1f96172ffd2552a0e6b385b63e7d7dca024e7.tar.bz2
samba-9fa1f96172ffd2552a0e6b385b63e7d7dca024e7.zip
s4-dsdb: added dsdb_module_modify()
This is used to do a sync modify in a module Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/dsdb/samdb')
-rw-r--r--source4/dsdb/samdb/ldb_modules/util.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/util.c b/source4/dsdb/samdb/ldb_modules/util.c
index 1ef69895d4..1d5c74c46d 100644
--- a/source4/dsdb/samdb/ldb_modules/util.c
+++ b/source4/dsdb/samdb/ldb_modules/util.c
@@ -254,3 +254,43 @@ int dsdb_module_dn_by_guid(struct ldb_module *module, TALLOC_CTX *mem_ctx,
talloc_free(tmp_ctx);
return LDB_SUCCESS;
}
+
+/*
+ a ldb_modify request operating on modules below the
+ current module
+ */
+int dsdb_module_modify(struct ldb_module *module,
+ const struct ldb_message *message,
+ uint32_t dsdb_flags)
+{
+ struct ldb_request *mod_req;
+ int ret;
+ struct ldb_context *ldb = ldb_module_get_ctx(module);
+ TALLOC_CTX *tmp_ctx = talloc_new(module);
+
+ ret = ldb_build_mod_req(&mod_req, ldb, tmp_ctx,
+ message,
+ NULL,
+ NULL,
+ ldb_op_default_callback,
+ NULL);
+ if (ret != LDB_SUCCESS) {
+ talloc_free(tmp_ctx);
+ return ret;
+ }
+
+ ret = dsdb_request_add_controls(module, mod_req, dsdb_flags);
+ if (ret != LDB_SUCCESS) {
+ talloc_free(tmp_ctx);
+ return ret;
+ }
+
+ /* Run the new request */
+ ret = ldb_next_request(module, mod_req);
+ if (ret == LDB_SUCCESS) {
+ ret = ldb_wait(mod_req->handle, LDB_WAIT_ALL);
+ }
+
+ talloc_free(tmp_ctx);
+ return ret;
+}