]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream commit
authordjm@openbsd.org <djm@openbsd.org>
Sun, 30 Apr 2017 23:26:54 +0000 (23:26 +0000)
committerDamien Miller <djm@mindrot.org>
Mon, 1 May 2017 00:05:04 +0000 (10:05 +1000)
purge the last traces of SSHv1 from the TTY modes
handling code

ok markus

Upstream-ID: 963a19f1e06577377c38a3b7ce468f121b966195

ttymodes.c
ttymodes.h

index 2fc783b2f75d367f0e304959f76cf4d84d4755f0..8451396353c9e4dce69a5c08c76fd45774a10f07 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: ttymodes.c,v 1.31 2017/04/30 23:13:25 djm Exp $ */
+/* $OpenBSD: ttymodes.c,v 1.32 2017/04/30 23:26:54 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
 
 #define TTY_OP_END             0
 /*
- * uint32 (u_int) follows speed in SSH1 and SSH2
+ * uint32 (u_int) follows speed.
  */
-#define TTY_OP_ISPEED_PROTO1   192
-#define TTY_OP_OSPEED_PROTO1   193
-#define TTY_OP_ISPEED_PROTO2   128
-#define TTY_OP_OSPEED_PROTO2   129
+#define TTY_OP_ISPEED  128
+#define TTY_OP_OSPEED  129
 
 /*
  * Converts POSIX speed_t to a baud rate.  The values of the
@@ -282,11 +280,8 @@ tty_make_modes(int fd, struct termios *tiop)
        struct termios tio;
        int baud;
        Buffer buf;
-       int tty_op_ospeed, tty_op_ispeed;
 
        buffer_init(&buf);
-       tty_op_ospeed = TTY_OP_OSPEED_PROTO2;
-       tty_op_ispeed = TTY_OP_ISPEED_PROTO2;
 
        if (tiop == NULL) {
                if (fd == -1) {
@@ -302,10 +297,10 @@ tty_make_modes(int fd, struct termios *tiop)
 
        /* Store input and output baud rates. */
        baud = speed_to_baud(cfgetospeed(&tio));
-       buffer_put_char(&buf, tty_op_ospeed);
+       buffer_put_char(&buf, TTY_OP_OSPEED);
        buffer_put_int(&buf, baud);
        baud = speed_to_baud(cfgetispeed(&tio));
-       buffer_put_char(&buf, tty_op_ispeed);
+       buffer_put_char(&buf, TTY_OP_ISPEED);
        buffer_put_int(&buf, baud);
 
        /* Store values of mode flags. */
@@ -362,9 +357,7 @@ tty_parse_modes(int fd, int *n_bytes_ptr)
                case TTY_OP_END:
                        goto set;
 
-               /* XXX: future conflict possible */
-               case TTY_OP_ISPEED_PROTO1:
-               case TTY_OP_ISPEED_PROTO2:
+               case TTY_OP_ISPEED:
                        n_bytes += 4;
                        baud = packet_get_int();
                        if (failure != -1 &&
@@ -372,9 +365,7 @@ tty_parse_modes(int fd, int *n_bytes_ptr)
                                error("cfsetispeed failed for %d", baud);
                        break;
 
-               /* XXX: future conflict possible */
-               case TTY_OP_OSPEED_PROTO1:
-               case TTY_OP_OSPEED_PROTO2:
+               case TTY_OP_OSPEED:
                        n_bytes += 4;
                        baud = packet_get_int();
                        if (failure != -1 &&
index 14e177cefc31cb838992d7e21ad75182073fe78b..24f07560c9fdcb5af02b4bc5d22ced253d414112 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: ttymodes.h,v 1.15 2016/05/03 09:03:49 dtucker Exp $ */
+/* $OpenBSD: ttymodes.h,v 1.16 2017/04/30 23:26:54 djm Exp $ */
 
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  */
 
 /*
- * SSH1:
- * The tty mode description is a stream of bytes.  The stream consists of
+ * The tty mode description is a string, consisting of
  * opcode-arguments pairs.  It is terminated by opcode TTY_OP_END (0).
- * Opcodes 1-127 have one-byte arguments.  Opcodes 128-159 have integer
- * arguments.  Opcodes 160-255 are not yet defined, and cause parsing to
- * stop (they should only be used after any other data).
+ * Opcodes 1-159 have uint32 arguments.
+ * Opcodes 160-255 are not yet defined and cause parsing to stop (they
+ * should only be used after any other data).
  *
- * SSH2:
- * Differences between SSH1 and SSH2 terminal mode encoding include:
- * 1. Encoded terminal modes are represented as a string, and a stream
- *    of bytes within that string.
- * 2. Opcode arguments are uint32 (1-159); 160-255 remain undefined.
- * 3. The values for TTY_OP_ISPEED and TTY_OP_OSPEED are different;
- *    128 and 129 vs. 192 and 193 respectively.
- *
- * The client puts in the stream any modes it knows about, and the
+ * The client puts in the string any modes it knows about, and the
  * server ignores any modes it does not know about.  This allows some degree
  * of machine-independence, at least between systems that use a posix-like
  * tty interface.  The protocol can support other systems as well, but might