]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-monitor/init.c
more (in)sanity stuff
[openldap] / servers / slapd / back-monitor / init.c
index 7be75a8276986414ecd13201262c249dec48e4ad..ce8967c3045ee82604b92cb022eea1001a43c0a0 100644 (file)
@@ -62,6 +62,7 @@ static struct monitor_subsys_t known_monitor_subsys[] = {
                        BER_BVNULL },
                MONITOR_F_PERSISTENT_CH,
                monitor_subsys_backend_init,
+               NULL,   /* destroy */
                NULL,   /* update */
                NULL,   /* create */
                NULL    /* modify */
@@ -72,8 +73,9 @@ static struct monitor_subsys_t known_monitor_subsys[] = {
                        BER_BVNULL },
                MONITOR_F_VOLATILE_CH,
                monitor_subsys_conn_init,
-               monitor_subsys_conn_update,
-               monitor_subsys_conn_create,
+               NULL,   /* destroy */
+               NULL,   /* update */
+               NULL,   /* create */
                NULL    /* modify */
                }, { 
                SLAPD_MONITOR_DATABASE_NAME,    
@@ -82,9 +84,10 @@ static struct monitor_subsys_t known_monitor_subsys[] = {
                        BER_BVNULL },
                MONITOR_F_PERSISTENT_CH,
                monitor_subsys_database_init,
+               NULL,   /* destroy */
                NULL,   /* update */
                NULL,   /* create */
-               monitor_subsys_database_modify
+               NULL    /* modify */
                }, { 
                SLAPD_MONITOR_LISTENER_NAME,    
                BER_BVNULL, BER_BVNULL, BER_BVNULL,
@@ -92,6 +95,7 @@ static struct monitor_subsys_t known_monitor_subsys[] = {
                        BER_BVNULL },
                MONITOR_F_PERSISTENT_CH,
                monitor_subsys_listener_init,
+               NULL,   /* destroy */
                NULL,   /* update */
                NULL,   /* create */
                NULL    /* modify */
@@ -103,9 +107,10 @@ static struct monitor_subsys_t known_monitor_subsys[] = {
                        BER_BVNULL },
                MONITOR_F_NONE,
                monitor_subsys_log_init,
+               NULL,   /* destroy */
                NULL,   /* update */
                NULL,   /* create */
-               monitor_subsys_log_modify
+               NULL,   /* modify */
                }, { 
                SLAPD_MONITOR_OPS_NAME,
                BER_BVNULL, BER_BVNULL, BER_BVNULL,
@@ -113,7 +118,8 @@ static struct monitor_subsys_t known_monitor_subsys[] = {
                        BER_BVNULL },
                MONITOR_F_PERSISTENT_CH,
                monitor_subsys_ops_init,
-               monitor_subsys_ops_update,
+               NULL,   /* destroy */
+               NULL,   /* update */
                NULL,   /* create */
                NULL,   /* modify */
                }, { 
@@ -123,6 +129,7 @@ static struct monitor_subsys_t known_monitor_subsys[] = {
                        BER_BVNULL },
                MONITOR_F_PERSISTENT_CH,
                monitor_subsys_overlay_init,
+               NULL,   /* destroy */
                NULL,   /* update */
                NULL,   /* create */
                NULL,   /* modify */
@@ -133,6 +140,7 @@ static struct monitor_subsys_t known_monitor_subsys[] = {
                        BER_BVNULL },
                MONITOR_F_NONE,
                NULL,   /* init */
+               NULL,   /* destroy */
                NULL,   /* update */
                NULL,   /* create */
                NULL    /* modify */
@@ -143,7 +151,8 @@ static struct monitor_subsys_t known_monitor_subsys[] = {
                        BER_BVNULL },
                MONITOR_F_PERSISTENT_CH,
                monitor_subsys_sent_init,
-               monitor_subsys_sent_update,
+               NULL,   /* destroy */
+               NULL,   /* update */
                NULL,   /* create */
                NULL,   /* modify */
                }, { 
@@ -153,7 +162,8 @@ static struct monitor_subsys_t known_monitor_subsys[] = {
                        BER_BVNULL },
                MONITOR_F_PERSISTENT_CH,
                monitor_subsys_thread_init,
-               monitor_subsys_thread_update,
+               NULL,   /* destroy */
+               NULL,   /* update */
                NULL,   /* create */
                NULL    /* modify */
                }, { 
@@ -163,7 +173,8 @@ static struct monitor_subsys_t known_monitor_subsys[] = {
                        BER_BVNULL },
                MONITOR_F_PERSISTENT_CH,
                monitor_subsys_time_init,
-               monitor_subsys_time_update,
+               NULL,   /* destroy */
+               NULL,   /* update */
                NULL,   /* create */
                NULL,   /* modify */
                }, { 
@@ -173,6 +184,7 @@ static struct monitor_subsys_t known_monitor_subsys[] = {
                        BER_BVNULL },
                MONITOR_F_NONE,
                NULL,   /* init */
+               NULL,   /* destroy */
                NULL,   /* update */
                NULL,   /* create */
                NULL    /* modify */
@@ -183,7 +195,8 @@ static struct monitor_subsys_t known_monitor_subsys[] = {
                        BER_BVNULL },
                MONITOR_F_PERSISTENT_CH,
                monitor_subsys_rww_init,
-               monitor_subsys_rww_update,
+               NULL,   /* destroy */
+               NULL,   /* update */
                NULL,   /* create */
                NULL    /* modify */
                }, { NULL }
@@ -1755,6 +1768,10 @@ monitor_back_db_destroy(
 {
        monitor_info_t  *mi = ( monitor_info_t * )be->be_private;
 
+       if ( mi == NULL ) {
+               return -1;
+       }
+
        /*
         * FIXME: destroys all the data
         */
@@ -1763,9 +1780,25 @@ monitor_back_db_destroy(
        (void)monitor_cache_destroy( mi );
 
        if ( monitor_subsys ) {
+               int     i;
+
+               for ( i = 0; monitor_subsys[ i ] != NULL; i++ ) {
+                       if ( monitor_subsys[ i ]->mss_destroy ) {
+                               monitor_subsys[ i ]->mss_destroy( be, monitor_subsys[ i ] );
+                       }
+
+                       if ( !BER_BVISNULL( &monitor_subsys[ i ]->mss_rdn ) ) {
+                               ch_free( monitor_subsys[ i ]->mss_rdn.bv_val );
+                       }
+               }
+
                ch_free( monitor_subsys );
        }
        
+       ldap_pvt_thread_mutex_destroy( &monitor_info.mi_cache_mutex );
+
+       be->be_private = NULL;
+
        return 0;
 }