]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-monitor/database.c
Simpler fix for NO_THREADS
[openldap] / servers / slapd / back-monitor / database.c
index 85df772f4c65fa6cae1e3d6b2f5d72d25c33ca57..2ed5225faaee3241d69aa143d380b7c9c5b03b56 100644 (file)
@@ -48,9 +48,9 @@ monitor_subsys_database_init(
        int                     i;
        struct monitorentrypriv *mp;
        AttributeDescription    *ad_nc = slap_schema.si_ad_namingContexts;
+       AttributeDescription    *ad_mc = slap_schema.si_ad_monitorContext;
        AttributeDescription    *ad_seeAlso = NULL;
        const char              *text = NULL;
-       struct berval           bv[2];
 
        assert( be != NULL );
        assert( monitor_ad_desc != NULL );
@@ -61,10 +61,10 @@ monitor_subsys_database_init(
                                &monitor_subsys[SLAPD_MONITOR_DATABASE].mss_ndn, 
                                &e_database ) ) {
 #ifdef NEW_LOGGING
-               LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
+               LDAP_LOG( OPERATION, CRIT,
                        "monitor_subsys_database_init: "
                        "unable to get entry '%s'\n",
-                       monitor_subsys[SLAPD_MONITOR_DATABASE].mss_ndn.bv_val ));
+                       monitor_subsys[SLAPD_MONITOR_DATABASE].mss_ndn.bv_val, 0, 0 );
 #else
                Debug( LDAP_DEBUG_ANY,
                        "monitor_subsys_database_init: "
@@ -99,11 +99,10 @@ monitor_subsys_database_init(
                e = str2entry( buf );
                if ( e == NULL ) {
 #ifdef NEW_LOGGING
-                       LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
+                       LDAP_LOG( OPERATION, CRIT,
                                "monitor_subsys_database_init: "
                                "unable to create entry 'cn=Database %d,%s'\n",
-                               i, 
-                               monitor_subsys[SLAPD_MONITOR_DATABASE].mss_ndn.bv_val ));
+                               i, monitor_subsys[SLAPD_MONITOR_DATABASE].mss_ndn.bv_val, 0 );
 #else
                        Debug( LDAP_DEBUG_ANY,
                                "monitor_subsys_database_init: "
@@ -115,15 +114,18 @@ monitor_subsys_database_init(
                        return( -1 );
                }
                
-               for ( j = 0; be->be_suffix[j]; j++ ) {
-                       bv[0] = *be->be_suffix[j];
-
-                       attr_merge( e, ad_nc, bv );
-                       attr_merge( e_database, ad_nc, bv );
+               if ( be->be_flags & SLAP_BFLAG_MONITOR ) {
+                       attr_merge( e, ad_mc, be->be_suffix );
+                       attr_merge( e_database, ad_mc, be->be_suffix );
+               } else {
+                       attr_merge( e, ad_nc, be->be_suffix );
+                       attr_merge( e_database, ad_nc, be->be_suffix );
                }
 
                for ( j = nBackendInfo; j--; ) {
                        if ( &backendInfo[ j ] == be->bd_info ) {
+                               struct berval           bv[ 2 ];
+
                                /* we check the pointer; the test on the
                                 * string should be more reliable */
                                assert( strcasecmp( backendInfo[ j ].bi_type,
@@ -132,8 +134,9 @@ monitor_subsys_database_init(
                                snprintf( buf, sizeof( buf ), 
                                        "cn=Backend %d,%s", 
                                        j, monitor_subsys[SLAPD_MONITOR_BACKEND].mss_dn.bv_val );
-                               bv->bv_val = buf;
-                               bv->bv_len = strlen( buf );
+                               bv[ 0 ].bv_val = buf;
+                               bv[ 0 ].bv_len = strlen( buf );
+                               bv[ 1 ].bv_val = NULL;
                                attr_merge( e, ad_seeAlso, bv );
                                break;
                        }
@@ -151,11 +154,10 @@ monitor_subsys_database_init(
 
                if ( monitor_cache_add( mi, e ) ) {
 #ifdef NEW_LOGGING
-                       LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
+                       LDAP_LOG( OPERATION, CRIT,
                                "monitor_subsys_database_init: "
                                "unable to add entry 'cn=Database %d,%s'\n",
-                               i, 
-                               monitor_subsys[SLAPD_MONITOR_DATABASE].mss_ndn.bv_val ));
+                               i, monitor_subsys[SLAPD_MONITOR_DATABASE].mss_ndn.bv_val, 0 );
 #else
                        Debug( LDAP_DEBUG_ANY,
                                "monitor_subsys_database_init: "