attr_merge(
Entry *e,
AttributeDescription *desc,
- BerVarray vals
- , BerVarray nvals
+ BerVarray vals,
+ BerVarray nvals
) {
int rc;
return rc;
}
+int
+attr_merge_normalize(
+ Entry *e,
+ AttributeDescription *desc,
+ BerVarray vals
+) {
+ 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] );
+
+ if ( rc != LDAP_SUCCESS ) {
+ nvals[i+1].bv_val = NULL;
+ goto error_return;
+ }
+ }
+ nvals[i].bv_val = NULL;
+ }
+
+ rc = attr_merge( e, desc, vals, nvals );
+
+error_return:;
+ ber_bvarray_free( nvals );
+ return rc;
+}
+
int
attr_merge_one(
Entry *e,
AttributeDescription *desc,
- struct berval *val
- , struct berval *nval
+ struct berval *val,
+ struct berval *nval
) {
int rc;
Attribute **a;
return rc;
}
+int
+attr_merge_normalize_one(
+ Entry *e,
+ AttributeDescription *desc,
+ struct berval *val
+) {
+ 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 );
+
+ 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.
AttributeDescription *desc,
struct berval *val,
struct berval *nval ));
+LDAP_SLAPD_F (int) attr_merge_normalize LDAP_P(( Entry *e,
+ AttributeDescription *desc,
+ BerVarray vals ));
+LDAP_SLAPD_F (int) attr_merge_normalize_one LDAP_P(( Entry *e,
+ AttributeDescription *desc,
+ struct berval *val ));
LDAP_SLAPD_F (Attribute *) attrs_find LDAP_P((
Attribute *a, AttributeDescription *desc ));
LDAP_SLAPD_F (Attribute *) attr_find LDAP_P((