dsdb: Do not use ldb_save_controls() in partitions module for domain_scope
authorAndrew Bartlett <abartlet@samba.org>
Mon, 24 Feb 2020 03:22:24 +0000 (16:22 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 28 Feb 2020 03:08:46 +0000 (03:08 +0000)
The LDAP backend is long-removed so we do not need this workaround
for a confused server any longer.

This avoids references to old (but valid) memory after a new ldb_control array is
allocated in ldb_save_controls() and keeps the controls pointer as
constant as possible given the multiple ldb_request structures it
will appear in.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
source4/dsdb/samdb/ldb_modules/partition.c

index 6b0fbe728bce594ed4ce88c34045350ba5cd04a3..77d657cd39fb49d5a511ccc90e6955db7caa941b 100644 (file)
@@ -752,7 +752,6 @@ static int partition_replicate(struct ldb_module *module, struct ldb_request *re
 /* search */
 static int partition_search(struct ldb_module *module, struct ldb_request *req)
 {
-       struct ldb_control **saved_controls;
        /* Find backend */
        struct partition_private_data *data = talloc_get_type(ldb_module_get_private(module),
                                                              struct partition_private_data);
@@ -787,12 +786,6 @@ static int partition_search(struct ldb_module *module, struct ldb_request *req)
 
        }
 
-       /* Remove the "domain_scope" control, so we don't confuse a backend
-        * server */
-       if (domain_scope_control && !ldb_save_controls(domain_scope_control, req, &saved_controls)) {
-               return ldb_oom(ldb_module_get_ctx(module));
-       }
-
        /* if we aren't initialised yet go further */
        if (!data || !data->partitions) {
                return ldb_next_request(module, req);