comparison cli-chansession.c @ 1733:d529a52b2f7c coverity coverity

merge coverity from main
author Matt Johnston <matt@ucc.asn.au>
date Fri, 26 Jun 2020 21:07:34 +0800
parents 4b01f4826a29
children a7cc3332d8ab
comparison
equal deleted inserted replaced
1643:b59623a64678 1733:d529a52b2f7c
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_cleanupchansess(const struct Channel *channel); 38 static void cli_closechansess(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 NULL, /* closehandler */ 54 cli_closechansess, /* closehandler */
55 cli_cleanupchansess, /* cleanup */ 55 NULL, /* cleanup */
56 }; 56 };
57 57
58 static void cli_chansessreq(struct Channel *channel) { 58 static void cli_chansessreq(struct Channel *channel) {
59 59
60 char* type = NULL; 60 char* type = NULL;
82 m_free(type); 82 m_free(type);
83 } 83 }
84 84
85 85
86 /* If the main session goes, we close it up */ 86 /* If the main session goes, we close it up */
87 static void cli_cleanupchansess(const struct Channel *UNUSED(channel)) { 87 static void cli_closechansess(const struct Channel *UNUSED(channel)) {
88 cli_tty_cleanup(); /* Restore tty modes etc */ 88 cli_tty_cleanup(); /* Restore tty modes etc */
89 89
90 /* This channel hasn't gone yet, so we have > 1 */ 90 /* This channel hasn't gone yet, so we have > 1 */
91 if (ses.chancount > 1) { 91 if (ses.chancount > 1) {
92 dropbear_log(LOG_INFO, "Waiting for other channels to close..."); 92 dropbear_log(LOG_INFO, "Waiting for other channels to close...");
386 0, /* sepfds */ 386 0, /* sepfds */
387 "direct-tcpip", 387 "direct-tcpip",
388 cli_init_netcat, /* inithandler */ 388 cli_init_netcat, /* inithandler */
389 NULL, 389 NULL,
390 NULL, 390 NULL,
391 cli_closechansess,
391 NULL, 392 NULL,
392 cli_cleanupchansess
393 }; 393 };
394 394
395 void cli_send_netcat_request() { 395 void cli_send_netcat_request() {
396 396
397 const char* source_host = "127.0.0.1"; 397 const char* source_host = "127.0.0.1";