Mercurial > dropbear
comparison cli-chansession.c @ 1625:79eef94ccea9
Split ChanType closehandler() and cleanup() so that dbclient doesn't
lose exit status messages
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 14 Nov 2018 22:57:56 +0800 |
parents | 58a74cb829b8 |
children | 4b01f4826a29 |
comparison
equal
deleted
inserted
replaced
1624:1f3fb83b0524 | 1625:79eef94ccea9 |
---|---|
33 #include "runopts.h" | 33 #include "runopts.h" |
34 #include "termcodes.h" | 34 #include "termcodes.h" |
35 #include "chansession.h" | 35 #include "chansession.h" |
36 #include "agentfwd.h" | 36 #include "agentfwd.h" |
37 | 37 |
38 static void cli_closechansess(const struct Channel *channel); | 38 static void cli_cleanupchansess(const struct Channel *channel); |
39 static int cli_initchansess(struct Channel *channel); | 39 static int cli_initchansess(struct Channel *channel); |
40 static void cli_chansessreq(struct Channel *channel); | 40 static void cli_chansessreq(struct Channel *channel); |
41 static void send_chansess_pty_req(const struct Channel *channel); | 41 static void send_chansess_pty_req(const struct Channel *channel); |
42 static void send_chansess_shell_req(const struct Channel *channel); | 42 static void send_chansess_shell_req(const struct Channel *channel); |
43 static void cli_escape_handler(const struct Channel *channel, const unsigned char* buf, int *len); | 43 static void cli_escape_handler(const struct Channel *channel, const unsigned char* buf, int *len); |
49 0, /* sepfds */ | 49 0, /* sepfds */ |
50 "session", /* name */ | 50 "session", /* name */ |
51 cli_initchansess, /* inithandler */ | 51 cli_initchansess, /* inithandler */ |
52 NULL, /* checkclosehandler */ | 52 NULL, /* checkclosehandler */ |
53 cli_chansessreq, /* reqhandler */ | 53 cli_chansessreq, /* reqhandler */ |
54 cli_closechansess, /* closehandler */ | 54 NULL, /* closehandler */ |
55 cli_cleanupchansess, /* cleanup */ | |
55 }; | 56 }; |
56 | 57 |
57 static void cli_chansessreq(struct Channel *channel) { | 58 static void cli_chansessreq(struct Channel *channel) { |
58 | 59 |
59 char* type = NULL; | 60 char* type = NULL; |
81 m_free(type); | 82 m_free(type); |
82 } | 83 } |
83 | 84 |
84 | 85 |
85 /* If the main session goes, we close it up */ | 86 /* If the main session goes, we close it up */ |
86 static void cli_closechansess(const struct Channel *UNUSED(channel)) { | 87 static void cli_cleanupchansess(const struct Channel *UNUSED(channel)) { |
87 cli_tty_cleanup(); /* Restore tty modes etc */ | 88 cli_tty_cleanup(); /* Restore tty modes etc */ |
88 | 89 |
89 /* This channel hasn't gone yet, so we have > 1 */ | 90 /* This channel hasn't gone yet, so we have > 1 */ |
90 if (ses.chancount > 1) { | 91 if (ses.chancount > 1) { |
91 dropbear_log(LOG_INFO, "Waiting for other channels to close..."); | 92 dropbear_log(LOG_INFO, "Waiting for other channels to close..."); |
385 0, /* sepfds */ | 386 0, /* sepfds */ |
386 "direct-tcpip", | 387 "direct-tcpip", |
387 cli_init_netcat, /* inithandler */ | 388 cli_init_netcat, /* inithandler */ |
388 NULL, | 389 NULL, |
389 NULL, | 390 NULL, |
390 cli_closechansess | 391 NULL, |
392 cli_cleanupchansess | |
391 }; | 393 }; |
392 | 394 |
393 void cli_send_netcat_request() { | 395 void cli_send_netcat_request() { |
394 | 396 |
395 const char* source_host = "127.0.0.1"; | 397 const char* source_host = "127.0.0.1"; |