summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2008-06-08 12:53:20 +1000
committerDarren Tucker <dtucker@zip.com.au>2008-06-08 12:53:20 +1000
commitdd39264e4b4fcd5a9fd4141b1f7b10eff09b3f8c (patch)
tree0430fcc66e198ba19cf1039fe6bc5b488bb65344
parent136e56f68967fd39e8868769f3af316f1cca0559 (diff)
downloadopenssh-git-dd39264e4b4fcd5a9fd4141b1f7b10eff09b3f8c.tar.gz
- 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@
-rw-r--r--ChangeLog8
-rw-r--r--sshpty.h4
-rw-r--r--sshtty.c6
-rw-r--r--ttymodes.c10
4 files changed, 17 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index e911254e..0695b672 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,12 @@
- (dtucker) OpenBSD CVS Sync
- djm@cvs.openbsd.org 2008/05/19 06:14:02
[packet.c] unbreak protocol keepalive timeouts bz#1465; ok dtucker@
+ - 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@
20080604
- (djm) [openbsd-compat/bsd-arc4random.c] Fix math bug that caused bias
@@ -4036,4 +4042,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.4939 2008/06/08 02:49:30 dtucker Exp $
+$Id: ChangeLog,v 1.4940 2008/06/08 02:53:20 dtucker Exp $
diff --git a/sshpty.h b/sshpty.h
index 7fac622d..ac900358 100644
--- a/sshpty.h
+++ b/sshpty.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshpty.h,v 1.10 2006/08/03 03:34:42 deraadt Exp $ */
+/* $OpenBSD: sshpty.h,v 1.11 2008/05/19 15:45:07 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -16,7 +16,7 @@
#include <termios.h>
-struct termios get_saved_tio(void);
+struct termios *get_saved_tio(void);
void leave_raw_mode(void);
void enter_raw_mode(void);
diff --git a/sshtty.c b/sshtty.c
index 04567669..21ade4e5 100644
--- a/sshtty.c
+++ b/sshtty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshtty.c,v 1.12 2006/08/03 03:34:42 deraadt Exp $ */
+/* $OpenBSD: sshtty.c,v 1.13 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
@@ -47,10 +47,10 @@
static struct termios _saved_tio;
static int _in_raw_mode = 0;
-struct termios
+struct termios *
get_saved_tio(void)
{
- return _saved_tio;
+ return _in_raw_mode ? &_saved_tio : NULL;
}
void
diff --git a/ttymodes.c b/ttymodes.c
index d8e2c553..d11d00c2 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 <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, 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"