diff --git a/misc.c b/misc.c index 30b7c7d3..236938af 100644 --- a/misc.c +++ b/misc.c @@ -334,7 +334,7 @@ bool nullseat_get_windowid(Seat *seat, long *id_out) { return false; } bool nullseat_get_window_pixel_size( Seat *seat, int *width, int *height) { return false; } StripCtrlChars *nullseat_stripctrl_new( - Seat *seat, BinarySink *bs, bool cr, wchar_t sub) { return NULL; } + Seat *seat, BinarySink *bs_out, SeatInteractionContext sic) {return NULL;} void sk_free_peer_info(SocketPeerInfo *pi) { diff --git a/putty.h b/putty.h index a721a498..fc67be99 100644 --- a/putty.h +++ b/putty.h @@ -740,6 +740,10 @@ typedef enum BusyStatus { * suspended */ } BusyStatus; +typedef enum SeatInteractionContext { + SIC_BANNER, SIC_KI_PROMPTS +} SeatInteractionContext; + /* * Data type 'Seat', which is an API intended to contain essentially * everything that a back end might need to talk to its client for: @@ -937,8 +941,8 @@ struct SeatVtable { * user of this seat. May return NULL if no sanitisation is * needed. */ - StripCtrlChars *(*stripctrl_new)(Seat *seat, BinarySink *bs_out, - bool permit_cr, wchar_t substitution); + StripCtrlChars *(*stripctrl_new)( + Seat *seat, BinarySink *bs_out, SeatInteractionContext sic); }; static inline size_t seat_output( @@ -980,8 +984,8 @@ static inline bool seat_get_windowid(Seat *seat, long *id_out) static inline bool seat_get_window_pixel_size(Seat *seat, int *w, int *h) { return seat->vt->get_window_pixel_size(seat, w, h); } static inline StripCtrlChars *seat_stripctrl_new( - Seat *seat, BinarySink *bs, bool cr, wchar_t sub) -{ return seat->vt->stripctrl_new(seat, bs, cr, sub); } + Seat *seat, BinarySink *bs, SeatInteractionContext sic) +{ return seat->vt->stripctrl_new(seat, bs, sic); } /* Unlike the seat's actual method, the public entry point * seat_connection_fatal is a wrapper function with a printf-like API, @@ -1030,8 +1034,8 @@ void nullseat_echoedit_update(Seat *seat, bool echoing, bool editing); const char *nullseat_get_x_display(Seat *seat); bool nullseat_get_windowid(Seat *seat, long *id_out); bool nullseat_get_window_pixel_size(Seat *seat, int *width, int *height); -StripCtrlChars *nullseat_stripctrl_new(Seat *seat, BinarySink *bs_out, - bool permit_cr, wchar_t substitution); +StripCtrlChars *nullseat_stripctrl_new( + Seat *seat, BinarySink *bs_out, SeatInteractionContext sic); /* * Seat functions provided by the platform's console-application @@ -1049,8 +1053,8 @@ int console_confirm_weak_crypto_primitive( int console_confirm_weak_cached_hostkey( Seat *seat, const char *algname, const char *betteralgs, void (*callback)(void *ctx, int result), void *ctx); -StripCtrlChars *console_stripctrl_new(Seat *seat, BinarySink *bs_out, - bool permit_cr, wchar_t substitution); +StripCtrlChars *console_stripctrl_new( + Seat *seat, BinarySink *bs_out, SeatInteractionContext sic); /* * Other centralised seat functions. diff --git a/ssh2userauth.c b/ssh2userauth.c index dd16009d..3586171c 100644 --- a/ssh2userauth.c +++ b/ssh2userauth.c @@ -190,7 +190,7 @@ static void ssh2_userauth_filter_queue(struct ssh2_userauth_state *s) string.len = BANNER_LIMIT - bufchain_size(&s->banner); if (!s->banner_scc_initialised) { s->banner_scc = seat_stripctrl_new( - s->ppl.seat, BinarySink_UPCAST(&s->banner_bs), false, 0); + s->ppl.seat, BinarySink_UPCAST(&s->banner_bs), SIC_BANNER); s->banner_scc_initialised = true; } if (s->banner_scc) diff --git a/unix/gtkwin.c b/unix/gtkwin.c index 2728436e..f954279f 100644 --- a/unix/gtkwin.c +++ b/unix/gtkwin.c @@ -351,11 +351,11 @@ static bool gtk_seat_get_window_pixel_size(Seat *seat, int *w, int *h) return true; } -StripCtrlChars *gtk_seat_stripctrl_new(Seat *seat, BinarySink *bs_out, - bool permit_cr, wchar_t substitution) +StripCtrlChars *gtk_seat_stripctrl_new( + Seat *seat, BinarySink *bs_out, SeatInteractionContext sic) { GtkFrontend *inst = container_of(seat, GtkFrontend, seat); - return stripctrl_new_term(bs_out, permit_cr, substitution, inst->term); + return stripctrl_new_term(bs_out, false, 0, inst->term); } static void gtk_seat_notify_remote_exit(Seat *seat); diff --git a/unix/uxcons.c b/unix/uxcons.c index f09ccbd0..f57ac26f 100644 --- a/unix/uxcons.c +++ b/unix/uxcons.c @@ -465,10 +465,10 @@ static void console_eventlog(LogPolicy *lp, const char *string) console_logging_error(lp, string); } -StripCtrlChars *console_stripctrl_new(Seat *seat, BinarySink *bs_out, - bool permit_cr, wchar_t substitution) +StripCtrlChars *console_stripctrl_new( + Seat *seat, BinarySink *bs_out, SeatInteractionContext sic) { - return stripctrl_new(bs_out, permit_cr, substitution); + return stripctrl_new(bs_out, false, 0); } /* diff --git a/windows/wincons.c b/windows/wincons.c index 2f1faf29..d623e2db 100644 --- a/windows/wincons.c +++ b/windows/wincons.c @@ -388,10 +388,10 @@ static void console_eventlog(LogPolicy *lp, const char *string) console_logging_error(lp, string); } -StripCtrlChars *console_stripctrl_new(Seat *seat, BinarySink *bs_out, - bool permit_cr, wchar_t substitution) +StripCtrlChars *console_stripctrl_new( + Seat *seat, BinarySink *bs_out, SeatInteractionContext sic) { - return stripctrl_new(bs_out, permit_cr, substitution); + return stripctrl_new(bs_out, false, 0); } static void console_data_untrusted(HANDLE hout, const char *data, size_t len) diff --git a/windows/window.c b/windows/window.c index cd1e2169..fbf05cfb 100644 --- a/windows/window.c +++ b/windows/window.c @@ -320,10 +320,10 @@ bool win_seat_get_window_pixel_size(Seat *seat, int *x, int *y) return true; } -StripCtrlChars *win_seat_stripctrl_new(Seat *seat, BinarySink *bs_out, - bool permit_cr, wchar_t substitution) +StripCtrlChars *win_seat_stripctrl_new( + Seat *seat, BinarySink *bs_out, SeatInteractionContext sic) { - return stripctrl_new_term(bs_out, permit_cr, substitution, term); + return stripctrl_new_term(bs_out, false, 0, term); } static size_t win_seat_output(