summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2004-11-05 20:35:44 +1100
committerDarren Tucker <dtucker@zip.com.au>2004-11-05 20:35:44 +1100
commit5d78de628376f55fd2fc5acad14733cf90867425 (patch)
tree806ff3f561b6251fe8ac13a23975ac208c09d514
parentb2694f0e8a54112200f2638f01b622f603dd125f (diff)
- djm@cvs.openbsd.org 2004/10/29 21:47:15
[channels.c channels.h clientloop.c] fix some window size change bugs for multiplexed connections: windows sizes were not being updated if they had changed after ~^Z suspends and SIGWINCH was not being processed unless the first connection had requested a tty; ok markus
-rw-r--r--ChangeLog8
-rw-r--r--channels.c4
-rw-r--r--channels.h3
-rw-r--r--clientloop.c27
4 files changed, 21 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index 19671a05e..02892cc61 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -45,6 +45,12 @@
45 - markus@cvs.openbsd.org 2004/10/20 11:48:53 45 - markus@cvs.openbsd.org 2004/10/20 11:48:53
46 [packet.c ssh1.h] 46 [packet.c ssh1.h]
47 disconnect for invalid (out of range) message types. 47 disconnect for invalid (out of range) message types.
48 - djm@cvs.openbsd.org 2004/10/29 21:47:15
49 [channels.c channels.h clientloop.c]
50 fix some window size change bugs for multiplexed connections: windows sizes
51 were not being updated if they had changed after ~^Z suspends and SIGWINCH
52 was not being processed unless the first connection had requested a tty;
53 ok markus
48 54
4920041102 5520041102
50 - (dtucker) [configure.ac includes.h] Bug #947: Fix compile error on HP-UX 56 - (dtucker) [configure.ac includes.h] Bug #947: Fix compile error on HP-UX
@@ -1824,4 +1830,4 @@
1824 - (djm) Trim deprecated options from INSTALL. Mention UsePAM 1830 - (djm) Trim deprecated options from INSTALL. Mention UsePAM
1825 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu 1831 - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
1826 1832
1827$Id: ChangeLog,v 1.3574 2004/11/05 09:27:54 dtucker Exp $ 1833$Id: ChangeLog,v 1.3575 2004/11/05 09:35:44 dtucker Exp $
diff --git a/channels.c b/channels.c
index ac35293d4..8550e51ca 100644
--- a/channels.c
+++ b/channels.c
@@ -39,7 +39,7 @@
39 */ 39 */
40 40
41#include "includes.h" 41#include "includes.h"
42RCSID("$OpenBSD: channels.c,v 1.210 2004/08/23 11:48:47 djm Exp $"); 42RCSID("$OpenBSD: channels.c,v 1.211 2004/10/29 21:47:15 djm Exp $");
43 43
44#include "ssh.h" 44#include "ssh.h"
45#include "ssh1.h" 45#include "ssh1.h"
@@ -2577,7 +2577,7 @@ channel_send_window_changes(void)
2577 struct winsize ws; 2577 struct winsize ws;
2578 2578
2579 for (i = 0; i < channels_alloc; i++) { 2579 for (i = 0; i < channels_alloc; i++) {
2580 if (channels[i] == NULL || 2580 if (channels[i] == NULL || !channels[i]->client_tty ||
2581 channels[i]->type != SSH_CHANNEL_OPEN) 2581 channels[i]->type != SSH_CHANNEL_OPEN)
2582 continue; 2582 continue;
2583 if (ioctl(channels[i]->rfd, TIOCGWINSZ, &ws) < 0) 2583 if (ioctl(channels[i]->rfd, TIOCGWINSZ, &ws) < 0)
diff --git a/channels.h b/channels.h
index f8dc8249c..c47de55c0 100644
--- a/channels.h
+++ b/channels.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: channels.h,v 1.74 2004/08/11 21:43:04 avsm Exp $ */ 1/* $OpenBSD: channels.h,v 1.75 2004/10/29 21:47:15 djm Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -79,6 +79,7 @@ struct Channel {
79 int ctl_fd; /* control fd (client sharing) */ 79 int ctl_fd; /* control fd (client sharing) */
80 int isatty; /* rfd is a tty */ 80 int isatty; /* rfd is a tty */
81 int wfd_isatty; /* wfd is a tty */ 81 int wfd_isatty; /* wfd is a tty */
82 int client_tty; /* (client) TTY has been requested */
82 int force_drain; /* force close on iEOF */ 83 int force_drain; /* force close on iEOF */
83 int delayed; /* fdset hack */ 84 int delayed; /* fdset hack */
84 Buffer input; /* data read from socket, to be sent over 85 Buffer input; /* data read from socket, to be sent over
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 */