summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2011-03-05 14:25:59 +0100
committerMatthias Dieter Wallnöfer <mdw@samba.org>2011-03-10 11:12:05 +0100
commit68fbfa2237a570a48d2ae3a5421cdcacae6e6d34 (patch)
tree436b377b86fc267e5ff6bed69556a85d4fb2e33b /source4
parent78b46c533a36cdfa6c5f8ab305f13c5aa142b819 (diff)
downloadsamba-68fbfa2237a570a48d2ae3a5421cdcacae6e6d34.tar.gz
samba-68fbfa2237a570a48d2ae3a5421cdcacae6e6d34.tar.bz2
samba-68fbfa2237a570a48d2ae3a5421cdcacae6e6d34.zip
s4:partition LDB module - the current partition control should only be added if requested
That means if the informations before a request are unknown ("repl_meta_data" LDB module) then an empty control (no data) has to be sent.
Diffstat (limited to 'source4')
-rw-r--r--source4/dsdb/samdb/ldb_modules/partition.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/partition.c b/source4/dsdb/samdb/ldb_modules/partition.c
index f75085e8a2..ba77ca0ad1 100644
--- a/source4/dsdb/samdb/ldb_modules/partition.c
+++ b/source4/dsdb/samdb/ldb_modules/partition.c
@@ -239,6 +239,7 @@ static int partition_prep_request(struct partition_context *ac,
{
int ret;
struct ldb_request *req;
+ struct ldb_control *partition_ctrl = NULL;
ac->part_req = talloc_realloc(ac, ac->part_req,
struct part_request,
@@ -316,20 +317,31 @@ static int partition_prep_request(struct partition_context *ac,
ac->part_req[ac->num_requests].req = req;
if (ac->req->controls) {
- req->controls = talloc_memdup(req, ac->req->controls,
- talloc_get_size(ac->req->controls));
- if (req->controls == NULL) {
- return ldb_oom(ldb_module_get_ctx(ac->module));
+ /* Duplicate everything beside the current partition control */
+ partition_ctrl = ldb_request_get_control(ac->req,
+ DSDB_CONTROL_CURRENT_PARTITION_OID);
+ if (!ldb_save_controls(partition_ctrl, req, NULL)) {
+ return ldb_module_oom(ac->module);
}
}
if (partition) {
+ void *part_data = partition->ctrl;
+
ac->part_req[ac->num_requests].module = partition->module;
- if (!ldb_request_get_control(req, DSDB_CONTROL_CURRENT_PARTITION_OID)) {
+ if (partition_ctrl != NULL) {
+ if (partition_ctrl->data != NULL) {
+ part_data = partition_ctrl->data;
+ }
+
+ /*
+ * If the provided current partition control is without
+ * data then use the calculated one.
+ */
ret = ldb_request_add_control(req,
DSDB_CONTROL_CURRENT_PARTITION_OID,
- false, partition->ctrl);
+ false, part_data);
if (ret != LDB_SUCCESS) {
return ret;
}