]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/tools/slapcommon.c
Don't reeval expression
[openldap] / servers / slapd / tools / slapcommon.c
index bcea08993ff788d556dfc9a97ebbd94afb4f20d9..2004511a678686ba3d65a24c851042bde913aa5a 100644 (file)
@@ -181,6 +181,13 @@ slap_tool_init(
         * initialize stuff and figure out which backend we're dealing with
         */
 
+#ifdef SLAPD_MODULES
+       if ( module_init() != 0 ) {
+               fprintf( stderr, "%s: module_init failed!\n", progname );
+               exit( EXIT_FAILURE );
+       }
+#endif
+               
        rc = slap_init( mode, progname );
 
        if (rc != 0 ) {
@@ -195,7 +202,12 @@ slap_tool_init(
                exit( EXIT_FAILURE );
        }
 
-       read_config( conffile );
+       rc = read_config( conffile, 0 );
+
+       if ( rc != 0 ) {
+               fprintf( stderr, "%s: bad configuration file!\n", progname );
+               exit( EXIT_FAILURE );
+       }
 
        if ( !nbackends ) {
                fprintf( stderr, "No databases found in config file\n" );
@@ -273,6 +285,18 @@ void slap_tool_destroy( void )
 {
        slap_shutdown( be );
        slap_destroy();
+#ifdef SLAPD_MODULES
+       if ( slapMode == SLAP_SERVER_MODE ) {
+       /* always false. just pulls in necessary symbol references. */
+               lutil_uuidstr(NULL, 0);
+       }
+       module_kill();
+#endif
+       schema_destroy();
+#ifdef HAVE_TLS
+       ldap_pvt_tls_destroy();
+#endif
+       config_destroy();
 
 #ifdef CSRIMALLOC
        mal_dumpleaktrace( leakfile );