* validate value per syntax
*/
#ifdef SLAP_ORDERED_PRETTYNORM
- rc = ordered_value_validate( ad, &vals[i] );
+ rc = ordered_value_validate( ad, &vals[i], LDAP_MOD_ADD );
#else /* ! SLAP_ORDERED_PRETTYNORM */
rc = validate( ad->ad_type->sat_syntax, &vals[i] );
#endif /* ! SLAP_ORDERED_PRETTYNORM */
} else {
#ifdef SLAP_ORDERED_PRETTYNORM
rc = ordered_value_validate( ad,
- &ml->sml_values[nvals] );
+ &ml->sml_values[nvals], ml->sml_op );
#else /* ! SLAP_ORDERED_PRETTYNORM */
rc = validate( ad->ad_type->sat_syntax,
&ml->sml_values[nvals] );
LDAP_SLAPD_F (int) ordered_value_validate LDAP_P((
AttributeDescription *ad,
- struct berval *in ));
+ struct berval *in,
+ int mop ));
LDAP_SLAPD_F (int) ordered_value_pretty LDAP_P((
AttributeDescription *ad,
/*
* wrapper for validate function
* uses the validate function of the syntax after removing
- * the index, if allowed an present
+ * the index, if allowed and present
*/
int
ordered_value_validate(
AttributeDescription *ad,
- struct berval *in )
+ struct berval *in,
+ int mop )
{
struct berval bv = *in;
bv.bv_len -= ptr - bv.bv_val;
bv.bv_val = ptr;
in = &bv;
+ /* If deleting by index, just succeed */
+ if ( mop == LDAP_MOD_DELETE && BER_BVISEMPTY( &bv ))
+ return LDAP_SUCCESS;
}
}
bv.bv_len -= idx.bv_len;
bv.bv_val = ptr;
+ /* validator will already prevent this for Adds */
+ if ( BER_BVISEMPTY( &bv )) {
+ ber_dupbv_x( normalized, &idx, ctx );
+ return LDAP_SUCCESS;
+ }
val = &bv;
}
}