Re: User manipulation of tty mode opcodes / IUTF8 incompatibilities

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

 



On Mon, Feb 12, 2018 at 12:40:08AM -0800, Nathan Anderson wrote:
> On Sun, Feb 11, 2018 at 11:27 PM, Darren Tucker <dtucker@xxxxxxxxxxx> wrote:
> 
> > Sigh.  If you could provide the server's identity string (eg from "ssh
> > -v yourthing") we could add a bug bit to stop it from being sent.
> 
> $ ssh -v nathan@10.0.0.1
> OpenSSH_7.4p1, LibreSSL 2.5.0
> 
> [snip]
> 
> debug1: Local version string SSH-2.0-OpenSSH_7.4
> debug1: Remote protocol version 2.0, remote software version ConfD-5.2.2.1
> debug1: no match: ConfD-5.2.2.1

Please try this patch.  It's against -current, it won't apply cleanly
against 7.6p1 and earlier but it should work if you put this at the end
of the list of bug bits insead of the start (we ran out and needed to
start recycling them):

#define SSH_BUG_UTF8TTYMODE 0x80000000

diff --git a/compat.c b/compat.c
index 89b302cc..52975298 100644
--- a/compat.c
+++ b/compat.c
@@ -126,6 +126,8 @@ compat_datafellows(const char *version)
 		  "WinSCP_release_5.7.3,"
 		  "WinSCP_release_5.7.4",
 					SSH_OLD_DHGEX },
+		{ "ConfD-*",
+					SSH_BUG_UTF8TTYMODE },
 		{ NULL,			0 }
 	};
 
diff --git a/compat.h b/compat.h
index 246e6ee4..31afcd12 100644
--- a/compat.h
+++ b/compat.h
@@ -32,7 +32,7 @@
 #define	SSH_PROTO_1_PREFERRED	0x02
 #define	SSH_PROTO_2		0x04
 
-/* #define unused		0x00000001 */
+#define SSH_BUG_UTF8TTYMODE	0x00000001
 /* #define unused		0x00000002 */
 /* #define unused		0x00000004 */
 /* #define unused		0x00000008 */
diff --git a/ttymodes.c b/ttymodes.c
index 84513963..f90708e7 100644
--- a/ttymodes.c
+++ b/ttymodes.c
@@ -56,6 +56,7 @@
 #include "log.h"
 #include "compat.h"
 #include "buffer.h"
+#include "compat.h"
 
 #define TTY_OP_END		0
 /*
@@ -303,14 +304,22 @@ tty_make_modes(int fd, struct termios *tiop)
 	buffer_put_char(&buf, TTY_OP_ISPEED);
 	buffer_put_int(&buf, baud);
 
+#define SSH_TTYMODE_IUTF8 42  /* for SSH_BUG_UTF8TTYMODE */
+
 	/* Store values of mode flags. */
 #define TTYCHAR(NAME, OP) \
-	buffer_put_char(&buf, OP); \
-	buffer_put_int(&buf, special_char_encode(tio.c_cc[NAME]));
+	if (OP == SSH_TTYMODE_IUTF8 && datafellows & SSH_BUG_UTF8TTYMODE) { \
+		debug3("%s: SSH_BUG_UTF8TTYMODE", __func__); \
+	} else { \
+		buffer_put_char(&buf, OP); \
+		buffer_put_int(&buf, special_char_encode(tio.c_cc[NAME])); }
 
 #define TTYMODE(NAME, FIELD, OP) \
-	buffer_put_char(&buf, OP); \
-	buffer_put_int(&buf, ((tio.FIELD & NAME) != 0));
+	if (OP == SSH_TTYMODE_IUTF8 && datafellows & SSH_BUG_UTF8TTYMODE) { \
+		debug3("%s: SSH_BUG_UTF8TTYMODE", __func__); \
+	} else { \
+		buffer_put_char(&buf, OP); \
+		buffer_put_int(&buf, ((tio.FIELD & NAME) != 0)); }
 
 #include "ttymodes.h"
 

-- 
Darren Tucker (dtucker at dtucker.net)
GPG key 11EAA6FA / A86E 3E07 5B19 5880 E860  37F4 9357 ECEF 11EA A6FA (new)
    Good judgement comes with experience. Unfortunately, the experience
usually comes from bad judgement.

_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@xxxxxxxxxxx
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev



[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux