Skip to content
Snippets Groups Projects
Commit 071b9466 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Fix approx matching when there is an equality index but no approx index.

Add better approx test
parent 6daaf882
No related branches found
No related tags found
No related merge requests found
......@@ -156,12 +156,9 @@ bdb_attr_index_config(
}
if( IS_SLAP_INDEX( mask, SLAP_INDEX_APPROX ) && !(
( ad->ad_type->sat_approx
ad->ad_type->sat_approx
&& ad->ad_type->sat_approx->smr_indexer
&& ad->ad_type->sat_approx->smr_filter )
&& ( ad->ad_type->sat_equality
&& ad->ad_type->sat_equality->smr_indexer
&& ad->ad_type->sat_equality->smr_filter ) ) )
&& ad->ad_type->sat_approx->smr_filter ) )
{
fprintf( stderr, "%s: line %d: "
"approx index of attribute \"%s\" disallowed\n",
......
......@@ -121,9 +121,14 @@ int bdb_index_param(
break;
case LDAP_FILTER_APPROX:
if( IS_SLAP_INDEX( mask, SLAP_INDEX_APPROX ) ) {
goto done;
if ( desc->ad_type->sat_approx ) {
if( IS_SLAP_INDEX( mask, SLAP_INDEX_APPROX ) ) {
goto done;
}
break;
}
/* Use EQUALITY rule and index for approximate match */
/* fall thru */
case LDAP_FILTER_EQUALITY:
......
......@@ -156,12 +156,9 @@ attr_index_config(
}
if( IS_SLAP_INDEX( mask, SLAP_INDEX_APPROX ) && !(
( ad->ad_type->sat_approx
ad->ad_type->sat_approx
&& ad->ad_type->sat_approx->smr_indexer
&& ad->ad_type->sat_approx->smr_filter )
&& ( ad->ad_type->sat_equality
&& ad->ad_type->sat_equality->smr_indexer
&& ad->ad_type->sat_equality->smr_filter ) ) )
&& ad->ad_type->sat_approx->smr_filter ) )
{
fprintf( stderr, "%s: line %d: "
"approx index of attribute \"%s\" disallowed\n",
......
......@@ -115,9 +115,14 @@ int index_param(
break;
case LDAP_FILTER_APPROX:
if( IS_SLAP_INDEX( mask, SLAP_INDEX_APPROX ) ) {
goto done;
if ( desc->ad_type->sat_approx ) {
if( IS_SLAP_INDEX( mask, SLAP_INDEX_APPROX ) ) {
goto done;
}
break;
}
/* Use EQUALITY rule and index for approximate match */
/* fall thru */
case LDAP_FILTER_EQUALITY:
......
......@@ -437,8 +437,7 @@ test_ava_filter(
continue;
}
for ( bv = a->a_nvals; bv->bv_val != NULL; bv++ )
{
for ( bv = a->a_nvals; bv->bv_val != NULL; bv++ ) {
int ret;
int rc;
const char *text;
......
......@@ -206,8 +206,8 @@ test_ava_vrFilter(
case LDAP_FILTER_APPROX:
mr = a->a_desc->ad_type->sat_approx;
if( mr != NULL ) break;
/* use EQUALITY matching rule if no APPROX rule */
/* use EQUALITY matching rule if no APPROX rule */
case LDAP_FILTER_EQUALITY:
mr = a->a_desc->ad_type->sat_equality;
break;
......@@ -221,10 +221,7 @@ test_ava_vrFilter(
mr = NULL;
}
if( mr == NULL ) {
continue;
}
if( mr == NULL ) continue;
bv = a->a_nvals;
for ( j=0; bv->bv_val != NULL; bv++, j++ ) {
......
......@@ -39,6 +39,20 @@ pager: +1 313 555 4474
facsimiletelephonenumber: +1 313 555 2177
telephonenumber: +1 313 555 0355
dn: cn=Barbara Jensen,ou=Information Technology Division,ou=People,o=Universit
y of Michigan,c=US
cn: Barbara Jensen
cn: Babs Jensen
sn:: IEplbnNlbiA=
title: Mythical Manager, Research Systems
dn: cn=Bjorn Jensen,ou=Information Technology Division,ou=People,o=University
of Michigan,c=US
cn: Bjorn Jensen
cn: Biiff Jensen
sn: Jensen
title: Director, Embedded Systems
dn: cn=All Staff,ou=Groups,o=University of Michigan,c=US
member: cn=Manager,o=University of Michigan,c=US
member: cn=Barbara Jensen,ou=Information Technology Division,ou=People,o=Unive
......
......@@ -75,6 +75,16 @@ if test $RC != 0 ; then
exit $RC
fi
echo "Testing approximate searching..."
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
'(sn~=jENSEN)' name >> $SEARCHOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Testing OR searching..."
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
'(|(givenname=Xx*yY*Z)(cn=)(undef=*)(objectclass=groupofnames)(sn~=jones)(member=cn=Manager,o=University of Michigan,c=US)(uniqueMember=cn=Manager,o=University of Michigan,c=US))' >> $SEARCHOUT 2>&1
......
......@@ -92,6 +92,16 @@ if test $RC != 0 ; then
exit $RC
fi
echo "Testing approximate searching..."
$LDAPSEARCH -C -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
'(sn=jENSEN)' name >> $SEARCHOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Testing OR searching..."
$LDAPSEARCH -C -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
'(|(objectclass=groupofnames)(objectClass=groupofuniquenames)(sn=jones))' >> $SEARCHOUT 2>&1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment