fix ITS#3785: do our best to deal with invalid filters...

This commit is contained in:
Pierangelo Masarati 2005-06-16 19:19:11 +00:00
parent b703938d61
commit 7fdcd2ec60

View File

@ -483,43 +483,40 @@ ldap_back_int_filter_map_rewrite(
ber_memfree( vtmp.bv_val );
break;
case SLAPD_FILTER_COMPUTED:
case SLAPD_FILTER_COMPUTED: {
struct berval bv;
switch ( f->f_result ) {
case LDAP_COMPARE_FALSE:
if ( dc->target->mt_flags & LDAP_BACK_F_SUPPORT_T_F ) {
ber_str2bv( "(|)", STRLENOF( "(|)" ), 1, fstr );
} else {
#if 0
ber_str2bv( "(?=false)", STRLENOF( "(?=false)" ), 1, fstr );
#endif
/* better than nothing... */
ber_str2bv( "(!(objectClass=*))", STRLENOF( "(!(objectClass=*))" ), 1, fstr );
BER_BVSTR( &bv, "(|)" );
break;
}
/* fallthru */
/* FIXME: treat UNDEFINED as FALSE */
case SLAPD_COMPARE_UNDEFINED:
/* better than nothing... */
BER_BVSTR( &bv, "(!(objectClass=*))" );
break;
case LDAP_COMPARE_TRUE:
if ( dc->target->mt_flags & LDAP_BACK_F_SUPPORT_T_F ) {
ber_str2bv( "(&)", STRLENOF( "(&)" ), 1, fstr );
} else {
#if 0
ber_str2bv( "(?=true)", STRLENOF( "(?=true)" ), 1, fstr );
#endif
/* better than nothing... */
ber_str2bv( "(objectClass=*)", STRLENOF( "(objectClass=*)" ), 1, fstr );
BER_BVSTR( &bv, "(&)" );
break;
}
break;
case SLAPD_COMPARE_UNDEFINED:
ber_str2bv( "(?=undefined)", STRLENOF( "(?=undefined)" ), 1, fstr );
/* better than nothing... */
BER_BVSTR( &bv, "(objectClass=*)" );
break;
default:
ber_str2bv( "(?=error)", STRLENOF( "(?=error)" ), 1, fstr );
BER_BVSTR( &bv, "(?=error)" );
break;
}
break;
ber_dupbv( fstr, &bv );
} break;
default:
ber_str2bv( "(?=unknown)", STRLENOF( "(?=unknown)" ), 1, fstr );