ITS#5959 just drop illegal values, keep remainder if any. fix a_numvals.

This commit is contained in:
Howard Chu 2009-02-20 01:48:19 +00:00
parent ed97e96944
commit 1e4060891f

View File

@ -2080,24 +2080,34 @@ remove_oc:;
attr->a_nvals = ch_malloc( ( last + 1 ) * sizeof( struct berval ) );
for ( i = 0; i<last; i++ ) {
/* if normalizer fails, forget this attr */
/* if normalizer fails, drop this value */
if ( attr->a_desc->ad_type->sat_equality->smr_normalize(
SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX,
attr->a_desc->ad_type->sat_syntax,
attr->a_desc->ad_type->sat_equality,
&attr->a_vals[i], &attr->a_nvals[i],
NULL )) {
BER_BVZERO( &attr->a_nvals[i] );
attr_free( attr );
goto next_attr;
LBER_FREE( attr->a_vals[i].bv_val );
if ( --last == i ) {
BER_BVZERO( &attr->a_vals[ i ] );
break;
}
attr->a_vals[i] = attr->a_vals[last];
BER_BVZERO( &attr->a_vals[last] );
i--;
}
}
if ( last == 0 && attr->a_vals != &slap_dummy_bv ) {
attr_free( attr );
goto next_attr;
}
BER_BVZERO( &attr->a_nvals[i] );
} else {
attr->a_nvals = attr->a_vals;
}
attr->a_numvals = last;
*attrp = attr;
attrp = &attr->a_next;
next_attr:;