#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 );
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,
}
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 );
+ }
}
}
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;
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;
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;
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) {
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 );
}
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 */
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