comparison cli-main.c @ 1355:3fdd8c5a0195 fuzz

merge main to fuzz
author Matt Johnston <matt@ucc.asn.au>
date Thu, 18 May 2017 23:45:10 +0800
parents 2c9dac2d6707
children 58a74cb829b8
comparison
equal deleted inserted replaced
1354:7618759e9327 1355:3fdd8c5a0195
33 #include "netio.h" 33 #include "netio.h"
34 34
35 static void cli_dropbear_exit(int exitcode, const char* format, va_list param) ATTRIB_NORETURN; 35 static void cli_dropbear_exit(int exitcode, const char* format, va_list param) ATTRIB_NORETURN;
36 static void cli_dropbear_log(int priority, const char* format, va_list param); 36 static void cli_dropbear_log(int priority, const char* format, va_list param);
37 37
38 #ifdef ENABLE_CLI_PROXYCMD 38 #if DROPBEAR_CLI_PROXYCMD
39 static void cli_proxy_cmd(int *sock_in, int *sock_out, pid_t *pid_out); 39 static void cli_proxy_cmd(int *sock_in, int *sock_out, pid_t *pid_out);
40 static void kill_proxy_sighandler(int signo); 40 static void kill_proxy_sighandler(int signo);
41 #endif 41 #endif
42 42
43 #if defined(DBMULTI_dbclient) || !defined(DROPBEAR_MULTI) 43 #if defined(DBMULTI_dbclient) || !DROPBEAR_MULTI
44 #if defined(DBMULTI_dbclient) && defined(DROPBEAR_MULTI) 44 #if defined(DBMULTI_dbclient) && DROPBEAR_MULTI
45 int cli_main(int argc, char ** argv) { 45 int cli_main(int argc, char ** argv) {
46 #else 46 #else
47 int main(int argc, char ** argv) { 47 int main(int argc, char ** argv) {
48 #endif 48 #endif
49 49
72 if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { 72 if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
73 dropbear_exit("signal() error"); 73 dropbear_exit("signal() error");
74 } 74 }
75 75
76 pid_t proxy_cmd_pid = 0; 76 pid_t proxy_cmd_pid = 0;
77 #ifdef ENABLE_CLI_PROXYCMD 77 #if DROPBEAR_CLI_PROXYCMD
78 if (cli_opts.proxycmd) { 78 if (cli_opts.proxycmd) {
79 cli_proxy_cmd(&sock_in, &sock_out, &proxy_cmd_pid); 79 cli_proxy_cmd(&sock_in, &sock_out, &proxy_cmd_pid);
80 m_free(cli_opts.proxycmd); 80 m_free(cli_opts.proxycmd);
81 if (signal(SIGINT, kill_proxy_sighandler) == SIG_ERR || 81 if (signal(SIGINT, kill_proxy_sighandler) == SIG_ERR ||
82 signal(SIGTERM, kill_proxy_sighandler) == SIG_ERR || 82 signal(SIGTERM, kill_proxy_sighandler) == SIG_ERR ||
149 usershell = m_strdup(get_user_shell()); 149 usershell = m_strdup(get_user_shell());
150 run_shell_command(cmd, ses.maxfd, usershell); 150 run_shell_command(cmd, ses.maxfd, usershell);
151 dropbear_exit("Failed to run '%s'\n", cmd); 151 dropbear_exit("Failed to run '%s'\n", cmd);
152 } 152 }
153 153
154 #ifdef ENABLE_CLI_PROXYCMD 154 #if DROPBEAR_CLI_PROXYCMD
155 static void cli_proxy_cmd(int *sock_in, int *sock_out, pid_t *pid_out) { 155 static void cli_proxy_cmd(int *sock_in, int *sock_out, pid_t *pid_out) {
156 char * ex_cmd = NULL; 156 char * ex_cmd = NULL;
157 size_t ex_cmdlen; 157 size_t ex_cmdlen;
158 int ret; 158 int ret;
159 159
174 174
175 static void kill_proxy_sighandler(int UNUSED(signo)) { 175 static void kill_proxy_sighandler(int UNUSED(signo)) {
176 kill_proxy_command(); 176 kill_proxy_command();
177 _exit(1); 177 _exit(1);
178 } 178 }
179 #endif /* ENABLE_CLI_PROXYCMD */ 179 #endif /* DROPBEAR_CLI_PROXYCMD */