+ rc = value_add_one( &(*a)->a_vals, val );
+
+ if( !rc && nval ) rc = value_add_one( &(*a)->a_nvals, nval );
+ else (*a)->a_nvals = (*a)->a_vals;
+ return rc;
+}
+
+int
+attr_merge_normalize_one(
+ Entry *e,
+ AttributeDescription *desc,
+ struct berval *val,
+ void *memctx
+) {
+ struct berval nval;
+ int rc;
+
+ if ( desc->ad_type->sat_equality->smr_normalize ) {
+ rc = (*desc->ad_type->sat_equality->smr_normalize)(
+ 0,
+ desc->ad_type->sat_syntax,
+ desc->ad_type->sat_equality,
+ val, &nval, memctx );
+
+ if ( rc != LDAP_SUCCESS ) {
+ return rc;
+ }
+ }
+
+ rc = attr_merge_one( e, desc, val, &nval );
+ ch_free( nval.bv_val );
+ return rc;
+}
+
+/*
+ * attrs_find - find attribute(s) by AttributeDescription
+ * returns next attribute which is subtype of provided description.
+ */
+
+Attribute *
+attrs_find(
+ Attribute *a,
+ AttributeDescription *desc
+)
+{
+ for ( ; a != NULL; a = a->a_next ) {
+ if ( is_ad_subtype( a->a_desc, desc ) ) {
+ return( a );
+ }
+ }
+
+ return( NULL );