Code

frontend, sysdbd: Let all TCP connections use SSL.
[sysdb.git] / src / tools / sysdbd / main.c
index 3511a8a54643a1ea24a6dfda34c986c90d285e0e..9d85ba8ead2005d285b91c1bdf513fae21372f3d 100644 (file)
@@ -60,6 +60,9 @@
 
 #include <pthread.h>
 
+#include <openssl/ssl.h>
+#include <openssl/err.h>
+
 #ifndef CONFIGFILE
 #      define CONFIGFILE SYSCONFDIR"/sysdb/sysdbd.conf"
 #endif
@@ -292,6 +295,8 @@ main_loop(void)
        }
 
        /* clean up in case we exited the loop on error */
+       plugin_main_loop.do_loop = 0;
+       frontend_main_loop.do_loop = 0;
        pthread_kill(backend_thread, SIGINT);
        pthread_join(backend_thread, NULL);
 
@@ -302,7 +307,7 @@ main_loop(void)
 int
 main(int argc, char **argv)
 {
-       _Bool do_daemonize = 1;
+       bool do_daemonize = 1;
 
        struct sigaction sa_intterm;
        struct sigaction sa_hup;
@@ -364,6 +369,9 @@ main(int argc, char **argv)
                if (daemonize())
                        exit(1);
 
+       SSL_load_error_strings();
+       OpenSSL_add_ssl_algorithms();
+
        sdb_plugin_init_all();
        plugin_main_loop.default_interval = SECS_TO_SDB_TIME(60);
 
@@ -387,6 +395,8 @@ main(int argc, char **argv)
        sdb_log(SDB_LOG_INFO, "Shutting down SysDB daemon "SDB_VERSION_STRING
                        SDB_VERSION_EXTRA" (pid %i)", (int)getpid());
        sdb_plugin_shutdown_all();
+
+       ERR_free_strings();
        return status;
 } /* main */