better fix to ITS#4086: treat mapping failures as undefined filter

This commit is contained in:
Pierangelo Masarati 2005-10-14 00:03:18 +00:00
parent ca81b49f82
commit f161b7f875

View File

@ -442,6 +442,7 @@ map_attr_value(
static int static int
rwm_int_filter_map_rewrite( rwm_int_filter_map_rewrite(
Operation *op,
dncookie *dc, dncookie *dc,
Filter *f, Filter *f,
struct berval *fstr ) struct berval *fstr )
@ -477,7 +478,7 @@ rwm_int_filter_map_rewrite(
if ( map_attr_value( dc, &f->f_av_desc, &atmp, if ( map_attr_value( dc, &f->f_av_desc, &atmp,
&f->f_av_value, &vtmp, RWM_MAP ) ) &f->f_av_value, &vtmp, RWM_MAP ) )
{ {
return -1; goto computed;
} }
fstr->bv_len = atmp.bv_len + vtmp.bv_len + STRLENOF( "(=)" ); fstr->bv_len = atmp.bv_len + vtmp.bv_len + STRLENOF( "(=)" );
@ -493,7 +494,7 @@ rwm_int_filter_map_rewrite(
if ( map_attr_value( dc, &f->f_av_desc, &atmp, if ( map_attr_value( dc, &f->f_av_desc, &atmp,
&f->f_av_value, &vtmp, RWM_MAP ) ) &f->f_av_value, &vtmp, RWM_MAP ) )
{ {
return -1; goto computed;
} }
fstr->bv_len = atmp.bv_len + vtmp.bv_len + STRLENOF( "(>=)" ); fstr->bv_len = atmp.bv_len + vtmp.bv_len + STRLENOF( "(>=)" );
@ -509,7 +510,7 @@ rwm_int_filter_map_rewrite(
if ( map_attr_value( dc, &f->f_av_desc, &atmp, if ( map_attr_value( dc, &f->f_av_desc, &atmp,
&f->f_av_value, &vtmp, RWM_MAP ) ) &f->f_av_value, &vtmp, RWM_MAP ) )
{ {
return -1; goto computed;
} }
fstr->bv_len = atmp.bv_len + vtmp.bv_len + STRLENOF( "(<=)" ); fstr->bv_len = atmp.bv_len + vtmp.bv_len + STRLENOF( "(<=)" );
@ -525,7 +526,7 @@ rwm_int_filter_map_rewrite(
if ( map_attr_value( dc, &f->f_av_desc, &atmp, if ( map_attr_value( dc, &f->f_av_desc, &atmp,
&f->f_av_value, &vtmp, RWM_MAP ) ) &f->f_av_value, &vtmp, RWM_MAP ) )
{ {
return -1; goto computed;
} }
fstr->bv_len = atmp.bv_len + vtmp.bv_len + STRLENOF( "(~=)" ); fstr->bv_len = atmp.bv_len + vtmp.bv_len + STRLENOF( "(~=)" );
@ -541,7 +542,7 @@ rwm_int_filter_map_rewrite(
if ( map_attr_value( dc, &f->f_sub_desc, &atmp, if ( map_attr_value( dc, &f->f_sub_desc, &atmp,
NULL, NULL, RWM_MAP ) ) NULL, NULL, RWM_MAP ) )
{ {
return -1; goto computed;
} }
/* cannot be a DN ... */ /* cannot be a DN ... */
@ -603,7 +604,7 @@ rwm_int_filter_map_rewrite(
if ( map_attr_value( dc, &f->f_desc, &atmp, if ( map_attr_value( dc, &f->f_desc, &atmp,
NULL, NULL, RWM_MAP ) ) NULL, NULL, RWM_MAP ) )
{ {
return -1; goto computed;
} }
fstr->bv_len = atmp.bv_len + STRLENOF( "(=*)" ); fstr->bv_len = atmp.bv_len + STRLENOF( "(=*)" );
@ -626,7 +627,7 @@ rwm_int_filter_map_rewrite(
for ( p = f->f_list; p != NULL; p = p->f_next ) { for ( p = f->f_list; p != NULL; p = p->f_next ) {
len = fstr->bv_len; len = fstr->bv_len;
if ( rwm_int_filter_map_rewrite( dc, p, &vtmp ) ) if ( rwm_int_filter_map_rewrite( op, dc, p, &vtmp ) )
{ {
return -1; return -1;
} }
@ -647,7 +648,7 @@ rwm_int_filter_map_rewrite(
if ( map_attr_value( dc, &f->f_mr_desc, &atmp, if ( map_attr_value( dc, &f->f_mr_desc, &atmp,
&f->f_mr_value, &vtmp, RWM_MAP ) ) &f->f_mr_value, &vtmp, RWM_MAP ) )
{ {
return -1; goto computed;
} }
} else { } else {
@ -672,16 +673,21 @@ rwm_int_filter_map_rewrite(
break; break;
} }
case 0:
computed:;
filter_free_x( op, f );
f->f_choice = SLAPD_FILTER_COMPUTED;
f->f_result = SLAPD_COMPARE_UNDEFINED;
/* fallthru */
case SLAPD_FILTER_COMPUTED: case SLAPD_FILTER_COMPUTED:
switch ( f->f_result ) { switch ( f->f_result ) {
case LDAP_COMPARE_FALSE: case LDAP_COMPARE_FALSE:
case SLAPD_COMPARE_UNDEFINED:
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;
break; break;
} }
/* fallthru */
case SLAPD_COMPARE_UNDEFINED:
tmp = ber_bvfalse; tmp = ber_bvfalse;
break; break;
@ -711,6 +717,7 @@ rwm_int_filter_map_rewrite(
int int
rwm_filter_map_rewrite( rwm_filter_map_rewrite(
Operation *op,
dncookie *dc, dncookie *dc,
Filter *f, Filter *f,
struct berval *fstr ) struct berval *fstr )
@ -719,7 +726,7 @@ rwm_filter_map_rewrite(
dncookie fdc; dncookie fdc;
struct berval ftmp; struct berval ftmp;
rc = rwm_int_filter_map_rewrite( dc, f, fstr ); rc = rwm_int_filter_map_rewrite( op, dc, f, fstr );
#ifdef ENABLE_REWRITE #ifdef ENABLE_REWRITE
if ( rc != 0 ) { if ( rc != 0 ) {