1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 01:48:00 +00:00

Uppity: properly support _POSIX_VDISABLE in tty modes.

The SSH wire protocol for tty modes corresponding to control
characters (e.g. configuring what Ctrl-Foo you can press to generate
SIGINT or SIGQUIT) specifies (RFC 4254 section 8, under VINTR, saying
'similarly for the other characters') that you should send the value
255 on the wire if you want _no_ character code to map to the action
in question.

But in the <termios.h> API, that's indicated by setting the
appropriate field of 'struct termios' to _POSIX_VDISABLE, which is a
platform-dependent value and varies between (at least) Linux and *BSD.

On the client side, Unix Plink has always known this: when it copies
the local termios settings into a struct ssh_ttymodes to be sent on
the wire, it checks for _POSIX_VDISABLE and replaces it with 255. But
uxpty.c, mapping ssh_ttymodes back to termios for Uppity's pty
sessions, wasn't making the reverse transformation.
This commit is contained in:
Simon Tatham 2019-01-18 19:14:27 +00:00
parent 53747ad3ab
commit bf743bf85c

View File

@ -817,8 +817,12 @@ static void copy_ttymodes_into_termios(
struct termios *attrs, struct ssh_ttymodes modes)
{
#define TTYMODE_CHAR(name, ssh_opcode, cc_index) { \
if (modes.have_mode[ssh_opcode]) \
attrs->c_cc[cc_index] = modes.mode_val[ssh_opcode]; \
if (modes.have_mode[ssh_opcode]) { \
unsigned value = modes.mode_val[ssh_opcode]; \
/* normalise wire value of 255 to local _POSIX_VDISABLE */ \
attrs->c_cc[cc_index] = (value == 255 ? \
_POSIX_VDISABLE : value); \
} \
}
#define TTYMODE_FLAG(flagval, ssh_opcode, field, flagmask) { \