1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-04 04:52:47 -05:00

Revise the API for seat_stripctrl_new.

Now instead of taking raw arguments to configure the output
StripCtrlChars with, it takes an enumerated value giving the context
of what's being sanitised, and allows the seat to decide what the
output parameters for that context should be.

The only context currently used is SIC_BANNER (SSH login banners).
I've also added a not-yet-used one for keyboard-interactive prompts.
This commit is contained in:
Simon Tatham
2019-03-07 08:19:38 +00:00
parent d049f0ab6c
commit d05d2e259f
7 changed files with 26 additions and 22 deletions

20
putty.h
View File

@ -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.