]> git.sur5r.net Git - openldap/commitdiff
ITS#7303 fix unneeded alias lookups
authorHoward Chu <hyc@openldap.org>
Tue, 12 Jun 2012 23:16:07 +0000 (16:16 -0700)
committerHoward Chu <hyc@openldap.org>
Tue, 12 Jun 2012 23:16:07 +0000 (16:16 -0700)
servers/slapd/back-bdb/search.c
servers/slapd/back-mdb/search.c

index 89b347f595a94ca0a9709fca7b1d021831d7c7bf..a822564c558b4ecda796223fab55497e2e4537a7 100644 (file)
@@ -184,7 +184,7 @@ static int search_aliases(
        BDB_IDL_ZERO( aliases );
        rs->sr_err = bdb_filter_candidates( op, txn, &af, aliases,
                curscop, visited );
-       if (rs->sr_err != LDAP_SUCCESS) {
+       if (rs->sr_err != LDAP_SUCCESS || BDB_IDL_IS_ZERO( aliases )) {
                return rs->sr_err;
        }
        oldsubs[0] = 1;
@@ -1253,6 +1253,8 @@ static int search_candidates(
 
        if( op->ors_deref & LDAP_DEREF_SEARCHING ) {
                rc = search_aliases( op, rs, e, txn, ids, scopes, stack );
+               if ( BDB_IDL_IS_ZERO( ids ))
+                       rc = bdb_dn2idl( op, txn, &e->e_nname, BEI(e), ids, stack );
        } else {
                rc = bdb_dn2idl( op, txn, &e->e_nname, BEI(e), ids, stack );
        }
index ca3e3c6eae3b1b9b8ba4af23909f2c59dc99e533..fda36ebf11d898a312741c75b3a04365987484a0 100644 (file)
@@ -160,7 +160,7 @@ static int search_aliases(
        MDB_IDL_ZERO( aliases );
        rs->sr_err = mdb_filter_candidates( op, txn, &af, aliases,
                curscop, visited );
-       if (rs->sr_err != LDAP_SUCCESS) {
+       if (rs->sr_err != LDAP_SUCCESS || MDB_IDL_IS_ZERO( aliases )) {
                return rs->sr_err;
        }
        oldsubs[0] = 1;