summaryrefslogtreecommitdiff
path: root/source4/dsdb/samdb/ldb_modules/partition.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2007-02-22 01:54:40 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:48:44 -0500
commit7dc7156bd76425df129102a42dd29a85fd8c7ebc (patch)
tree2da9bd209f1cd6f102a48b26094f838860e7e181 /source4/dsdb/samdb/ldb_modules/partition.c
parent81adf162a80b6b0c6c24d40f783ddcd1c9813532 (diff)
downloadsamba-7dc7156bd76425df129102a42dd29a85fd8c7ebc.tar.gz
samba-7dc7156bd76425df129102a42dd29a85fd8c7ebc.tar.bz2
samba-7dc7156bd76425df129102a42dd29a85fd8c7ebc.zip
r21496: A number of ldb control and LDAP changes, surrounding the
'phantom_root' flag in the search_options control - Add in support for LDB controls to the js layer - Test the behaviour - Implement support for the 'phantom_root' flag in the partitions module - Make the LDAP server set the 'phantom_root' flag in the search_options control - This replaces the global_catalog flag passed down as an opaque pointer - Rework the string-format control parsing function into ldb_parse_control_strings(), returning errors by ldb_errorstring() method, rather than with printf to stderr - Rework some of the ldb_control handling logic Andrew Bartlett (This used to be commit 2b3df7f38d7790358dbb4de1b8609bf794a351fb)
Diffstat (limited to 'source4/dsdb/samdb/ldb_modules/partition.c')
-rw-r--r--source4/dsdb/samdb/ldb_modules/partition.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/partition.c b/source4/dsdb/samdb/ldb_modules/partition.c
index b23ceebf1b..bd037066ca 100644
--- a/source4/dsdb/samdb/ldb_modules/partition.c
+++ b/source4/dsdb/samdb/ldb_modules/partition.c
@@ -1,3 +1,4 @@
+
/*
Partitions ldb module
@@ -219,16 +220,26 @@ static int partition_send_request(struct partition_context *ac, struct dsdb_cont
ac->down_req = talloc_realloc(ac, ac->down_req,
struct ldb_request *, ac->num_requests + 1);
if (!ac->down_req) {
- ldb_set_errstring(ac->module->ldb, "Out of Memory");
+ ldb_oom(ac->module->ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
req = ac->down_req[ac->num_requests] = talloc(ac, struct ldb_request);
if (req == NULL) {
- ldb_set_errstring(ac->module->ldb, "Out of Memory");
+ ldb_oom(ac->module->ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
- *ac->down_req[ac->num_requests] = *ac->orig_req; /* copy the request */
+ *req = *ac->orig_req; /* copy the request */
+
+ if (ac->orig_req->controls) {
+ req->controls
+ = talloc_memdup(req,
+ ac->orig_req->controls, talloc_get_size(ac->orig_req->controls));
+ if (req->controls == NULL) {
+ ldb_oom(ac->module->ldb);
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+ }
if (req->operation == LDB_SEARCH) {
/* If the search is for 'more' than this partition,
@@ -350,7 +361,14 @@ static int partition_search(struct ldb_module *module, struct ldb_request *req)
/* (later) consider if we should be searching multiple
* partitions (for 'invisible' partition behaviour */
- if (ldb_get_opaque(module->ldb, "global_catalog")) {
+ struct ldb_control *search_control = ldb_request_get_control(req, LDB_CONTROL_SEARCH_OPTIONS_OID);
+
+ struct ldb_search_options_control *search_options = NULL;
+ if (search_control) {
+ search_options = talloc_get_type(search_control->data, struct ldb_search_options_control);
+ }
+
+ if (search_options && (search_options->search_options & LDB_SEARCH_OPTION_PHANTOM_ROOT)) {
int ret, i;
struct partition_context *ac;