From dd39264e4b4fcd5a9fd4141b1f7b10eff09b3f8c Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Sun, 8 Jun 2008 12:53:20 +1000 Subject: - djm@cvs.openbsd.org 2008/05/19 15:45:07 [sshtty.c ttymodes.c sshpty.h] 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@ --- ttymodes.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'ttymodes.c') diff --git a/ttymodes.c b/ttymodes.c index d8e2c553a..d11d00c28 100644 --- a/ttymodes.c +++ b/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 * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -298,6 +298,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; @@ -317,12 +321,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, special_char_encode(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)); @@ -410,7 +412,6 @@ tty_parse_modes(int fd, int *n_bytes_ptr) case OP: \ n_bytes += arg_size; \ tio.c_cc[NAME] = special_char_decode(get_arg()); \ - debug3("tty_parse_modes: %d %d", OP, tio.c_cc[NAME]); \ break; #define TTYMODE(NAME, FIELD, OP) \ case OP: \ @@ -419,7 +420,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" -- cgit v1.2.3 From 2f7faf19d55b8b0f591f86f1c0bd35f527c4b351 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Fri, 11 Jul 2008 17:34:35 +1000 Subject: - stevesk@cvs.openbsd.org 2008/07/07 00:31:41 [ttymodes.c] we don't need arg after the debug3() was removed. from lint. ok djm@ --- ChangeLog | 9 ++++++++- ttymodes.c | 6 +++--- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'ttymodes.c') diff --git a/ChangeLog b/ChangeLog index ca66ddad9..5c451e20a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +20080711 + - (djm) OpenBSD CVS Sync + - stevesk@cvs.openbsd.org 2008/07/07 00:31:41 + [ttymodes.c] + we don't need arg after the debug3() was removed. from lint. + ok djm@ + 20080709 - (djm) [Makefile.in] Print "all tests passed" when all regress tests pass - (djm) [auth1.c] Fix format string vulnerability in protocol 1 PAM @@ -4603,4 +4610,4 @@ OpenServer 6 and add osr5bigcrypt support so when someone migrates passwords between UnixWare and OpenServer they will still work. OK dtucker@ -$Id: ChangeLog,v 1.5069 2008/07/09 11:07:19 djm Exp $ +$Id: ChangeLog,v 1.5070 2008/07/11 07:34:35 djm Exp $ diff --git a/ttymodes.c b/ttymodes.c index d11d00c28..e116b1999 100644 --- a/ttymodes.c +++ b/ttymodes.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ttymodes.c,v 1.27 2008/05/19 15:45:07 djm Exp $ */ +/* $OpenBSD: ttymodes.c,v 1.28 2008/07/07 00:31:41 stevesk Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -355,7 +355,7 @@ tty_parse_modes(int fd, int *n_bytes_ptr) int n_bytes = 0; int failure = 0; u_int (*get_arg)(void); - int arg, arg_size; + int arg_size; if (compat20) { *n_bytes_ptr = packet_get_int(); @@ -416,7 +416,7 @@ tty_parse_modes(int fd, int *n_bytes_ptr) #define TTYMODE(NAME, FIELD, OP) \ case OP: \ n_bytes += arg_size; \ - if ((arg = get_arg())) \ + if (get_arg()) \ tio.FIELD |= NAME; \ else \ tio.FIELD &= ~NAME; \ -- cgit v1.2.3