Fix onelevel search from last commit

This commit is contained in:
Howard Chu 2011-09-14 09:54:58 -07:00
parent dfed6f77d7
commit 0e96868e8e
2 changed files with 17 additions and 13 deletions

View 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;
}

View file

@ -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