+ if( def->mrd_associated != NULL ) {
+ amr = mr_find( def->mrd_associated );
+
+ if( amr == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, ERR,
+ "register_matching_rule: could not locate associated "
+ "matching rule %s for %s\n",
+ def->mrd_associated, def->mrd_desc, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY, "register_matching_rule: could not locate "
+ "associated matching rule %s for %s\n",
+ def->mrd_associated, def->mrd_desc, 0 );
+#endif
+
+ return -1;
+ }
+
+ if (( def->mrd_usage & SLAP_MR_EQUALITY ) &&
+ (( def->mrd_usage & SLAP_MR_SUBTYPE_MASK ) == SLAP_MR_NONE ))
+ {
+ if (( def->mrd_usage & SLAP_MR_EQUALITY ) &&
+ (( def->mrd_usage & SLAP_MR_SUBTYPE_MASK ) != SLAP_MR_NONE ))
+ {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, ERR,
+ "register_matching_rule: inappropriate (approx) association "
+ "%s for %s\n",
+ def->mrd_associated, def->mrd_desc, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "register_matching_rule: inappropriate (approx) association "
+ "%s for %s\n",
+ def->mrd_associated, def->mrd_desc, 0 );
+#endif
+ return -1;
+ }
+
+ } else if (!( amr->smr_usage & SLAP_MR_EQUALITY )) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, ERR,
+ "register_matching_rule: inappropriate (equalilty) association "
+ "%s for %s\n",
+ def->mrd_associated, def->mrd_desc, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "register_matching_rule: inappropriate (equalilty) association "
+ "%s for %s\n",
+ def->mrd_associated, def->mrd_desc, 0 );
+#endif
+ return -1;
+ }
+ }
+
+ mr = ldap_str2matchingrule( def->mrd_desc, &code, &err,
+ LDAP_SCHEMA_ALLOW_ALL );