From beff818f25ae69cfe8501e18271b2509320de8df Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sun, 26 Aug 2018 15:55:38 +0200 Subject: Added session recording with https://github.com/kilobyte/termrec --- src/main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index c3d7108..4f475ee 100644 --- a/src/main.c +++ b/src/main.c @@ -14,12 +14,13 @@ static void sigchld_handler(int signo) { } /* SIGINT handler for cleaning up on forced exit. */ -static ssh_bind sshbind; -static ssh_session session; +static ssh_bind sshbind = NULL; +static ssh_session session = NULL; __attribute__((noreturn)) static void sigint_handler(int signo) { (void) signo; + ssh_disconnect(session); ssh_free(session); ssh_bind_free(sshbind); ssh_finalize(); @@ -75,8 +76,10 @@ int main() fprintf(stderr, "Error initializing ssh_session\n"); break; } +#ifdef LIBSSH_VERBOSE_OUTPOUT int verbosity = SSH_LOG_PROTOCOL; ssh_options_set(session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity); +#endif // Blocks until there is a new incoming connection if (ssh_bind_accept(sshbind,session) == SSH_OK){ @@ -87,6 +90,7 @@ int main() sigaction(SIGCHLD, &sa, NULL); /* Remove socket binding, which allows us to restart the parent process, without terminating existing sessions. */ ssh_bind_free(sshbind); + sshbind = NULL; ssh_event event = ssh_event_new(); if (event != NULL) { -- cgit v1.2.3