diff options
Diffstat (limited to 'clientloop.c')
-rw-r--r-- | clientloop.c | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/clientloop.c b/clientloop.c index ebd0dbca1..da396c72a 100644 --- a/clientloop.c +++ b/clientloop.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: clientloop.c,v 1.340 2020/02/02 09:45:34 dtucker Exp $ */ | 1 | /* $OpenBSD: clientloop.c,v 1.344 2020/04/24 02:19:40 dtucker Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -149,9 +149,6 @@ extern char *forward_agent_sock_path; | |||
149 | static volatile sig_atomic_t received_window_change_signal = 0; | 149 | static volatile sig_atomic_t received_window_change_signal = 0; |
150 | static volatile sig_atomic_t received_signal = 0; | 150 | static volatile sig_atomic_t received_signal = 0; |
151 | 151 | ||
152 | /* Flag indicating whether the user's terminal is in non-blocking mode. */ | ||
153 | static int in_non_blocking_mode = 0; | ||
154 | |||
155 | /* Time when backgrounded control master using ControlPersist should exit */ | 152 | /* Time when backgrounded control master using ControlPersist should exit */ |
156 | static time_t control_persist_exit_time = 0; | 153 | static time_t control_persist_exit_time = 0; |
157 | 154 | ||
@@ -196,17 +193,6 @@ static struct global_confirms global_confirms = | |||
196 | 193 | ||
197 | void ssh_process_session2_setup(int, int, int, struct sshbuf *); | 194 | void ssh_process_session2_setup(int, int, int, struct sshbuf *); |
198 | 195 | ||
199 | /* Restores stdin to blocking mode. */ | ||
200 | |||
201 | static void | ||
202 | leave_non_blocking(void) | ||
203 | { | ||
204 | if (in_non_blocking_mode) { | ||
205 | unset_nonblock(fileno(stdin)); | ||
206 | in_non_blocking_mode = 0; | ||
207 | } | ||
208 | } | ||
209 | |||
210 | /* | 196 | /* |
211 | * Signal handler for the window change signal (SIGWINCH). This just sets a | 197 | * Signal handler for the window change signal (SIGWINCH). This just sets a |
212 | * flag indicating that the window has changed. | 198 | * flag indicating that the window has changed. |
@@ -457,11 +443,8 @@ client_check_window_change(struct ssh *ssh) | |||
457 | { | 443 | { |
458 | if (!received_window_change_signal) | 444 | if (!received_window_change_signal) |
459 | return; | 445 | return; |
460 | /** XXX race */ | ||
461 | received_window_change_signal = 0; | 446 | received_window_change_signal = 0; |
462 | |||
463 | debug2("%s: changed", __func__); | 447 | debug2("%s: changed", __func__); |
464 | |||
465 | channel_send_window_changes(ssh); | 448 | channel_send_window_changes(ssh); |
466 | } | 449 | } |
467 | 450 | ||
@@ -476,8 +459,7 @@ client_global_request_reply(int type, u_int32_t seq, struct ssh *ssh) | |||
476 | gc->cb(ssh, type, seq, gc->ctx); | 459 | gc->cb(ssh, type, seq, gc->ctx); |
477 | if (--gc->ref_count <= 0) { | 460 | if (--gc->ref_count <= 0) { |
478 | TAILQ_REMOVE(&global_confirms, gc, entry); | 461 | TAILQ_REMOVE(&global_confirms, gc, entry); |
479 | explicit_bzero(gc, sizeof(*gc)); | 462 | freezero(gc, sizeof(*gc)); |
480 | free(gc); | ||
481 | } | 463 | } |
482 | 464 | ||
483 | ssh_packet_set_alive_timeouts(ssh, 0); | 465 | ssh_packet_set_alive_timeouts(ssh, 0); |
@@ -1649,7 +1631,7 @@ client_request_agent(struct ssh *ssh, const char *request_type, int rchan) | |||
1649 | 1631 | ||
1650 | char * | 1632 | char * |
1651 | client_request_tun_fwd(struct ssh *ssh, int tun_mode, | 1633 | client_request_tun_fwd(struct ssh *ssh, int tun_mode, |
1652 | int local_tun, int remote_tun) | 1634 | int local_tun, int remote_tun, channel_open_fn *cb, void *cbctx) |
1653 | { | 1635 | { |
1654 | Channel *c; | 1636 | Channel *c; |
1655 | int r, fd; | 1637 | int r, fd; |
@@ -1677,6 +1659,9 @@ client_request_tun_fwd(struct ssh *ssh, int tun_mode, | |||
1677 | sys_tun_outfilter, NULL, NULL); | 1659 | sys_tun_outfilter, NULL, NULL); |
1678 | #endif | 1660 | #endif |
1679 | 1661 | ||
1662 | if (cb != NULL) | ||
1663 | channel_register_open_confirm(ssh, c->self, cb, cbctx); | ||
1664 | |||
1680 | if ((r = sshpkt_start(ssh, SSH2_MSG_CHANNEL_OPEN)) != 0 || | 1665 | if ((r = sshpkt_start(ssh, SSH2_MSG_CHANNEL_OPEN)) != 0 || |
1681 | (r = sshpkt_put_cstring(ssh, "tun@openssh.com")) != 0 || | 1666 | (r = sshpkt_put_cstring(ssh, "tun@openssh.com")) != 0 || |
1682 | (r = sshpkt_put_u32(ssh, c->self)) != 0 || | 1667 | (r = sshpkt_put_u32(ssh, c->self)) != 0 || |
@@ -2459,7 +2444,6 @@ void | |||
2459 | cleanup_exit(int i) | 2444 | cleanup_exit(int i) |
2460 | { | 2445 | { |
2461 | leave_raw_mode(options.request_tty == REQUEST_TTY_FORCE); | 2446 | leave_raw_mode(options.request_tty == REQUEST_TTY_FORCE); |
2462 | leave_non_blocking(); | ||
2463 | if (options.control_path != NULL && muxserver_sock != -1) | 2447 | if (options.control_path != NULL && muxserver_sock != -1) |
2464 | unlink(options.control_path); | 2448 | unlink(options.control_path); |
2465 | ssh_kill_proxy_command(); | 2449 | ssh_kill_proxy_command(); |