summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2020-02-24 16:43:44 +1300
committerAndrew Bartlett <abartlet@samba.org>2020-02-28 03:08:46 +0000
commitdc308d1c2937313813b628d7fb94463542a0dd81 (patch)
tree003b283edb158035acdbda405491e4b5d31c40fd
parent01a3cf8e1e2562a77635ecf2a9a79e28af43fe7c (diff)
downloadsamba-dc308d1c2937313813b628d7fb94463542a0dd81.tar.gz
dsdb: Remove dead code in partition_prep_request()
The partition variable is never NULL. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
-rw-r--r--source4/dsdb/samdb/ldb_modules/partition.c54
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++;