summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-01-17 16:55:37 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:43:40 -0500
commit1500cd79d97b623816e6e13ea8da4e1ed194fdad (patch)
tree7f1b13f3a7caef14d0916c251554690239c17e68 /source4/dsdb/samdb
parentf58e49ade829067064602cd8d143c7223f75057e (diff)
downloadsamba-1500cd79d97b623816e6e13ea8da4e1ed194fdad.tar.gz
samba-1500cd79d97b623816e6e13ea8da4e1ed194fdad.tar.bz2
samba-1500cd79d97b623816e6e13ea8da4e1ed194fdad.zip
r20855: pass the DSDB_CONTROL_CURRENT_PARTITION_OID control also for the
send_all case metze (This used to be commit b3fce383d3824ee418cbb7343f5d06720f5d31df)
Diffstat (limited to 'source4/dsdb/samdb')
-rw-r--r--source4/dsdb/samdb/ldb_modules/partition.c37
1 files changed, 27 insertions, 10 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/partition.c b/source4/dsdb/samdb/ldb_modules/partition.c
index 9a0dd9ca0a..b23ceebf1b 100644
--- a/source4/dsdb/samdb/ldb_modules/partition.c
+++ b/source4/dsdb/samdb/ldb_modules/partition.c
@@ -204,12 +204,18 @@ error:
}
-static int partition_send_request(struct partition_context *ac, struct ldb_module *partition,
- struct ldb_dn *partition_base_dn)
+static int partition_send_request(struct partition_context *ac, struct dsdb_control_current_partition *partition)
{
int ret;
- struct ldb_module *next = make_module_for_next_request(ac->module, ac->module->ldb, partition);
+ struct ldb_module *backend;
struct ldb_request *req;
+
+ if (partition) {
+ backend = make_module_for_next_request(ac, ac->module->ldb, partition->module);
+ } else {
+ backend = ac->module;
+ }
+
ac->down_req = talloc_realloc(ac, ac->down_req,
struct ldb_request *, ac->num_requests + 1);
if (!ac->down_req) {
@@ -228,8 +234,12 @@ static int partition_send_request(struct partition_context *ac, struct ldb_modul
/* If the search is for 'more' than this partition,
* then change the basedn, so a remote LDAP server
* doesn't object */
- if (ldb_dn_compare_base(partition_base_dn, req->op.search.base) != 0) {
- req->op.search.base = partition_base_dn;
+ if (partition) {
+ if (ldb_dn_compare_base(partition->dn, req->op.search.base) != 0) {
+ req->op.search.base = partition->dn;
+ }
+ } else {
+ req->op.search.base = NULL;
}
req->callback = partition_search_callback;
req->context = ac;
@@ -238,12 +248,19 @@ static int partition_send_request(struct partition_context *ac, struct ldb_modul
req->context = ac;
}
+ if (partition) {
+ ret = ldb_request_add_control(req, DSDB_CONTROL_CURRENT_PARTITION_OID, false, partition);
+ if (ret != LDB_SUCCESS) {
+ return ret;
+ }
+ }
+
/* Spray off search requests to all backends */
- ret = ldb_next_request(next, req);
+ ret = ldb_next_request(backend, req);
if (ret != LDB_SUCCESS) {
return ret;
}
-
+
ac->num_requests++;
return LDB_SUCCESS;
}
@@ -255,12 +272,12 @@ static int partition_send_all(struct ldb_module *module,
int i;
struct partition_private_data *data = talloc_get_type(module->private_data,
struct partition_private_data);
- int ret = partition_send_request(ac, module->next, NULL);
+ int ret = partition_send_request(ac, NULL);
if (ret != LDB_SUCCESS) {
return ret;
}
for (i=0; data && data->partitions && data->partitions[i]; i++) {
- ret = partition_send_request(ac, data->partitions[i]->module, data->partitions[i]->dn);
+ ret = partition_send_request(ac, data->partitions[i]);
if (ret != LDB_SUCCESS) {
return ret;
}
@@ -349,7 +366,7 @@ static int partition_search(struct ldb_module *module, struct ldb_request *req)
for (i=0; data && data->partitions && data->partitions[i]; i++) {
/* Find all partitions under the search base */
if (ldb_dn_compare_base(req->op.search.base, data->partitions[i]->dn) == 0) {
- ret = partition_send_request(ac, data->partitions[i]->module, data->partitions[i]->dn);
+ ret = partition_send_request(ac, data->partitions[i]);
if (ret != LDB_SUCCESS) {
return ret;
}