3.0.1p1 losing tty modes?
michael at moria.de
michael at moria.de
Tue Nov 27 13:35:36 EST 2001
Hello,
openssh-3.0.1p1 appears to transmit and parse tty modes correctly,
but later in the code it uses vhangup() to close all tty references and
reset the tty to default modes. I don't think that vhangup() should be
needed on Unix98 ptys, possibly not even on BSD ptys, and I am probably
wrong, so please tell me where. Of course vhangup() clears all tty modes,
so you need to save them before and restore them to the newly opened
tty afterwards. This is on Linux 2.4.14, but the problem looks quite
portable to me for all systems that have vhangup().
This patch shows my solution, but it's only a hack to me until I know
why vhangup() is needed:
--- sshpty.c.orig Tue Nov 27 02:32:50 2001
+++ sshpty.c Tue Nov 27 02:33:45 2001
@@ -252,6 +252,7 @@
int fd;
#ifdef USE_VHANGUP
void *old;
+ struct termios tio;
#endif /* USE_VHANGUP */
#ifdef _CRAY
@@ -310,6 +311,7 @@
#endif /* HAVE_NEWS4 */
#ifdef USE_VHANGUP
old = mysignal(SIGHUP, SIG_IGN);
+ tcgetattr(*ttyfd,&tio);
vhangup();
mysignal(SIGHUP, old);
#endif /* USE_VHANGUP */
@@ -320,6 +322,7 @@
#ifdef USE_VHANGUP
close(*ttyfd);
*ttyfd = fd;
+ tcsetattr(*ttyfd,TCSANOW,&tio);
#else /* USE_VHANGUP */
close(fd);
#endif /* USE_VHANGUP */
I am not subscribed to the list, so please cc: to me.
Michael
More information about the openssh-unix-dev
mailing list