From: Pierangelo Masarati Date: Thu, 16 Jun 2005 19:19:11 +0000 (+0000) Subject: fix ITS#3785: do our best to deal with invalid filters... X-Git-Tag: OPENLDAP_AC_BP~518 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7fdcd2ec608741f5068df3487b23979251a39419;p=openldap fix ITS#3785: do our best to deal with invalid filters... --- diff --git a/servers/slapd/back-meta/map.c b/servers/slapd/back-meta/map.c index 62533e339f..87ca4b9031 100644 --- a/servers/slapd/back-meta/map.c +++ b/servers/slapd/back-meta/map.c @@ -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 );