From: Pierangelo Masarati Date: Thu, 16 Jun 2005 19:27:03 +0000 (+0000) Subject: fix ITS#3785: do our best to deal with invalid filters... X-Git-Tag: OPENLDAP_AC_BP~517 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c7c572f8836ee9a44a5b8824fef8206a7ada6777;p=openldap fix ITS#3785: do our best to deal with invalid filters... --- diff --git a/servers/slapd/back-ldap/search.c b/servers/slapd/back-ldap/search.c index 19bddf422c..84b0902f9a 100644 --- a/servers/slapd/back-ldap/search.c +++ b/servers/slapd/back-ldap/search.c @@ -64,6 +64,7 @@ ldap_back_munge_filter( static struct berval bv_true = BER_BVC( "(?=true)" ), bv_false = BER_BVC( "(?=false)" ), + bv_undefined = BER_BVC( "(?=undefined)" ), bv_t = BER_BVC( "(&)" ), bv_f = BER_BVC( "(|)" ), bv_T = BER_BVC( "(objectClass=*)" ), @@ -91,13 +92,18 @@ ldap_back_munge_filter( newbv = &bv_F; } + } else if ( strncmp( ptr, bv_undefined.bv_val, bv_undefined.bv_len ) == 0 ) + { + oldbv = &bv_undefined; + newbv = &bv_F; + } else { gotit = 0; goto done; } oldfilter = *filter; - if ( !( li->flags & LDAP_BACK_F_SUPPORT_T_F ) ) { + if ( newbv->bv_len > oldbv->bv_len ) { filter->bv_len += newbv->bv_len - oldbv->bv_len; if ( filter->bv_val == op->ors_filterstr.bv_val ) { filter->bv_val = op->o_tmpalloc( filter->bv_len + 1, diff --git a/servers/slapd/overlays/rwmmap.c b/servers/slapd/overlays/rwmmap.c index bfa40a1de1..c201744ae0 100644 --- a/servers/slapd/overlays/rwmmap.c +++ b/servers/slapd/overlays/rwmmap.c @@ -450,15 +450,9 @@ rwm_int_filter_map_rewrite( vtmp, tmp; static struct berval -#if 0 - ber_bvfalse = BER_BVC( "(?=false)" ), -#endif /* better than nothing... */ ber_bvfalse = BER_BVC( "(!(objectClass=*))" ), ber_bvtf_false = BER_BVC( "(|)" ), -#if 0 - ber_bvtrue = BER_BVC( "(?=true)" ), -#endif /* better than nothing... */ ber_bvtrue = BER_BVC( "(objectClass=*)" ), ber_bvtf_true = BER_BVC( "(&)" ), @@ -678,9 +672,12 @@ rwm_int_filter_map_rewrite( case LDAP_COMPARE_FALSE: if ( dc->rwmap->rwm_flags & RWM_F_SUPPORT_T_F ) { tmp = ber_bvtf_false; - } else { - tmp = ber_bvfalse; + break; } + /* fallthru */ + + case SLAPD_COMPARE_UNDEFINED: + tmp = ber_bvfalse; break; case LDAP_COMPARE_TRUE: @@ -691,10 +688,6 @@ rwm_int_filter_map_rewrite( } break; - case SLAPD_COMPARE_UNDEFINED: - tmp = ber_bvundefined; - break; - default: tmp = ber_bverror; break;