+value_match(
+ int *match,
+ AttributeDescription *ad,
+ MatchingRule *mr,
+ unsigned flags,
+ struct berval *v1, /* stored value */
+ void *v2, /* assertion */
+ const char ** text )
+{
+ int rc;
+ struct berval nv1 = { 0, NULL };
+ struct berval nv2 = { 0, NULL };
+
+ if( !mr->smr_match ) {
+ return LDAP_INAPPROPRIATE_MATCHING;
+ }
+
+ if( ad->ad_type->sat_syntax->ssyn_normalize ) {
+ rc = ad->ad_type->sat_syntax->ssyn_normalize(
+ ad->ad_type->sat_syntax, v1, &nv1 );
+
+ if( rc != LDAP_SUCCESS ) {
+ return LDAP_INAPPROPRIATE_MATCHING;
+ }
+ }
+
+ if ( SLAP_IS_MR_VALUE_SYNTAX_NONCONVERTED_MATCH( flags ) &&
+ mr->smr_convert )
+ {
+ rc = (mr->smr_convert)( v2, &nv2 );
+ if ( rc != LDAP_SUCCESS ) {
+ return LDAP_INVALID_SYNTAX;
+ }
+
+ /* let smr_match know we've converted the value */
+ flags |= SLAP_MR_VALUE_SYNTAX_CONVERTED_MATCH;
+ }
+
+ rc = (mr->smr_match)( match, flags,
+ ad->ad_type->sat_syntax,
+ mr,
+ nv1.bv_val != NULL ? &nv1 : v1,
+ nv2.bv_val != NULL ? &nv2 : v2 );
+
+ if (nv1.bv_val ) free( nv1.bv_val );
+ if (nv2.bv_val ) free( nv2.bv_val );
+ return rc;
+}
+
+
+int value_find_ex(
+ AttributeDescription *ad,
+ unsigned flags,
+ BerVarray vals,
+ struct berval *val )