summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2009-10-15 10:49:25 +1100
committerAndrew Bartlett <abartlet@samba.org>2009-10-21 22:43:53 +1100
commitf545d5fa43ac0f08f69cf3e130a4b7be1d90784f (patch)
treed230e0527f58a9cdcf141464d518185c0ab8db5e /source4/dsdb/samdb
parent17237f18f09798c90b2234150d502ccd21eb5880 (diff)
downloadsamba-f545d5fa43ac0f08f69cf3e130a4b7be1d90784f.tar.gz
samba-f545d5fa43ac0f08f69cf3e130a4b7be1d90784f.tar.bz2
samba-f545d5fa43ac0f08f69cf3e130a4b7be1d90784f.zip
s4:dsdb In partitions module, tell the caller what partition was used.
This means we don't return any control for modifications to the control records in sam.ldb, but do if they modified one of the actual data LDB files. Andrew Bartlett
Diffstat (limited to 'source4/dsdb/samdb')
-rw-r--r--source4/dsdb/samdb/ldb_modules/partition.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/partition.c b/source4/dsdb/samdb/ldb_modules/partition.c
index d1892f0c54..64ec798e4c 100644
--- a/source4/dsdb/samdb/ldb_modules/partition.c
+++ b/source4/dsdb/samdb/ldb_modules/partition.c
@@ -66,7 +66,7 @@ static struct partition_context *partition_init_ctx(struct ldb_module *module, s
* helper functions to call the next module in chain
* */
-static int partition_request(struct ldb_module *module, struct ldb_request *request)
+int partition_request(struct ldb_module *module, struct ldb_request *request)
{
int ret;
switch (request->operation) {
@@ -160,6 +160,7 @@ static int partition_req_callback(struct ldb_request *req,
struct ldb_request *nreq;
int ret, i;
struct partition_private_data *data;
+ struct ldb_control *partition_ctrl;
ac = talloc_get_type(req->context, struct partition_context);
data = talloc_get_type(ac->module->private_data, struct partition_private_data);
@@ -169,6 +170,21 @@ static int partition_req_callback(struct ldb_request *req,
LDB_ERR_OPERATIONS_ERROR);
}
+ partition_ctrl = ldb_request_get_control(req, DSDB_CONTROL_CURRENT_PARTITION_OID);
+ if (partition_ctrl && (ac->num_requests == 1 || ares->type == LDB_REPLY_ENTRY)) {
+ /* If we didn't fan this request out to mulitple partitions,
+ * or this is an individual search result, we can
+ * deterministily tell the caller what partition this was
+ * written to (repl_meta_data likes to know) */
+ ret = ldb_reply_add_control(ares,
+ DSDB_CONTROL_CURRENT_PARTITION_OID,
+ false, partition_ctrl->data);
+ if (ret != LDB_SUCCESS) {
+ return ldb_module_done(ac->req, NULL, NULL,
+ ret);
+ }
+ }
+
if (ares->error != LDB_SUCCESS && !ac->got_success) {
return ldb_module_done(ac->req, ares->controls,
ares->response, ares->error);