]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-bdb/search.c
Merge remote-tracking branch 'origin/mdb.master'
[openldap] / servers / slapd / back-bdb / search.c
index 1d7e52fb4e7c1ede5488dfc0e45bab873dd74936..d30d7b9f2e7b5ba1095bb67ddf756fb838ae8788 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2000-2011 The OpenLDAP Foundation.
+ * Copyright 2000-2012 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -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 == LDAP_SUCCESS )
+                       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 );
        }