summaryrefslogtreecommitdiff
path: root/cli-session.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2013-04-01 22:26:55 +0800
committerMatt Johnston <matt@ucc.asn.au>2013-04-01 22:26:55 +0800
commit655d681bebbb289537d69212805b62df471ea32d (patch)
tree6eda9b6d26051993d7bbeab1674aeb28a629c919 /cli-session.c
parenteeac5d9ac16a93e7ff4e334fcab95d32eb136ff1 (diff)
downloaddropbear-655d681bebbb289537d69212805b62df471ea32d.tar.gz
Run the cleanup handler also when we close due to TCP connection being closed
Diffstat (limited to 'cli-session.c')
-rw-r--r--cli-session.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/cli-session.c b/cli-session.c
index 3adec73..0c6635a 100644
--- a/cli-session.c
+++ b/cli-session.c
@@ -42,6 +42,7 @@ static void cli_sessionloop();
static void cli_session_init();
static void cli_finished();
static void recv_msg_service_accept(void);
+static void cli_session_cleanup(void);
struct clientsession cli_ses; /* GLOBAL */
@@ -143,6 +144,7 @@ static void cli_session_init() {
/* For printing "remote host closed" for the user */
ses.remoteclosed = cli_remoteclosed;
+ ses.extra_session_cleanup = cli_session_cleanup;
ses.buf_match_algo = cli_buf_match_algo;
/* packet handlers */
@@ -290,7 +292,7 @@ static void cli_sessionloop() {
}
-void cli_session_cleanup() {
+static void cli_session_cleanup(void) {
if (!sessinitdone) {
return;
@@ -308,8 +310,7 @@ void cli_session_cleanup() {
static void cli_finished() {
- cli_session_cleanup();
- common_session_cleanup();
+ session_cleanup();
fprintf(stderr, "Connection to %s@%s:%s closed.\n", cli_opts.username,
cli_opts.remotehost, cli_opts.remoteport);
exit(cli_ses.retval);