1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

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.
This commit is contained in:
Simon Tatham 2019-03-05 21:05:35 +00:00
parent e74790003c
commit 36a11ef8d5
2 changed files with 8 additions and 1 deletions

View File

@ -1644,6 +1644,9 @@ Terminal *term_init(Conf *myconf, struct unicode_data *ucsdata, TermWin *win)
term->paste_buffer = NULL;
term->paste_len = 0;
bufchain_init(&term->inbuf);
bufchain_sink_init(&term->inbuf_bs, &term->inbuf);
term->inbuf_scc = stripctrl_new_term(
BinarySink_UPCAST(&term->inbuf_bs), false, 0, term);
bufchain_init(&term->printer_buf);
term->printing = term->only_printing = false;
term->print_job = NULL;
@ -1736,6 +1739,7 @@ void term_free(Terminal *term)
term->beephead = beep->next;
sfree(beep);
}
stripctrl_free(term->inbuf_scc);
bufchain_clear(&term->inbuf);
if(term->print_job)
printer_finish_job(term->print_job);
@ -6775,7 +6779,7 @@ size_t term_data(Terminal *term, bool is_stderr, const void *data, size_t len)
static void term_data_untrusted(Terminal *term, const void *data, size_t len)
{
sanitise_term_data(&term->inbuf, data, len);
put_data(term->inbuf_scc, data, len);
term_added_data(term);
}

View File

@ -100,6 +100,9 @@ struct terminal_tag {
termchar basic_erase_char, erase_char;
bufchain inbuf; /* terminal input buffer */
bufchain_sink inbuf_bs;
StripCtrlChars *inbuf_scc;
pos curs; /* cursor */
pos savecurs; /* saved cursor position */
int marg_t, marg_b; /* scroll margins */