dsdb: Provide shortcuut for repl_meta_data avoiding search of link targets
authorAndrew Bartlett <abartlet@samba.org>
Tue, 14 Jun 2016 21:59:57 +0000 (09:59 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Sun, 26 Jun 2016 22:18:17 +0000 (00:18 +0200)
This makes processing of large numbers of linked attributes much faster, as we never care about the
names during that processing

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
source4/dsdb/samdb/ldb_modules/extended_dn_out.c

index bdb35be46904f66ff04115a7a276f81166eb8def..31835a73d296954b577b78411880c4495facafca 100644 (file)
@@ -472,6 +472,20 @@ static int extended_callback(struct ldb_request *req, struct ldb_reply *ares,
                }
        }
 
+       if (!checked_reveal_control) {
+               have_reveal_control =
+                       ldb_request_get_control(req, LDB_CONTROL_REVEAL_INTERNALS) != NULL;
+               checked_reveal_control = true;
+       }
+
+       /* 
+        * Shortcut for repl_meta_data.  We asked for the data
+        * 'as-is', so stop processing here!
+        */
+       if (have_reveal_control && p->normalise == false && ac->inject == true) {
+               return ldb_module_send_entry(ac->req, msg, ares->controls);
+       }
+       
        /* Walk the returned elements (but only if we have a schema to
         * interpret the list with) */
        for (i = 0; ac->schema && i < msg->num_elements; i++) {
@@ -518,12 +532,6 @@ static int extended_callback(struct ldb_request *req, struct ldb_reply *ares,
                        struct ldb_val *plain_dn = &msg->elements[i].values[j];         
                        bool is_deleted_objects = false;
 
-                       if (!checked_reveal_control) {
-                               have_reveal_control =
-                                       ldb_request_get_control(req, LDB_CONTROL_REVEAL_INTERNALS) != NULL;
-                               checked_reveal_control = true;
-                       }
-
                        /* this is a fast method for detecting deleted
                           linked attributes, working on the unparsed
                           ldb_val */