X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Ftools%2Fsysdbd%2Fmain.c;h=759eee2f5652ebee72c9131d22a05ddbf8f704b2;hb=dc7d88e992d19870cbec25244e0f1d4ddc0541b7;hp=3511a8a54643a1ea24a6dfda34c986c90d285e0e;hpb=dc0202c1bb91a4147674957933a804719096ac09;p=sysdb.git diff --git a/src/tools/sysdbd/main.c b/src/tools/sysdbd/main.c index 3511a8a..759eee2 100644 --- a/src/tools/sysdbd/main.c +++ b/src/tools/sysdbd/main.c @@ -33,6 +33,7 @@ #include "core/plugin.h" #include "core/store.h" #include "utils/error.h" +#include "utils/ssl.h" #include "frontend/connection.h" #include "frontend/sock.h" @@ -74,8 +75,8 @@ static sdb_fe_loop_t frontend_main_loop = SDB_FE_LOOP_INIT; static char *config_filename = NULL; static int reconfigure = 0; -static char *default_listen_addresses[] = { - DEFAULT_SOCKET, +static daemon_listener_t default_listen_addresses[] = { + { DEFAULT_SOCKET, SDB_SSL_DEFAULT_OPTIONS }, }; static void @@ -254,7 +255,8 @@ main_loop(void) } for (i = 0; i < listen_addresses_num; ++i) { - if (sdb_fe_sock_add_listener(sock, listen_addresses[i])) { + if (sdb_fe_sock_add_listener(sock, listen_addresses[i].address, + &listen_addresses[i].ssl_opts)) { status = 1; break; } @@ -292,6 +294,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 +306,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 +368,8 @@ main(int argc, char **argv) if (daemonize()) exit(1); + if (sdb_ssl_init()) + exit(1); sdb_plugin_init_all(); plugin_main_loop.default_interval = SECS_TO_SDB_TIME(60); @@ -387,6 +393,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(); + sdb_plugin_unregister_all(); + sdb_ssl_shutdown(); return status; } /* main */