1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 03:22:48 -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:
Simon Tatham
2021-09-12 09:52:46 +01:00
parent c06c9c730f
commit 82177956da
16 changed files with 88 additions and 33 deletions

View File

@ -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;
}