diff options
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/partition.c | 54 |
1 files changed, 24 insertions, 30 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/partition.c b/source4/dsdb/samdb/ldb_modules/partition.c index 77d657cd39f..d44dc19320a 100644 --- a/source4/dsdb/samdb/ldb_modules/partition.c +++ b/source4/dsdb/samdb/ldb_modules/partition.c @@ -238,6 +238,7 @@ static int partition_prep_request(struct partition_context *ac, int ret; struct ldb_request *req; struct ldb_control *partition_ctrl = NULL; + void *part_data = NULL; ac->part_req = talloc_realloc(ac, ac->part_req, struct part_request, @@ -323,42 +324,35 @@ static int partition_prep_request(struct partition_context *ac, } } - if (partition) { - void *part_data = partition->ctrl; + part_data = partition->ctrl; - ac->part_req[ac->num_requests].module = partition->module; + ac->part_req[ac->num_requests].module = partition->module; - 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, part_data); - if (ret != LDB_SUCCESS) { - return ret; - } + if (partition_ctrl != NULL) { + if (partition_ctrl->data != NULL) { + part_data = partition_ctrl->data; } - if (req->operation == LDB_SEARCH) { - /* 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->ctrl->dn, - req->op.search.base) != 0) { - req->op.search.base = partition->ctrl->dn; - } + /* + * 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, part_data); + if (ret != LDB_SUCCESS) { + return ret; } + } - } else { - /* make sure you put the module here, or - * or ldb_next_request() will skip a module */ - ac->part_req[ac->num_requests].module = ac->module; + if (req->operation == LDB_SEARCH) { + /* 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->ctrl->dn, + req->op.search.base) != 0) { + req->op.search.base = partition->ctrl->dn; + } } ac->num_requests++; |