]> git.sur5r.net Git - openldap/commitdiff
Revert "ITS#7702 fix results with aliases"
authorHoward Chu <hyc@openldap.org>
Thu, 28 Aug 2014 16:51:46 +0000 (17:51 +0100)
committerHoward Chu <hyc@openldap.org>
Thu, 28 Aug 2014 16:51:46 +0000 (17:51 +0100)
This reverts commit cac00c6a97bbbbcec75f2ebcffaae1dd1769a28e.

servers/slapd/back-mdb/dn2id.c
servers/slapd/back-mdb/proto-mdb.h
servers/slapd/back-mdb/search.c
servers/slapd/back-mdb/tools.c

index e658b625f3dac986700b6ca54482859fd10c57c2..f54ab998e9ff6278b3aa3a93b2ca63ccbfe298bd 100644 (file)
@@ -556,8 +556,7 @@ mdb_id2name(
        MDB_cursor **cursp,
        ID id,
        struct berval *name,
-       struct berval *nname,
-       ID *iscopes )
+       struct berval *nname )
 {
        struct mdb_info *mdb = (struct mdb_info *) op->o_bd->be_private;
        MDB_dbi dbi = mdb->mi_dn2id;
@@ -590,11 +589,6 @@ mdb_id2name(
                ptr = data.mv_data;
                ptr += data.mv_size - sizeof(ID);
                memcpy( &id, ptr, sizeof(ID) );
-               if ( iscopes ) {
-                       rc = mdb_idl_search( iscopes, id );
-                       if ( iscopes[rc] == id )
-                               return MDB_KEYEXIST;
-               }
                d = data.mv_data;
                nrlen = (d->nrdnlen[0] << 8) | d->nrdnlen[1];
                rlen = data.mv_size - sizeof(diskNode) - nrlen;
index 99e2828deadf5f4fe4e979d01cf5cb3d02845985..3671425dbf0a1129ebe389b0d98f0497c9bd1f26 100644 (file)
@@ -123,8 +123,7 @@ int mdb_id2name(
        MDB_cursor **cursp,
        ID eid,
        struct berval *name,
-       struct berval *nname,
-       ID *iscopes );
+       struct berval *nname);
 
 int mdb_idscope(
        Operation *op,
index f5cc8815340dcce817ff705d059c3b5634286089..cbb66f74636c9a6f40d7556605b3ad6d04ea3d05 100644 (file)
@@ -733,9 +733,12 @@ dn2entry_retry:
                if (scopes[0].mid > 1) {
                        cursor = 1;
                        for (cscope = 1; cscope <= scopes[0].mid; cscope++) {
+                               /* Ignore the original base */
+                               if (scopes[cscope].mid == base->e_id)
+                                       continue;
                                iscopes[cursor++] = scopes[cscope].mid;
                        }
-                       iscopes[0] = scopes[0].mid;
+                       iscopes[0] = scopes[0].mid - 1;
                } else {
                        iscopes[0] = 0;
                }
@@ -748,7 +751,7 @@ dn2entry_retry:
                        id = NOID;
                else
                        id = isc.id;
-               cscope = 1;     /* skip original base */
+               cscope = 0;
        } else {
                id = mdb_idl_first( candidates, &cursor );
        }
@@ -949,7 +952,7 @@ notfound:
                                pdn = base->e_name;
                                pndn = base->e_nname;
                        } else {
-                               mdb_id2name( op, ltid, &isc.mc, scopes[isc.nscope].mid, &pdn, &pndn, NULL );
+                               mdb_id2name( op, ltid, &isc.mc, scopes[isc.nscope].mid, &pdn, &pndn );
                        }
                        e->e_name.bv_len = pdn.bv_len;
                        e->e_nname.bv_len = pndn.bv_len;
@@ -1126,13 +1129,7 @@ loop_continue:
                                                mdb_entry_return( op, base );
                                        rs->sr_err = mdb_id2entry(op, mci, isc.id, &base);
                                        if ( !rs->sr_err ) {
-                                               rc = mdb_id2name( op, ltid, &isc.mc, isc.id, &base->e_name, &base->e_nname,
-                                                       op->ors_scope == LDAP_SCOPE_SUBTREE ? iscopes : NULL );
-                                               if ( rc == MDB_KEYEXIST ) {
-                                                       mdb_entry_return( op, base );
-                                                       base = NULL;
-                                                       continue;
-                                               }
+                                               mdb_id2name( op, ltid, &isc.mc, isc.id, &base->e_name, &base->e_nname );
                                                isc.numrdns = 0;
                                                if (isc.oscope == LDAP_SCOPE_ONELEVEL)
                                                        isc.oscope = LDAP_SCOPE_BASE;
index 7ccf82448258b45dc4a3556a1d8751ba14bb140b..a84de6f4c8f4d43ee75c2d49349f984c049cfcf4 100644 (file)
@@ -380,7 +380,7 @@ mdb_tool_entry_get_int( BackendDB *be, ID id, Entry **ep )
        op.o_tmpmemctx = NULL;
        op.o_tmpmfuncs = &ch_mfuncs;
        if ( slapMode & SLAP_TOOL_READONLY ) {
-               rc = mdb_id2name( &op, mdb_tool_txn, &idcursor, id, &dn, &ndn, NULL );
+               rc = mdb_id2name( &op, mdb_tool_txn, &idcursor, id, &dn, &ndn );
                if ( rc  ) {
                        rc = LDAP_OTHER;
                        if ( e ) {