mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-02 12:02:47 -05:00
Divide seat_set_trust_status into query and update.
This complicates the API in one sense (more separate functions), but in another sense, simplifies it (each function does something simpler). When I start putting one Seat in front of another during SSH proxying, the latter will be more important - in particular, it means you can find out _whether_ a seat can support changing trust status without having to actually attempt a destructive modification.
This commit is contained in:
@ -187,7 +187,16 @@ bool is_interactive(void)
|
||||
}
|
||||
|
||||
bool console_antispoof_prompt = true;
|
||||
bool console_set_trust_status(Seat *seat, bool trusted)
|
||||
|
||||
void console_set_trust_status(Seat *seat, bool trusted)
|
||||
{
|
||||
/* Do nothing in response to a change of trust status, because
|
||||
* there's nothing we can do in a console environment. However,
|
||||
* the query function below will make a fiddly decision about
|
||||
* whether to tell the backend to enable fallback handling. */
|
||||
}
|
||||
|
||||
bool console_can_set_trust_status(Seat *seat)
|
||||
{
|
||||
if (console_batch_mode || !is_interactive() || !console_antispoof_prompt) {
|
||||
/*
|
||||
@ -200,8 +209,8 @@ bool console_set_trust_status(Seat *seat, bool trusted)
|
||||
* prompt, the user couldn't respond to it via the terminal
|
||||
* anyway.
|
||||
*
|
||||
* We also vacuously return success if the user has purposely
|
||||
* disabled the antispoof prompt.
|
||||
* We also return true without enabling any defences if the
|
||||
* user has purposely disabled the antispoof prompt.
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
@ -101,6 +101,7 @@ static const SeatVtable plink_seat_vt = {
|
||||
.get_window_pixel_size = nullseat_get_window_pixel_size,
|
||||
.stripctrl_new = console_stripctrl_new,
|
||||
.set_trust_status = console_set_trust_status,
|
||||
.can_set_trust_status = console_can_set_trust_status,
|
||||
.verbose = cmdline_seat_verbose,
|
||||
.interactive = plink_seat_interactive,
|
||||
.get_cursor_position = nullseat_get_cursor_position,
|
||||
|
@ -323,7 +323,8 @@ static void win_seat_notify_remote_exit(Seat *seat);
|
||||
static void win_seat_connection_fatal(Seat *seat, const char *msg);
|
||||
static void win_seat_update_specials_menu(Seat *seat);
|
||||
static void win_seat_set_busy_status(Seat *seat, BusyStatus status);
|
||||
static bool win_seat_set_trust_status(Seat *seat, bool trusted);
|
||||
static void win_seat_set_trust_status(Seat *seat, bool trusted);
|
||||
static bool win_seat_can_set_trust_status(Seat *seat);
|
||||
static bool win_seat_get_cursor_position(Seat *seat, int *x, int *y);
|
||||
static bool win_seat_get_window_pixel_size(Seat *seat, int *x, int *y);
|
||||
|
||||
@ -348,6 +349,7 @@ static const SeatVtable win_seat_vt = {
|
||||
.get_window_pixel_size = win_seat_get_window_pixel_size,
|
||||
.stripctrl_new = win_seat_stripctrl_new,
|
||||
.set_trust_status = win_seat_set_trust_status,
|
||||
.can_set_trust_status = win_seat_can_set_trust_status,
|
||||
.verbose = nullseat_verbose_yes,
|
||||
.interactive = nullseat_interactive_yes,
|
||||
.get_cursor_position = win_seat_get_cursor_position,
|
||||
@ -5753,9 +5755,13 @@ static int win_seat_get_userpass_input(
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool win_seat_set_trust_status(Seat *seat, bool trusted)
|
||||
static void win_seat_set_trust_status(Seat *seat, bool trusted)
|
||||
{
|
||||
term_set_trust_status(term, trusted);
|
||||
}
|
||||
|
||||
static bool win_seat_can_set_trust_status(Seat *seat)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user