]> git.sur5r.net Git - openldap/commitdiff
Fix onelevel search from last commit
authorHoward Chu <hyc@openldap.org>
Wed, 14 Sep 2011 16:54:58 +0000 (09:54 -0700)
committerHoward Chu <hyc@openldap.org>
Wed, 14 Sep 2011 16:54:58 +0000 (09:54 -0700)
servers/slapd/back-mdb/dn2id.c
tests/scripts/test003-search

index 837e81fcc655585925355ad21b87442a3bdc20d0..2550b6959223dd55415203af902c94c0d4921de9 100644 (file)
@@ -727,7 +727,7 @@ mdb_idscopes(
        ID id;
        ID2 id2;
        char    *ptr;
-       int             rc;
+       int             rc = 0;
        unsigned int x;
        unsigned int nrlen, rlen;
        diskNode *d;
@@ -741,15 +741,7 @@ mdb_idscopes(
 
        id = isc->id;
        while (id) {
-               x = mdb_id2l_search( isc->scopes, id );
-               if ( x <= isc->scopes[0].mid && isc->scopes[x].mid == id ) {
-                       if ( !isc->scopes[x].mval.mv_data ) {
-                               isc->nscope = x;
-                               return MDB_SUCCESS;
-                       }
-                       data = isc->scopes[x].mval;
-                       rc = 1;
-               } else {
+               if ( !rc ) {
                        key.mv_data = &id;
                        rc = mdb_cursor_get( isc->mc, &key, &data, MDB_SET );
                        if ( rc )
@@ -766,7 +758,6 @@ mdb_idscopes(
                isc->rdns[isc->numrdns].bv_val = d->nrdn+nrlen+1;
                isc->numrdns++;
 
-
                if (!rc && id != isc->id) {
                        id2.mid = id;
                        id2.mval = data;
@@ -775,6 +766,15 @@ mdb_idscopes(
                ptr = data.mv_data;
                ptr += data.mv_size - sizeof(ID);
                memcpy( &id, ptr, sizeof(ID) );
+               x = mdb_id2l_search( isc->scopes, id );
+               if ( x <= isc->scopes[0].mid && isc->scopes[x].mid == id ) {
+                       if ( !isc->scopes[x].mval.mv_data ) {
+                               isc->nscope = x;
+                               return MDB_SUCCESS;
+                       }
+                       data = isc->scopes[x].mval;
+                       rc = 1;
+               }
                if ( op->ors_scope == LDAP_SCOPE_ONELEVEL )
                        break;
        }
index 86514daae9a1a0757ca02983e709a3726763acec..8480419943cc232c6505c6d96b0dbbc4f19d5995 100755 (executable)
@@ -65,9 +65,8 @@ if test $RC != 0 ; then
        exit $RC
 fi
 
-cat /dev/null > $SEARCHOUT
-
 echo "Testing exact searching..."
+echo "# Testing exact searching..." > $SEARCHOUT
 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
        '(sn=jENSEN)' >> $SEARCHOUT 2>&1
 RC=$?
@@ -78,6 +77,7 @@ if test $RC != 0 ; then
 fi
 
 echo "Testing approximate searching..."
+echo "# Testing approximate searching..." >> $SEARCHOUT
 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
        '(sn~=jENSEN)' name >> $SEARCHOUT 2>&1
 RC=$?
@@ -88,6 +88,7 @@ if test $RC != 0 ; then
 fi
 
 echo "Testing OR searching..."
+echo "# Testing OR searching..." >> $SEARCHOUT
 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
        '(|(givenname=Xx*yY*Z)(cn=)(undef=*)(objectclass=groupofnames)(sn=jones)(member=cn=Manager,dc=example,dc=com)(uniqueMember=cn=Manager,dc=example,dc=com))' >> $SEARCHOUT 2>&1
 RC=$?
@@ -98,6 +99,7 @@ if test $RC != 0 ; then
 fi
 
 echo "Testing AND matching and ends-with searching..."
+echo "# Testing AND matching and ends-with searching..." >> $SEARCHOUT
 $LDAPSEARCH -S "" -b "ou=groups,$BASEDN" -s one -h $LOCALHOST -p $PORT1 \
        '(&(objectclass=groupofnames)(cn=A*)(member=cn=Mark Elliot,ou=Alumni Association,ou=People,dc=example,dc=com))' >> $SEARCHOUT 2>&1
 RC=$?
@@ -108,6 +110,7 @@ if test $RC != 0 ; then
 fi
 
 echo "Testing NOT searching..."
+echo "# Testing NOT searching..." >> $SEARCHOUT
 $LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
        '(!(objectclass=pilotPerson))' >> $SEARCHOUT 2>&1
 RC=$?
@@ -118,6 +121,7 @@ if test $RC != 0 ; then
 fi
 
 echo "Testing objectClass/attributeType inheritance ..."
+echo "# Testing objectClass/attributeType inheritance ..." >> $SEARCHOUT
 $LDAPSEARCH -M -a never -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
        '(&(objectClass=inetorgperson)(userid=uham))' \
        "2.5.4.0" "userid" >> $SEARCHOUT 2>&1