ITS#2453, Fix filter candidate generation

This commit is contained in:
Howard Chu 2003-04-18 03:36:52 +00:00
parent 7c60ff1ef8
commit 8d8a52f9d2
2 changed files with 36 additions and 16 deletions

View File

@ -58,6 +58,10 @@ bdb_filter_candidates(
#endif
switch ( f->f_choice ) {
case SLAPD_FILTER_COMPUTED:
rc = 0;
break;
case SLAPD_FILTER_DN_ONE:
#ifdef NEW_LOGGING
LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tDN ONE\n", 0, 0, 0 );
@ -212,12 +216,8 @@ list_candidates(
Debug( LDAP_DEBUG_FILTER, "=> bdb_list_candidates 0x%x\n", ftype, 0, 0 );
#endif
if ( ftype == LDAP_FILTER_OR ) {
BDB_IDL_ALL( bdb, save );
BDB_IDL_ZERO( ids );
} else {
BDB_IDL_CPY( save, ids );
}
/* Copy so we can propagate pre-computed IDLs */
BDB_IDL_CPY( save, ids );
for ( f = flist; f != NULL; f = f->f_next ) {
rc = bdb_filter_candidates( op, f, save, tmp,
@ -230,14 +230,22 @@ list_candidates(
}
break;
}
if ( ftype == LDAP_FILTER_AND ) {
bdb_idl_intersection( ids, save );
if ( f == flist ) {
BDB_IDL_CPY( ids, save );
} else {
bdb_idl_intersection( ids, save );
}
if( BDB_IDL_IS_ZERO( ids ) )
break;
} else {
bdb_idl_union( ids, save );
BDB_IDL_ALL( bdb, save );
if ( f == flist ) {
BDB_IDL_CPY( ids, save );
} else {
bdb_idl_union( ids, save );
}
}
}
@ -509,7 +517,11 @@ equality_candidates(
break;
}
bdb_idl_intersection( ids, tmp );
if ( i == 0 ) {
BDB_IDL_CPY( ids, tmp );
} else {
bdb_idl_intersection( ids, tmp );
}
if( BDB_IDL_IS_ZERO( ids ) )
break;
@ -674,7 +686,11 @@ approx_candidates(
break;
}
bdb_idl_intersection( ids, tmp );
if ( i == 0 ) {
BDB_IDL_CPY( ids, tmp );
} else {
bdb_idl_intersection( ids, tmp );
}
if( BDB_IDL_IS_ZERO( ids ) )
break;
@ -833,7 +849,11 @@ substring_candidates(
break;
}
bdb_idl_intersection( ids, tmp );
if ( i == 0 ) {
BDB_IDL_CPY( ids, tmp );
} else {
bdb_idl_intersection( ids, tmp );
}
if( BDB_IDL_IS_ZERO( ids ) )
break;

View File

@ -164,7 +164,7 @@ static int search_aliases(
af.f_next = NULL;
/* Find all aliases in database */
BDB_IDL_ALL( bdb, aliases );
BDB_IDL_ZERO( aliases );
rs->sr_err = bdb_filter_candidates( op, &af, aliases,
curscop, visited );
if (rs->sr_err != LDAP_SUCCESS) {
@ -670,7 +670,7 @@ dn2entry_retry:
rs->sr_err = base_candidate( op->o_bd, &base, candidates );
} else {
BDB_IDL_ALL( bdb, candidates );
BDB_IDL_ZERO( candidates );
BDB_IDL_ZERO( scopes );
rs->sr_err = search_candidates( op, sop, rs, &base, locker, candidates, scopes );
}
@ -1521,7 +1521,7 @@ static int search_candidates(
f.f_choice = LDAP_FILTER_AND;
f.f_and = &nf;
/* Dummy; we compute scope separately now */
nf.f_choice = LDAP_FILTER_NOT;
nf.f_choice = SLAPD_FILTER_COMPUTED;
nf.f_next = xf.f_or == op->oq_search.rs_filter
? op->oq_search.rs_filter : &xf ;
/* Filter depth increased again, adding dummy clause */
@ -1534,7 +1534,7 @@ static int search_candidates(
sf.f_ava = &aa_subentry;
sf.f_av_desc = slap_schema.si_ad_objectClass;
sf.f_av_value = bv_subentry;
sf.f_next = scopef.f_next;
sf.f_next = nf.f_next;
nf.f_next = &sf;
}
#endif