+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, INFO, " %s (%s): ",
+ mru->smru_oid,
+ mru->smru_names ? mru->smru_names[ 0 ] : "", 0 );
+#else
+ Debug( LDAP_DEBUG_TRACE, " %s (%s): ",
+ mru->smru_oid,
+ mru->smru_names ? mru->smru_names[ 0 ] : "", 0 );
+#endif
+
+ at = NULL;
+ for ( at_start( &at ); at; at_next( &at ) ) {
+ if( at->sat_flags & SLAP_AT_HIDE ) continue;
+
+ if( mr_usable_with_at( mr, at )) {
+ ldap_charray_add( &applies_oids, at->sat_cname.bv_val );
+ }
+ }
+
+ /*
+ * Note: the matchingRules that are not used
+ * by any attributeType are not listed as
+ * matchingRuleUse
+ */
+ if ( applies_oids != NULL ) {
+ mru->smru_applies_oids = applies_oids;
+#ifdef NEW_LOGGING
+ {
+ char *str = ldap_matchingruleuse2str( &mru->smru_mruleuse );
+ LDAP_LOG( OPERATION, INFO, "matchingRuleUse: %s\n", str, 0, 0 );
+ ldap_memfree( str );
+ }
+#else
+ {
+ char *str = ldap_matchingruleuse2str( &mru->smru_mruleuse );
+ Debug( LDAP_DEBUG_TRACE, "matchingRuleUse: %s\n", str, 0, 0 );
+ ldap_memfree( str );
+ }
+#endif
+
+ mru = (MatchingRuleUse *)ber_memalloc( sizeof( MatchingRuleUse ) );
+ /* call-forward from MatchingRule to MatchingRuleUse */
+ mr->smr_mru = mru;
+ /* copy static data to newly allocated struct */
+ *mru = mru_storage;
+ /* append the struct pointer to the end of the list */
+ *mru_ptr = mru;
+ /* update the list head pointer */
+ mru_ptr = &LDAP_SLIST_NEXT(mru,smru_next);
+ }
+ }
+
+ return( 0 );
+}
+
+int mr_usable_with_at(
+ MatchingRule *mr,
+ AttributeType *at )
+{
+ if( mr->smr_usage & SLAP_MR_EXT && (
+ mr->smr_syntax == at->sat_syntax ||
+ mr == at->sat_equality || mr == at->sat_approx ) )
+ {
+ return 1;
+ }
+
+ if ( mr->smr_compat_syntaxes ) {
+ int i;
+ for( i=0; mr->smr_compat_syntaxes[i]; i++ ) {
+ if( at->sat_syntax == mr->smr_compat_syntaxes[i] ) {
+ return 1;
+ }
+ }
+ }
+ return 0;
+}
+
+int mr_schema_info( Entry *e )
+{
+ AttributeDescription *ad_matchingRules = slap_schema.si_ad_matchingRules;
+ MatchingRule *mr;
+ struct berval nval;
+
+ LDAP_SLIST_FOREACH(mr, &mr_list, smr_next ) {