diff options
author | Julien Dessaux | 2018-08-26 18:54:19 +0200 |
---|---|---|
committer | Julien Dessaux | 2018-11-02 18:32:59 +0100 |
commit | fecf526ed334c8b987b37a3702e85a08bb7a9e68 (patch) | |
tree | b70f7ba78eb409f12a63c5ac69ef0ba97cf7b269 /src/main.c | |
parent | Added session recording with https://github.com/kilobyte/termrec (diff) | |
download | bastion-fecf526ed334c8b987b37a3702e85a08bb7a9e68.tar.gz bastion-fecf526ed334c8b987b37a3702e85a08bb7a9e68.tar.bz2 bastion-fecf526ed334c8b987b37a3702e85a08bb7a9e68.zip |
Began implementing configuration fetching from an sshportal mysql database
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -5,6 +5,7 @@ #include <sys/wait.h> #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; } |