summaryrefslogtreecommitdiff
path: root/clientloop.c
diff options
context:
space:
mode:
Diffstat (limited to 'clientloop.c')
-rw-r--r--clientloop.c28
1 files changed, 6 insertions, 22 deletions
diff --git a/clientloop.c b/clientloop.c
index 1bdac6a46..42ace7789 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
@@ -153,9 +153,6 @@ extern char *forward_agent_sock_path;
153static volatile sig_atomic_t received_window_change_signal = 0; 153static volatile sig_atomic_t received_window_change_signal = 0;
154static volatile sig_atomic_t received_signal = 0; 154static volatile sig_atomic_t received_signal = 0;
155 155
156/* Flag indicating whether the user's terminal is in non-blocking mode. */
157static int in_non_blocking_mode = 0;
158
159/* Time when backgrounded control master using ControlPersist should exit */ 156/* Time when backgrounded control master using ControlPersist should exit */
160static time_t control_persist_exit_time = 0; 157static time_t control_persist_exit_time = 0;
161 158
@@ -200,17 +197,6 @@ static struct global_confirms global_confirms =
200 197
201void ssh_process_session2_setup(int, int, int, struct sshbuf *); 198void ssh_process_session2_setup(int, int, int, struct sshbuf *);
202 199
203/* Restores stdin to blocking mode. */
204
205static void
206leave_non_blocking(void)
207{
208 if (in_non_blocking_mode) {
209 unset_nonblock(fileno(stdin));
210 in_non_blocking_mode = 0;
211 }
212}
213
214/* 200/*
215 * Signal handler for the window change signal (SIGWINCH). This just sets a 201 * Signal handler for the window change signal (SIGWINCH). This just sets a
216 * flag indicating that the window has changed. 202 * flag indicating that the window has changed.
@@ -461,11 +447,8 @@ client_check_window_change(struct ssh *ssh)
461{ 447{
462 if (!received_window_change_signal) 448 if (!received_window_change_signal)
463 return; 449 return;
464 /** XXX race */
465 received_window_change_signal = 0; 450 received_window_change_signal = 0;
466
467 debug2("%s: changed", __func__); 451 debug2("%s: changed", __func__);
468
469 channel_send_window_changes(ssh); 452 channel_send_window_changes(ssh);
470} 453}
471 454
@@ -480,8 +463,7 @@ client_global_request_reply(int type, u_int32_t seq, struct ssh *ssh)
480 gc->cb(ssh, type, seq, gc->ctx); 463 gc->cb(ssh, type, seq, gc->ctx);
481 if (--gc->ref_count <= 0) { 464 if (--gc->ref_count <= 0) {
482 TAILQ_REMOVE(&global_confirms, gc, entry); 465 TAILQ_REMOVE(&global_confirms, gc, entry);
483 explicit_bzero(gc, sizeof(*gc)); 466 freezero(gc, sizeof(*gc));
484 free(gc);
485 } 467 }
486 468
487 ssh_packet_set_alive_timeouts(ssh, 0); 469 ssh_packet_set_alive_timeouts(ssh, 0);
@@ -1662,7 +1644,7 @@ client_request_agent(struct ssh *ssh, const char *request_type, int rchan)
1662 1644
1663char * 1645char *
1664client_request_tun_fwd(struct ssh *ssh, int tun_mode, 1646client_request_tun_fwd(struct ssh *ssh, int tun_mode,
1665 int local_tun, int remote_tun) 1647 int local_tun, int remote_tun, channel_open_fn *cb, void *cbctx)
1666{ 1648{
1667 Channel *c; 1649 Channel *c;
1668 int r, fd; 1650 int r, fd;
@@ -1690,6 +1672,9 @@ client_request_tun_fwd(struct ssh *ssh, int tun_mode,
1690 sys_tun_outfilter, NULL, NULL); 1672 sys_tun_outfilter, NULL, NULL);
1691#endif 1673#endif
1692 1674
1675 if (cb != NULL)
1676 channel_register_open_confirm(ssh, c->self, cb, cbctx);
1677
1693 if ((r = sshpkt_start(ssh, SSH2_MSG_CHANNEL_OPEN)) != 0 || 1678 if ((r = sshpkt_start(ssh, SSH2_MSG_CHANNEL_OPEN)) != 0 ||
1694 (r = sshpkt_put_cstring(ssh, "tun@openssh.com")) != 0 || 1679 (r = sshpkt_put_cstring(ssh, "tun@openssh.com")) != 0 ||
1695 (r = sshpkt_put_u32(ssh, c->self)) != 0 || 1680 (r = sshpkt_put_u32(ssh, c->self)) != 0 ||
@@ -2472,7 +2457,6 @@ void
2472cleanup_exit(int i) 2457cleanup_exit(int i)
2473{ 2458{
2474 leave_raw_mode(options.request_tty == REQUEST_TTY_FORCE); 2459 leave_raw_mode(options.request_tty == REQUEST_TTY_FORCE);
2475 leave_non_blocking();
2476 if (options.control_path != NULL && muxserver_sock != -1) 2460 if (options.control_path != NULL && muxserver_sock != -1)
2477 unlink(options.control_path); 2461 unlink(options.control_path);
2478 ssh_kill_proxy_command(); 2462 ssh_kill_proxy_command();