- /*
- * OK, if no matching rule, normalize for equality, otherwise
- * normalize for the matching rule.
- */
- rc = value_validate_normalize( ma->ma_desc, SLAP_MR_EQUALITY,
- &value, &ma->ma_value, text );
+ if ( ma->ma_desc != NULL ) {
+ if( !mr_usable_with_at( ma->ma_rule, ma->ma_desc->ad_type ) ) {
+ mra_free( ma, 1 );
+ *text = "matching rule use with this attribute not appropriate";
+ return LDAP_INAPPROPRIATE_MATCHING;
+ }
+
+ /*
+ * OK, if no matching rule, normalize for equality, otherwise
+ * normalize for the matching rule.
+ */
+ rc = value_validate_normalize( ma->ma_desc, SLAP_MR_EQUALITY,
+ &value, &ma->ma_value, text );
+ } else {
+ /*
+ * Need to normalize, but how?
+ */
+ rc = value_validate( ma->ma_rule, &value, text );
+ if ( rc == LDAP_SUCCESS ) {
+ ber_dupbv( &ma->ma_value, &value );
+ }
+
+ }