Skip to content
Snippets Groups Projects
Commit 7fdcd2ec authored by Pierangelo Masarati's avatar Pierangelo Masarati
Browse files

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

parent b703938d
No related branches found
No related tags found
No related merge requests found
......@@ -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 );
......
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