summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-09-28 12:28:59 +1000
committerAndrew Tridgell <tridge@samba.org>2009-09-28 13:11:21 +1000
commitf279b57f194d1be3600215b98e7e5fc6431d31c3 (patch)
treecb7e386f8e722a918dfde89bb7ef13130946d5ae /source4/dsdb/samdb
parentda3f5a4113d7c828dc7d14226361473fb9ff00e7 (diff)
downloadsamba-f279b57f194d1be3600215b98e7e5fc6431d31c3.tar.gz
samba-f279b57f194d1be3600215b98e7e5fc6431d31c3.tar.bz2
samba-f279b57f194d1be3600215b98e7e5fc6431d31c3.zip
s4-dsdb: don't return the partition root objects
When searching across partitions, we want to avoid sending duplicate records caused by the record appearing both as a mount point and as a partition root in a nested partition. This patch works by intercepting objects from searches and checking if they match a partition root. If they do, and the partition is not the one in the partition control request, then discard the object.
Diffstat (limited to 'source4/dsdb/samdb')
-rw-r--r--source4/dsdb/samdb/ldb_modules/partition.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/partition.c b/source4/dsdb/samdb/ldb_modules/partition.c
index 79d11fd958..6e86d4c484 100644
--- a/source4/dsdb/samdb/ldb_modules/partition.c
+++ b/source4/dsdb/samdb/ldb_modules/partition.c
@@ -186,9 +186,11 @@ static int partition_req_callback(struct ldb_request *req,
struct partition_context *ac;
struct ldb_module *module;
struct ldb_request *nreq;
- int ret;
+ int ret, i;
+ struct partition_private_data *data;
ac = talloc_get_type(req->context, struct partition_context);
+ data = talloc_get_type(ac->module->private_data, struct partition_private_data);
if (!ares) {
return ldb_module_done(ac->req, NULL, NULL,
@@ -213,6 +215,22 @@ static int partition_req_callback(struct ldb_request *req,
return ldb_module_done(ac->req, NULL, NULL,
LDB_ERR_OPERATIONS_ERROR);
}
+ for (i=0; data && data->partitions && data->partitions[i]; i++) {
+ if (ldb_dn_compare(ares->message->dn, data->partitions[i]->ctrl->dn) == 0) {
+ struct ldb_control *part_control;
+ /* this is a partition root message - make
+ sure it isn't one of our fake root
+ entries from a parent partition */
+ part_control = ldb_request_get_control(req, DSDB_CONTROL_CURRENT_PARTITION_OID);
+ if (part_control && part_control->data != data->partitions[i]->ctrl) {
+ DEBUG(6,(__location__ ": Discarding partition mount object %s\n",
+ ldb_dn_get_linearized(ares->message->dn)));
+ talloc_free(ares);
+ return LDB_SUCCESS;
+ }
+ }
+ }
+
return ldb_module_send_entry(ac->req, ares->message, ares->controls);
case LDB_REPLY_DONE: