simon-git: putty (master): Simon Tatham
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Wed Mar 6 20:34:38 GMT 2019
TL;DR:
3cb846e7 Factor out term_out's character set translation.
0dcdb1b5 Expose term_translate outside terminal.c.
511eea45 Factor out encode_utf8 from luni_send into utils.c.
e7479000 StripCtrlChars: option to provide a target Terminal.
36a11ef8 Use the new StripCtrlChars for terminal-based auth prompts.
d60dcc2c Add a Seat vtable method to get a stripctrl.
b9c74e84 Use StripCtrlChars to sanitise the SSH banner.
7b489227 Switch console prompt sanitisation to use StripCtrlChars.
d2ddb2fd Remove obsolete sanitise_term_data().
Repository: https://git.tartarus.org/simon/putty.git
On the web: https://git.tartarus.org/?p=simon/putty.git
Branch updated: master
Committer: Simon Tatham <anakin at pobox.com>
Date: 2019-03-06 20:34:38
commit 3cb846e70f4d6235bd3299b265415b0f05ebaa28
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=3cb846e70f4d6235bd3299b265415b0f05ebaa28;hp=deafaa811edfdc3cd753515c17eb2c3574001e91
Author: Simon Tatham <anakin at pobox.com>
Date: Mon Mar 4 20:52:15 2019 +0000
Factor out term_out's character set translation.
I've moved it into a subfunction term_translate(), which I'm about to
reuse elsewhere. No functional change intended.
terminal.c | 290 ++++++++++++++++++++++++++++++++++---------------------------
1 file changed, 162 insertions(+), 128 deletions(-)
commit 0dcdb1b5a35ab120e3b1114d58db42b9420b33d9
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=0dcdb1b5a35ab120e3b1114d58db42b9420b33d9;hp=3cb846e70f4d6235bd3299b265415b0f05ebaa28
Author: Simon Tatham <anakin at pobox.com>
Date: Mon Mar 4 20:53:41 2019 +0000
Expose term_translate outside terminal.c.
Also, instead of insisting on modifying the UTF-8 decoding state
inside the Terminal structure, it now takes a separate pointer to a
small struct containing that decode state. The idea is that if a
separate module wants to decode characters the same way the real
terminal would, it can pass its own mutable state structure, but the
same main Terminal pointer.
defs.h | 1 +
terminal.c | 59 +++++++++++++++++++++++------------------------------------
terminal.h | 27 ++++++++++++++++++++++++---
3 files changed, 48 insertions(+), 39 deletions(-)
commit 511eea450ab2552e9744fe378cee81383cdb5aa7
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=511eea450ab2552e9744fe378cee81383cdb5aa7;hp=0dcdb1b5a35ab120e3b1114d58db42b9420b33d9
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Mar 5 07:24:17 2019 +0000
Factor out encode_utf8 from luni_send into utils.c.
I knew there had to already be a UTF-8 encoder _somewhere_ in this
code base, but it took me a while to find it! Now it's reusable in
other contexts.
ldiscucs.c | 16 +---------------
misc.h | 5 +++++
utils.c | 22 ++++++++++++++++++++++
3 files changed, 28 insertions(+), 15 deletions(-)
commit e74790003c48e44cd62bd67997144832ceb2c52e
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=e74790003c48e44cd62bd67997144832ceb2c52e;hp=511eea450ab2552e9744fe378cee81383cdb5aa7
Author: Simon Tatham <anakin at pobox.com>
Date: Mon Mar 4 20:58:44 2019 +0000
StripCtrlChars: option to provide a target Terminal.
If you use the new stripctrl_new_term() to construct a StripCtrlChars
instead of the existing stripctrl_new(), then the resulting object
will align itself with the character-set configuration of the Terminal
object you point it at. (In fact, it'll reuse the same actual
translation code, courtesy of the last few refactoring commits.) So it
will interpret things as control characters precisely if that Terminal
would also have done so.
The previous locale-based sanitisation is appropriate if you're
sending the sanitised output to an OS terminal device managed outside
this process - the LC_CTYPE setting has the best chance of knowing how
that terminal device will interpret a byte stream. But I want to start
using the same sanitisation system for data intended for PuTTY's own
internal terminal emulator, in which case there's no reason why
LC_CTYPE should be expected to match that terminal's configuration,
and no reason to need it to either since we can check the internal
terminal configuration directly.
One small bodge: stripctrl_new_term() is actually a macro, which
passes in the function pointer term_translate() to the underlying real
constructor. That's just so that console-only tools can link in
stripctrl.c without acquiring a dependency on terminal.c (similarly to
how we pass random_read in to the mp_random functions).
Recipe | 10 ++---
misc.h | 6 +++
stripctrl.c | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------
3 files changed, 134 insertions(+), 17 deletions(-)
commit 36a11ef8d5a07b06c8702bf625531bac8e33aa7c
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=36a11ef8d5a07b06c8702bf625531bac8e33aa7c;hp=e74790003c48e44cd62bd67997144832ceb2c52e
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Mar 5 21:05:35 2019 +0000
Use the new StripCtrlChars for terminal-based auth prompts.
SSH authentication prompts (passwords, passphrases and keyboard-
interactive) were previously sanitised to remove escape sequences by
the simplistic sanitise_term_data() in utils.c. Now they're fed
through the new mode of StripCtrlChars instead, which means they
should permit printable Unicode (if the terminal is in UTF-8 mode)
while still disallowing escape sequences. Hopefully this will be a
usability improvement to everyone whose login prompts are in a
language not representable in plain ASCII.
terminal.c | 6 +++++-
terminal.h | 3 +++
2 files changed, 8 insertions(+), 1 deletion(-)
commit d60dcc2c82f9a38a57a21cb0e422170d4b6db6be
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=d60dcc2c82f9a38a57a21cb0e422170d4b6db6be;hp=36a11ef8d5a07b06c8702bf625531bac8e33aa7c
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Mar 5 21:13:00 2019 +0000
Add a Seat vtable method to get a stripctrl.
If centralised code like the SSH implementation wants to sanitise
escape sequences out of a piece of server-provided text, it will need
to do it by making a locale-based StripCtrlChars if it's running in a
console context, or a Terminal-based one if it's in a GUI terminal-
window application.
All the other changes of behaviour needed between those two contexts
are handled by providing reconfigurable methods in the Seat vtable;
this one is no different. So now there's a new method in the Seat
vtable that will construct a StripCtrlChars appropriate to that kind
of seat. Terminal-window seats (gtkwin.c, window.c) implement it by
calling the new stripctrl_new_term(), and console ones use the locale-
based stripctrl_new().
misc.c | 2 ++
pscp.c | 1 +
psftp.c | 1 +
putty.h | 16 ++++++++++++++++
sesschan.c | 1 +
sshserver.c | 1 +
unix/gtkwin.c | 8 ++++++++
unix/uxcons.c | 6 ++++++
unix/uxplink.c | 1 +
windows/wincons.c | 6 ++++++
windows/window.c | 7 +++++++
windows/winplink.c | 1 +
12 files changed, 51 insertions(+)
commit b9c74e84dc0a547d994d04f708618470b1264316
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=b9c74e84dc0a547d994d04f708618470b1264316;hp=d60dcc2c82f9a38a57a21cb0e422170d4b6db6be
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Mar 5 21:13:48 2019 +0000
Use StripCtrlChars to sanitise the SSH banner.
Now the banner can contain printable Unicode while still having escape
characters removed, in a way that works in both console and GUI
applications.
In the case of SSH banners, ssh2userauth.c does the sanitisation
itself, so it has to use the new Seat method to get an appropriately
configured StripCtrlChars.
(This wasn't an issue for the prompts_t system, because sanitisation
of prompt text is devolved to the local implementation of the prompt
system, in case a local implementation wants to present prompts in a
way that doesn't need sanitisation in any case, e.g. a dialog box.)
ssh2userauth.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
commit 7b489227611470f1ba57dd596ce11d3ba1e1a33b
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=7b489227611470f1ba57dd596ce11d3ba1e1a33b;hp=b9c74e84dc0a547d994d04f708618470b1264316
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Mar 5 21:04:08 2019 +0000
Switch console prompt sanitisation to use StripCtrlChars.
Local functions in uxcons.c and wincons.c were calling the old
simplistic sanitise_term_data to print console-based prompts. Now they
use the same new system as everything else.
This removes the last use of the ASCII-centric sanitise_term_data.
unix/uxcons.c | 7 ++++++-
windows/wincons.c | 7 ++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
commit d2ddb2fdf4f4c0152c9c67425af3c50c80dcf39a
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=d2ddb2fdf4f4c0152c9c67425af3c50c80dcf39a;hp=7b489227611470f1ba57dd596ce11d3ba1e1a33b
Author: Simon Tatham <anakin at pobox.com>
Date: Tue Mar 5 21:13:58 2019 +0000
Remove obsolete sanitise_term_data().
The previous commit removed its last use, so now we can garbage-
collect it, including its long-standing FIXME comment which is now
fulfilled by the new StripCtrlChars system.
misc.h | 2 --
utils.c | 26 --------------------------
2 files changed, 28 deletions(-)
More information about the tartarus-commits
mailing list