Skip to content

Commit aebd0ab

Browse files
committed
upstream commit
purge the last traces of SSHv1 from the TTY modes handling code ok markus Upstream-ID: 963a19f1e06577377c38a3b7ce468f121b966195
1 parent dfa641f commit aebd0ab

File tree

2 files changed

+14
-32
lines changed

2 files changed

+14
-32
lines changed

ttymodes.c

+8-17
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: ttymodes.c,v 1.31 2017/04/30 23:13:25 djm Exp $ */
1+
/* $OpenBSD: ttymodes.c,v 1.32 2017/04/30 23:26:54 djm Exp $ */
22
/*
33
* Author: Tatu Ylonen <[email protected]>
44
* Copyright (c) 1995 Tatu Ylonen <[email protected]>, Espoo, Finland
@@ -59,12 +59,10 @@
5959

6060
#define TTY_OP_END 0
6161
/*
62-
* uint32 (u_int) follows speed in SSH1 and SSH2
62+
* uint32 (u_int) follows speed.
6363
*/
64-
#define TTY_OP_ISPEED_PROTO1 192
65-
#define TTY_OP_OSPEED_PROTO1 193
66-
#define TTY_OP_ISPEED_PROTO2 128
67-
#define TTY_OP_OSPEED_PROTO2 129
64+
#define TTY_OP_ISPEED 128
65+
#define TTY_OP_OSPEED 129
6866

6967
/*
7068
* Converts POSIX speed_t to a baud rate. The values of the
@@ -282,11 +280,8 @@ tty_make_modes(int fd, struct termios *tiop)
282280
struct termios tio;
283281
int baud;
284282
Buffer buf;
285-
int tty_op_ospeed, tty_op_ispeed;
286283

287284
buffer_init(&buf);
288-
tty_op_ospeed = TTY_OP_OSPEED_PROTO2;
289-
tty_op_ispeed = TTY_OP_ISPEED_PROTO2;
290285

291286
if (tiop == NULL) {
292287
if (fd == -1) {
@@ -302,10 +297,10 @@ tty_make_modes(int fd, struct termios *tiop)
302297

303298
/* Store input and output baud rates. */
304299
baud = speed_to_baud(cfgetospeed(&tio));
305-
buffer_put_char(&buf, tty_op_ospeed);
300+
buffer_put_char(&buf, TTY_OP_OSPEED);
306301
buffer_put_int(&buf, baud);
307302
baud = speed_to_baud(cfgetispeed(&tio));
308-
buffer_put_char(&buf, tty_op_ispeed);
303+
buffer_put_char(&buf, TTY_OP_ISPEED);
309304
buffer_put_int(&buf, baud);
310305

311306
/* Store values of mode flags. */
@@ -362,19 +357,15 @@ tty_parse_modes(int fd, int *n_bytes_ptr)
362357
case TTY_OP_END:
363358
goto set;
364359

365-
/* XXX: future conflict possible */
366-
case TTY_OP_ISPEED_PROTO1:
367-
case TTY_OP_ISPEED_PROTO2:
360+
case TTY_OP_ISPEED:
368361
n_bytes += 4;
369362
baud = packet_get_int();
370363
if (failure != -1 &&
371364
cfsetispeed(&tio, baud_to_speed(baud)) == -1)
372365
error("cfsetispeed failed for %d", baud);
373366
break;
374367

375-
/* XXX: future conflict possible */
376-
case TTY_OP_OSPEED_PROTO1:
377-
case TTY_OP_OSPEED_PROTO2:
368+
case TTY_OP_OSPEED:
378369
n_bytes += 4;
379370
baud = packet_get_int();
380371
if (failure != -1 &&

ttymodes.h

+6-15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: ttymodes.h,v 1.15 2016/05/03 09:03:49 dtucker Exp $ */
1+
/* $OpenBSD: ttymodes.h,v 1.16 2017/04/30 23:26:54 djm Exp $ */
22

33
/*
44
* Author: Tatu Ylonen <[email protected]>
@@ -38,22 +38,13 @@
3838
*/
3939

4040
/*
41-
* SSH1:
42-
* The tty mode description is a stream of bytes. The stream consists of
41+
* The tty mode description is a string, consisting of
4342
* opcode-arguments pairs. It is terminated by opcode TTY_OP_END (0).
44-
* Opcodes 1-127 have one-byte arguments. Opcodes 128-159 have integer
45-
* arguments. Opcodes 160-255 are not yet defined, and cause parsing to
46-
* stop (they should only be used after any other data).
43+
* Opcodes 1-159 have uint32 arguments.
44+
* Opcodes 160-255 are not yet defined and cause parsing to stop (they
45+
* should only be used after any other data).
4746
*
48-
* SSH2:
49-
* Differences between SSH1 and SSH2 terminal mode encoding include:
50-
* 1. Encoded terminal modes are represented as a string, and a stream
51-
* of bytes within that string.
52-
* 2. Opcode arguments are uint32 (1-159); 160-255 remain undefined.
53-
* 3. The values for TTY_OP_ISPEED and TTY_OP_OSPEED are different;
54-
* 128 and 129 vs. 192 and 193 respectively.
55-
*
56-
* The client puts in the stream any modes it knows about, and the
47+
* The client puts in the string any modes it knows about, and the
5748
* server ignores any modes it does not know about. This allows some degree
5849
* of machine-independence, at least between systems that use a posix-like
5950
* tty interface. The protocol can support other systems as well, but might

0 commit comments

Comments
 (0)