+int
+attr_merge_normalize(
+ Entry *e,
+ AttributeDescription *desc,
+ BerVarray vals,
+ void *memctx
+) {
+ BerVarray nvals = NULL;
+ int rc;
+
+ if ( desc->ad_type->sat_equality->smr_normalize ) {
+ int i;
+
+ for ( i = 0; vals[i].bv_val; i++);
+
+ nvals = ch_calloc( sizeof(struct berval), i + 1 );
+ for ( i = 0; vals[i].bv_val; i++ ) {
+ rc = (*desc->ad_type->sat_equality->smr_normalize)(
+ 0,
+ desc->ad_type->sat_syntax,
+ desc->ad_type->sat_equality,
+ &vals[i], &nvals[i], memctx );
+
+ if ( rc != LDAP_SUCCESS ) {
+ nvals[i+1].bv_val = NULL;
+ goto error_return;
+ }
+ }
+ nvals[i].bv_val = NULL;
+ }