From fecf526ed334c8b987b37a3702e85a08bb7a9e68 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sun, 26 Aug 2018 18:54:19 +0200 Subject: Began implementing configuration fetching from an sshportal mysql database --- src/main.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 4f475ee..6ea6bcb 100644 --- a/src/main.c +++ b/src/main.c @@ -5,6 +5,7 @@ #include #include "../config.h" +#include "mysql.h" #include "session.h" /* SIGCHLD handler for cleaning up dead children. */ @@ -24,6 +25,7 @@ __attribute__((noreturn)) static void sigint_handler(int signo) ssh_free(session); ssh_bind_free(sshbind); ssh_finalize(); + db_clean(); exit(0); } @@ -92,6 +94,9 @@ int main() ssh_bind_free(sshbind); sshbind = NULL; + if (db_init() !=0) + goto child_cleaning; + ssh_event event = ssh_event_new(); if (event != NULL) { /* Blocks until the SSH session ends */ @@ -100,6 +105,7 @@ int main() } else { fprintf(stderr, "Could not create polling context\n"); } +child_cleaning: ssh_disconnect(session); ssh_free(session); ssh_finalize(); @@ -122,5 +128,6 @@ int main() } ssh_bind_free(sshbind); ssh_finalize(); + db_clean(); return 0; } -- cgit v1.2.3