comparison cli-session.c @ 1318:10e2a7727253 coverity

merge coverity
author Matt Johnston <matt@ucc.asn.au>
date Fri, 22 Jul 2016 00:08:02 +0800
parents 750ec4ec4cbe
children e7f11ed5fe28
comparison
equal deleted inserted replaced
1286:7d02b83c61fd 1318:10e2a7727253
71 {SSH_MSG_USERAUTH_BANNER, recv_msg_userauth_banner}, /* client */ 71 {SSH_MSG_USERAUTH_BANNER, recv_msg_userauth_banner}, /* client */
72 {SSH_MSG_USERAUTH_SPECIFIC_60, recv_msg_userauth_specific_60}, /* client */ 72 {SSH_MSG_USERAUTH_SPECIFIC_60, recv_msg_userauth_specific_60}, /* client */
73 {SSH_MSG_GLOBAL_REQUEST, recv_msg_global_request_cli}, 73 {SSH_MSG_GLOBAL_REQUEST, recv_msg_global_request_cli},
74 {SSH_MSG_CHANNEL_SUCCESS, ignore_recv_response}, 74 {SSH_MSG_CHANNEL_SUCCESS, ignore_recv_response},
75 {SSH_MSG_CHANNEL_FAILURE, ignore_recv_response}, 75 {SSH_MSG_CHANNEL_FAILURE, ignore_recv_response},
76 #ifdef ENABLE_CLI_REMOTETCPFWD 76 #if DROPBEAR_CLI_REMOTETCPFWD
77 {SSH_MSG_REQUEST_SUCCESS, cli_recv_msg_request_success}, /* client */ 77 {SSH_MSG_REQUEST_SUCCESS, cli_recv_msg_request_success}, /* client */
78 {SSH_MSG_REQUEST_FAILURE, cli_recv_msg_request_failure}, /* client */ 78 {SSH_MSG_REQUEST_FAILURE, cli_recv_msg_request_failure}, /* client */
79 #else 79 #else
80 /* For keepalive */ 80 /* For keepalive */
81 {SSH_MSG_REQUEST_SUCCESS, ignore_recv_response}, 81 {SSH_MSG_REQUEST_SUCCESS, ignore_recv_response},
83 #endif 83 #endif
84 {0, 0} /* End */ 84 {0, 0} /* End */
85 }; 85 };
86 86
87 static const struct ChanType *cli_chantypes[] = { 87 static const struct ChanType *cli_chantypes[] = {
88 #ifdef ENABLE_CLI_REMOTETCPFWD 88 #if DROPBEAR_CLI_REMOTETCPFWD
89 &cli_chan_tcpremote, 89 &cli_chan_tcpremote,
90 #endif 90 #endif
91 #ifdef ENABLE_CLI_AGENTFWD 91 #if DROPBEAR_CLI_AGENTFWD
92 &cli_chan_agent, 92 &cli_chan_agent,
93 #endif 93 #endif
94 NULL /* Null termination */ 94 NULL /* Null termination */
95 }; 95 };
96 96
131 131
132 /* Not reached */ 132 /* Not reached */
133 133
134 } 134 }
135 135
136 #ifdef USE_KEX_FIRST_FOLLOWS 136 #if DROPBEAR_KEX_FIRST_FOLLOWS
137 static void cli_send_kex_first_guess() { 137 static void cli_send_kex_first_guess() {
138 send_msg_kexdh_init(); 138 send_msg_kexdh_init();
139 } 139 }
140 #endif 140 #endif
141 141
163 163
164 /* Auth */ 164 /* Auth */
165 cli_ses.lastprivkey = NULL; 165 cli_ses.lastprivkey = NULL;
166 cli_ses.lastauthtype = 0; 166 cli_ses.lastauthtype = 0;
167 167
168 #ifdef DROPBEAR_NONE_CIPHER 168 #if DROPBEAR_NONE_CIPHER
169 cli_ses.cipher_none_after_auth = get_algo_usable(sshciphers, "none"); 169 cli_ses.cipher_none_after_auth = get_algo_usable(sshciphers, "none");
170 set_algo_usable(sshciphers, "none", 0); 170 set_algo_usable(sshciphers, "none", 0);
171 #else 171 #else
172 cli_ses.cipher_none_after_auth = 0; 172 cli_ses.cipher_none_after_auth = 0;
173 #endif 173 #endif
180 /* packet handlers */ 180 /* packet handlers */
181 ses.packettypes = cli_packettypes; 181 ses.packettypes = cli_packettypes;
182 182
183 ses.isserver = 0; 183 ses.isserver = 0;
184 184
185 #ifdef USE_KEX_FIRST_FOLLOWS 185 #if DROPBEAR_KEX_FIRST_FOLLOWS
186 ses.send_kex_first_guess = cli_send_kex_first_guess; 186 ses.send_kex_first_guess = cli_send_kex_first_guess;
187 #endif 187 #endif
188 188
189 } 189 }
190 190
273 if (opts.usingsyslog) { 273 if (opts.usingsyslog) {
274 dropbear_log(LOG_INFO, "Authentication succeeded."); 274 dropbear_log(LOG_INFO, "Authentication succeeded.");
275 } 275 }
276 #endif 276 #endif
277 277
278 #ifdef DROPBEAR_NONE_CIPHER 278 #if DROPBEAR_NONE_CIPHER
279 if (cli_ses.cipher_none_after_auth) 279 if (cli_ses.cipher_none_after_auth)
280 { 280 {
281 set_algo_usable(sshciphers, "none", 1); 281 set_algo_usable(sshciphers, "none", 1);
282 send_msg_kexinit(); 282 send_msg_kexinit();
283 } 283 }
297 dropbear_exit("Backgrounding failed: %d %s", 297 dropbear_exit("Backgrounding failed: %d %s",
298 errno, strerror(errno)); 298 errno, strerror(errno));
299 } 299 }
300 } 300 }
301 301
302 #ifdef ENABLE_CLI_NETCAT 302 #if DROPBEAR_CLI_NETCAT
303 if (cli_opts.netcat_host) { 303 if (cli_opts.netcat_host) {
304 cli_send_netcat_request(); 304 cli_send_netcat_request();
305 } else 305 } else
306 #endif 306 #endif
307 if (!cli_opts.no_cmd) { 307 if (!cli_opts.no_cmd) {
308 cli_send_chansess_request(); 308 cli_send_chansess_request();
309 } 309 }
310 310
311 #ifdef ENABLE_CLI_LOCALTCPFWD 311 #if DROPBEAR_CLI_LOCALTCPFWD
312 setup_localtcp(); 312 setup_localtcp();
313 #endif 313 #endif
314 #ifdef ENABLE_CLI_REMOTETCPFWD 314 #if DROPBEAR_CLI_REMOTETCPFWD
315 setup_remotetcp(); 315 setup_remotetcp();
316 #endif 316 #endif
317 317
318 TRACE(("leave cli_sessionloop: running")) 318 TRACE(("leave cli_sessionloop: running"))
319 cli_ses.state = SESSION_RUNNING; 319 cli_ses.state = SESSION_RUNNING;