X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fmr.c;h=2ec9ebcc15090d8222362c7e24578197eda60f74;hb=78066c08c0650e5b1e7e205946d409e3dd10e73b;hp=705c2b7aa64c4ee1b8972de9b59e9e935b95911f;hpb=d30264a2a1c51c2e8802c9f57c70664846526f8b;p=openldap diff --git a/servers/slapd/mr.c b/servers/slapd/mr.c index 705c2b7aa6..2ec9ebcc15 100644 --- a/servers/slapd/mr.c +++ b/servers/slapd/mr.c @@ -36,7 +36,7 @@ mr_index_cmp( static int mr_index_name_cmp( - char *name, + char *name, struct mindexrec *mir ) { @@ -49,12 +49,24 @@ mr_find( const char *mrname ) struct mindexrec *mir = NULL; if ( (mir = (struct mindexrec *) avl_find( mr_index, mrname, - (AVL_CMP) mr_index_name_cmp )) != NULL ) { + (AVL_CMP) mr_index_name_cmp )) != NULL ) { return( mir->mir_mr ); } return( NULL ); } +void +mr_destroy( void ) +{ + MatchingRule *m, *n; + + avl_free(mr_index, ldap_memfree); + for (m=mr_list; m; m=n) { + n = m->smr_next; + ldap_matchingrule_free((LDAPMatchingRule *)m); + } +} + static int mr_insert( MatchingRule *smr, @@ -90,7 +102,7 @@ mr_insert( while ( *names ) { mir = (struct mindexrec *) ch_calloc( 1, sizeof(struct mindexrec) ); - mir->mir_name = ch_strdup(*names); + mir->mir_name = *names; mir->mir_mr = smr; if ( avl_insert( &mr_index, (caddr_t) mir, (AVL_CMP) mr_index_cmp, @@ -168,8 +180,14 @@ register_matching_rule( const char *err; if( usage == SLAP_MR_NONE ) { +#ifdef NEW_LOGGING + LDAP_LOG(( "operation", LDAP_LEVEL_ERR, + "register_matching_rule: %s not usable\n", desc )); +#else Debug( LDAP_DEBUG_ANY, "register_matching_rule: not usable %s\n", desc, 0, 0 ); +#endif + return -1; } @@ -180,9 +198,16 @@ register_matching_rule( /* ignore for now */ if( amr == NULL ) { +#ifdef NEW_LOGGING + LDAP_LOG(( "operation", LDAP_LEVEL_ERR, + "register_matching_rule: could not locate associated matching rule %s for %s\n", + associated, desc )); +#else Debug( LDAP_DEBUG_ANY, "register_matching_rule: could not locate " "associated matching rule %s for %s\n", associated, desc, 0 ); +#endif + return -1; } #endif @@ -191,8 +216,15 @@ register_matching_rule( mr = ldap_str2matchingrule( desc, &code, &err, LDAP_SCHEMA_ALLOW_ALL); if ( !mr ) { +#ifdef NEW_LOGGING + LDAP_LOG(( "operation", LDAP_LEVEL_ERR, + "register_matching_rule: %s before %s in %s.\n", + ldap_scherr2str(code), err, desc )); +#else Debug( LDAP_DEBUG_ANY, "Error in register_matching_rule: %s before %s in %s\n", ldap_scherr2str(code), err, desc ); +#endif + return( -1 ); } @@ -203,8 +235,15 @@ register_matching_rule( ldap_memfree( mr ); if ( code ) { +#ifdef NEW_LOGGING + LDAP_LOG(( "operation", LDAP_LEVEL_ERR, + "register_matching_rule: %s for %s in %s.\n", + scherr2str(code), err, desc )); +#else Debug( LDAP_DEBUG_ANY, "Error in register_matching_rule: %s for %s in %s\n", scherr2str(code), err, desc ); +#endif + return( -1 ); }