diff options
author | 2008-05-19 15:45:07 +0000 | |
---|---|---|
committer | 2008-05-19 15:45:07 +0000 | |
commit | 31c39feff17f55a90c66210b8bf26c178032a2f8 (patch) | |
tree | 489a659156ee8298b61a15c5ff711254f4d926e4 /usr.bin/ssh/ttymodes.c | |
parent | SO_BINDANY for ipv6; ok djm@ (diff) | |
download | wireguard-openbsd-31c39feff17f55a90c66210b8bf26c178032a2f8.tar.xz wireguard-openbsd-31c39feff17f55a90c66210b8bf26c178032a2f8.zip |
Fix sending tty modes when stdin is not a tty (bz#1199). Previously
we would send the modes corresponding to a zeroed struct termios,
whereas we should have been sending an empty list of modes.
Based on patch from daniel.ritz AT alcatel.ch; ok dtucker@ markus@
Diffstat (limited to 'usr.bin/ssh/ttymodes.c')
-rw-r--r-- | usr.bin/ssh/ttymodes.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/ssh/ttymodes.c b/usr.bin/ssh/ttymodes.c index e7096816d95..3dd43cb9da3 100644 --- a/usr.bin/ssh/ttymodes.c +++ b/usr.bin/ssh/ttymodes.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ttymodes.c,v 1.26 2006/08/03 03:34:42 deraadt Exp $ */ +/* $OpenBSD: ttymodes.c,v 1.27 2008/05/19 15:45:07 djm Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -270,6 +270,10 @@ tty_make_modes(int fd, struct termios *tiop) } if (tiop == NULL) { + if (fd == -1) { + debug("tty_make_modes: no fd or tio"); + goto end; + } if (tcgetattr(fd, &tio) == -1) { logit("tcgetattr: %.100s", strerror(errno)); goto end; @@ -289,12 +293,10 @@ tty_make_modes(int fd, struct termios *tiop) /* Store values of mode flags. */ #define TTYCHAR(NAME, OP) \ - debug3("tty_make_modes: %d %d", OP, tio.c_cc[NAME]); \ buffer_put_char(&buf, OP); \ put_arg(&buf, tio.c_cc[NAME]); #define TTYMODE(NAME, FIELD, OP) \ - debug3("tty_make_modes: %d %d", OP, ((tio.FIELD & NAME) != 0)); \ buffer_put_char(&buf, OP); \ put_arg(&buf, ((tio.FIELD & NAME) != 0)); @@ -382,7 +384,6 @@ tty_parse_modes(int fd, int *n_bytes_ptr) case OP: \ n_bytes += arg_size; \ tio.c_cc[NAME] = get_arg(); \ - debug3("tty_parse_modes: %d %d", OP, tio.c_cc[NAME]); \ break; #define TTYMODE(NAME, FIELD, OP) \ case OP: \ @@ -391,7 +392,6 @@ tty_parse_modes(int fd, int *n_bytes_ptr) tio.FIELD |= NAME; \ else \ tio.FIELD &= ~NAME; \ - debug3("tty_parse_modes: %d %d", OP, arg); \ break; #include "ttymodes.h" |