summaryrefslogtreecommitdiff
path: root/clientloop.c
diff options
context:
space:
mode:
Diffstat (limited to 'clientloop.c')
-rw-r--r--clientloop.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/clientloop.c b/clientloop.c
index 49f9ba1ab..009480ea1 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -59,7 +59,7 @@
59 */ 59 */
60 60
61#include "includes.h" 61#include "includes.h"
62RCSID("$OpenBSD: clientloop.c,v 1.131 2004/09/07 23:41:30 djm Exp $"); 62RCSID("$OpenBSD: clientloop.c,v 1.132 2004/10/29 21:47:15 djm Exp $");
63 63
64#include "ssh.h" 64#include "ssh.h"
65#include "ssh1.h" 65#include "ssh1.h"
@@ -432,8 +432,6 @@ client_wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp,
432static void 432static void
433client_suspend_self(Buffer *bin, Buffer *bout, Buffer *berr) 433client_suspend_self(Buffer *bin, Buffer *bout, Buffer *berr)
434{ 434{
435 struct winsize oldws, newws;
436
437 /* Flush stdout and stderr buffers. */ 435 /* Flush stdout and stderr buffers. */
438 if (buffer_len(bout) > 0) 436 if (buffer_len(bout) > 0)
439 atomicio(vwrite, fileno(stdout), buffer_ptr(bout), buffer_len(bout)); 437 atomicio(vwrite, fileno(stdout), buffer_ptr(bout), buffer_len(bout));
@@ -450,19 +448,11 @@ client_suspend_self(Buffer *bin, Buffer *bout, Buffer *berr)
450 buffer_free(bout); 448 buffer_free(bout);
451 buffer_free(berr); 449 buffer_free(berr);
452 450
453 /* Save old window size. */
454 ioctl(fileno(stdin), TIOCGWINSZ, &oldws);
455
456 /* Send the suspend signal to the program itself. */ 451 /* Send the suspend signal to the program itself. */
457 kill(getpid(), SIGTSTP); 452 kill(getpid(), SIGTSTP);
458 453
459 /* Check if the window size has changed. */ 454 /* Reset window sizes in case they have changed */
460 if (ioctl(fileno(stdin), TIOCGWINSZ, &newws) >= 0 && 455 received_window_change_signal = 1;
461 (oldws.ws_row != newws.ws_row ||
462 oldws.ws_col != newws.ws_col ||
463 oldws.ws_xpixel != newws.ws_xpixel ||
464 oldws.ws_ypixel != newws.ws_ypixel))
465 received_window_change_signal = 1;
466 456
467 /* OK, we have been continued by the user. Reinitialize buffers. */ 457 /* OK, we have been continued by the user. Reinitialize buffers. */
468 buffer_init(bin); 458 buffer_init(bin);
@@ -1204,8 +1194,7 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
1204 signal(SIGQUIT, signal_handler); 1194 signal(SIGQUIT, signal_handler);
1205 if (signal(SIGTERM, SIG_IGN) != SIG_IGN) 1195 if (signal(SIGTERM, SIG_IGN) != SIG_IGN)
1206 signal(SIGTERM, signal_handler); 1196 signal(SIGTERM, signal_handler);
1207 if (have_pty) 1197 signal(SIGWINCH, window_change_handler);
1208 signal(SIGWINCH, window_change_handler);
1209 1198
1210 if (have_pty) 1199 if (have_pty)
1211 enter_raw_mode(); 1200 enter_raw_mode();
@@ -1313,8 +1302,7 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
1313 /* Terminate the session. */ 1302 /* Terminate the session. */
1314 1303
1315 /* Stop watching for window change. */ 1304 /* Stop watching for window change. */
1316 if (have_pty) 1305 signal(SIGWINCH, SIG_DFL);
1317 signal(SIGWINCH, SIG_DFL);
1318 1306
1319 channel_free_all(); 1307 channel_free_all();
1320 1308
@@ -1681,9 +1669,13 @@ client_session2_setup(int id, int want_tty, int want_subsystem,
1681 dispatch_fn *subsys_repl) 1669 dispatch_fn *subsys_repl)
1682{ 1670{
1683 int len; 1671 int len;
1672 Channel *c = NULL;
1684 1673
1685 debug2("%s: id %d", __func__, id); 1674 debug2("%s: id %d", __func__, id);
1686 1675
1676 if ((c = channel_lookup(id)) == NULL)
1677 fatal("client_session2_setup: channel %d: unknown channel", id);
1678
1687 if (want_tty) { 1679 if (want_tty) {
1688 struct winsize ws; 1680 struct winsize ws;
1689 struct termios tio; 1681 struct termios tio;
@@ -1702,6 +1694,7 @@ client_session2_setup(int id, int want_tty, int want_subsystem,
1702 tty_make_modes(-1, tiop != NULL ? tiop : &tio); 1694 tty_make_modes(-1, tiop != NULL ? tiop : &tio);
1703 packet_send(); 1695 packet_send();
1704 /* XXX wait for reply */ 1696 /* XXX wait for reply */
1697 c->client_tty = 1;
1705 } 1698 }
1706 1699
1707 /* Transfer any environment variables from client to server */ 1700 /* Transfer any environment variables from client to server */