summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordtucker@openbsd.org <dtucker@openbsd.org>2018-02-16 04:43:11 +0000
committerDarren Tucker <dtucker@dtucker.net>2018-02-16 23:25:48 +1100
commit8570177195f6a4b3173c0a25484a83641ee3faa6 (patch)
tree78df7e06034432fcb912b5c9e5f01a6a304a8890
parentf6dc2ba3c9d12be53057b9371f5109ec553a399f (diff)
upstream: Don't send IUTF8 to servers that don't like them.
Some SSH servers eg "ConfD" drop the connection if the client sends the new IUTF8 (RFC8160) terminal mode even if it's not set. Add a bug bit for such servers and avoid sending IUTF8 to them. ok djm@ OpenBSD-Commit-ID: 26425855402d870c3c0a90491e72e2a8a342ceda
-rw-r--r--compat.c4
-rw-r--r--compat.h4
-rw-r--r--ttymodes.c13
3 files changed, 15 insertions, 6 deletions
diff --git a/compat.c b/compat.c
index 89b302cca..861e9e21f 100644
--- a/compat.c
+++ b/compat.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: compat.c,v 1.105 2018/01/23 05:27:21 djm Exp $ */ 1/* $OpenBSD: compat.c,v 1.106 2018/02/16 04:43:11 dtucker Exp $ */
2/* 2/*
3 * Copyright (c) 1999, 2000, 2001, 2002 Markus Friedl. All rights reserved. 3 * Copyright (c) 1999, 2000, 2001, 2002 Markus Friedl. All rights reserved.
4 * 4 *
@@ -126,6 +126,8 @@ compat_datafellows(const char *version)
126 "WinSCP_release_5.7.3," 126 "WinSCP_release_5.7.3,"
127 "WinSCP_release_5.7.4", 127 "WinSCP_release_5.7.4",
128 SSH_OLD_DHGEX }, 128 SSH_OLD_DHGEX },
129 { "ConfD-*",
130 SSH_BUG_UTF8TTYMODE },
129 { NULL, 0 } 131 { NULL, 0 }
130 }; 132 };
131 133
diff --git a/compat.h b/compat.h
index 246e6ee4c..4fee3495a 100644
--- a/compat.h
+++ b/compat.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: compat.h,v 1.50 2018/01/23 05:27:21 djm Exp $ */ 1/* $OpenBSD: compat.h,v 1.51 2018/02/16 04:43:11 dtucker Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1999, 2000, 2001 Markus Friedl. All rights reserved. 4 * Copyright (c) 1999, 2000, 2001 Markus Friedl. All rights reserved.
@@ -32,7 +32,7 @@
32#define SSH_PROTO_1_PREFERRED 0x02 32#define SSH_PROTO_1_PREFERRED 0x02
33#define SSH_PROTO_2 0x04 33#define SSH_PROTO_2 0x04
34 34
35/* #define unused 0x00000001 */ 35#define SSH_BUG_UTF8TTYMODE 0x00000001
36/* #define unused 0x00000002 */ 36/* #define unused 0x00000002 */
37/* #define unused 0x00000004 */ 37/* #define unused 0x00000004 */
38/* #define unused 0x00000008 */ 38/* #define unused 0x00000008 */
diff --git a/ttymodes.c b/ttymodes.c
index 845139635..f9fdb92de 100644
--- a/ttymodes.c
+++ b/ttymodes.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ttymodes.c,v 1.32 2017/04/30 23:26:54 djm Exp $ */ 1/* $OpenBSD: ttymodes.c,v 1.33 2018/02/16 04:43:11 dtucker Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -56,6 +56,7 @@
56#include "log.h" 56#include "log.h"
57#include "compat.h" 57#include "compat.h"
58#include "buffer.h" 58#include "buffer.h"
59#include "compat.h"
59 60
60#define TTY_OP_END 0 61#define TTY_OP_END 0
61/* 62/*
@@ -308,9 +309,15 @@ tty_make_modes(int fd, struct termios *tiop)
308 buffer_put_char(&buf, OP); \ 309 buffer_put_char(&buf, OP); \
309 buffer_put_int(&buf, special_char_encode(tio.c_cc[NAME])); 310 buffer_put_int(&buf, special_char_encode(tio.c_cc[NAME]));
310 311
312#define SSH_TTYMODE_IUTF8 42 /* for SSH_BUG_UTF8TTYMODE */
313
311#define TTYMODE(NAME, FIELD, OP) \ 314#define TTYMODE(NAME, FIELD, OP) \
312 buffer_put_char(&buf, OP); \ 315 if (OP == SSH_TTYMODE_IUTF8 && (datafellows & SSH_BUG_UTF8TTYMODE)) { \
313 buffer_put_int(&buf, ((tio.FIELD & NAME) != 0)); 316 debug3("%s: SSH_BUG_UTF8TTYMODE", __func__); \
317 } else { \
318 buffer_put_char(&buf, OP); \
319 buffer_put_int(&buf, ((tio.FIELD & NAME) != 0)); \
320 }
314 321
315#include "ttymodes.h" 322#include "ttymodes.h"
316 323