Don't send the dereference OID unless client asked for extended DNs
authorAndrew Bartlett <abartlet@samba.org>
Thu, 11 Dec 2008 01:46:39 +0000 (12:46 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 11 Dec 2008 01:46:39 +0000 (12:46 +1100)
source4/dsdb/samdb/ldb_modules/extended_dn_out.c

index deca968..9c178f2 100644 (file)
@@ -376,6 +376,10 @@ static int extended_dn_out_search(struct ldb_module *module, struct ldb_request
        
        const_attrs = req->op.search.attrs;
 
+       /* We only need to do special processing if we were asked for
+        * the extended DN, or we are 'store DN+GUID+SID'
+        * (!dereference) mode.  (This is the normal mode for LDB on
+        * tdb). */
        if (control || (storage_format_control && private && !private->dereference)) {
                ac->inject = true;
                if (extended_ctrl) {
@@ -445,9 +449,10 @@ static int extended_dn_out_search(struct ldb_module *module, struct ldb_request
                }
        }
 
-       if (private && private->dereference && private->dereference_control) {
-
-               /* Add in dereference control */
+       /* Add in dereference control, if we were asked to, we are
+        * using the 'dereference' mode (such as with an OpenLDAP
+        * backend) and have the control prepared */
+       if (control && private && private->dereference && private->dereference_control) {
                ret = ldb_request_add_control(down_req,
                                              DSDB_OPENLDAP_DEREFERENCE_CONTROL,
                                              false, private->dereference_control);