mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
fix ITS#3785: do our best to deal with invalid filters...
This commit is contained in:
parent
7fdcd2ec60
commit
c7c572f883
@ -64,6 +64,7 @@ ldap_back_munge_filter(
|
|||||||
static struct berval
|
static struct berval
|
||||||
bv_true = BER_BVC( "(?=true)" ),
|
bv_true = BER_BVC( "(?=true)" ),
|
||||||
bv_false = BER_BVC( "(?=false)" ),
|
bv_false = BER_BVC( "(?=false)" ),
|
||||||
|
bv_undefined = BER_BVC( "(?=undefined)" ),
|
||||||
bv_t = BER_BVC( "(&)" ),
|
bv_t = BER_BVC( "(&)" ),
|
||||||
bv_f = BER_BVC( "(|)" ),
|
bv_f = BER_BVC( "(|)" ),
|
||||||
bv_T = BER_BVC( "(objectClass=*)" ),
|
bv_T = BER_BVC( "(objectClass=*)" ),
|
||||||
@ -91,13 +92,18 @@ ldap_back_munge_filter(
|
|||||||
newbv = &bv_F;
|
newbv = &bv_F;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if ( strncmp( ptr, bv_undefined.bv_val, bv_undefined.bv_len ) == 0 )
|
||||||
|
{
|
||||||
|
oldbv = &bv_undefined;
|
||||||
|
newbv = &bv_F;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
gotit = 0;
|
gotit = 0;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
oldfilter = *filter;
|
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;
|
filter->bv_len += newbv->bv_len - oldbv->bv_len;
|
||||||
if ( filter->bv_val == op->ors_filterstr.bv_val ) {
|
if ( filter->bv_val == op->ors_filterstr.bv_val ) {
|
||||||
filter->bv_val = op->o_tmpalloc( filter->bv_len + 1,
|
filter->bv_val = op->o_tmpalloc( filter->bv_len + 1,
|
||||||
|
@ -450,15 +450,9 @@ rwm_int_filter_map_rewrite(
|
|||||||
vtmp,
|
vtmp,
|
||||||
tmp;
|
tmp;
|
||||||
static struct berval
|
static struct berval
|
||||||
#if 0
|
|
||||||
ber_bvfalse = BER_BVC( "(?=false)" ),
|
|
||||||
#endif
|
|
||||||
/* better than nothing... */
|
/* better than nothing... */
|
||||||
ber_bvfalse = BER_BVC( "(!(objectClass=*))" ),
|
ber_bvfalse = BER_BVC( "(!(objectClass=*))" ),
|
||||||
ber_bvtf_false = BER_BVC( "(|)" ),
|
ber_bvtf_false = BER_BVC( "(|)" ),
|
||||||
#if 0
|
|
||||||
ber_bvtrue = BER_BVC( "(?=true)" ),
|
|
||||||
#endif
|
|
||||||
/* better than nothing... */
|
/* better than nothing... */
|
||||||
ber_bvtrue = BER_BVC( "(objectClass=*)" ),
|
ber_bvtrue = BER_BVC( "(objectClass=*)" ),
|
||||||
ber_bvtf_true = BER_BVC( "(&)" ),
|
ber_bvtf_true = BER_BVC( "(&)" ),
|
||||||
@ -678,9 +672,12 @@ rwm_int_filter_map_rewrite(
|
|||||||
case LDAP_COMPARE_FALSE:
|
case LDAP_COMPARE_FALSE:
|
||||||
if ( dc->rwmap->rwm_flags & RWM_F_SUPPORT_T_F ) {
|
if ( dc->rwmap->rwm_flags & RWM_F_SUPPORT_T_F ) {
|
||||||
tmp = ber_bvtf_false;
|
tmp = ber_bvtf_false;
|
||||||
} else {
|
break;
|
||||||
tmp = ber_bvfalse;
|
|
||||||
}
|
}
|
||||||
|
/* fallthru */
|
||||||
|
|
||||||
|
case SLAPD_COMPARE_UNDEFINED:
|
||||||
|
tmp = ber_bvfalse;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LDAP_COMPARE_TRUE:
|
case LDAP_COMPARE_TRUE:
|
||||||
@ -691,10 +688,6 @@ rwm_int_filter_map_rewrite(
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SLAPD_COMPARE_UNDEFINED:
|
|
||||||
tmp = ber_bvundefined;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
tmp = ber_bverror;
|
tmp = ber_bverror;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user