1
0
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:
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

@ -543,5 +543,6 @@ SshChannel *ssh1_serverside_agent_open(ConnectionLayer *cl, Channel *chan)
bool ssh1_connection_need_antispoof_prompt(struct ssh1_connection_state *s)
{
return !seat_set_trust_status(s->ppl.seat, false);
seat_set_trust_status(s->ppl.seat, false);
return !seat_can_set_trust_status(s->ppl.seat);
}

View File

@ -500,6 +500,7 @@ void ssh2channel_send_terminal_size_change(SshChannel *sc, int w, int h)
bool ssh2_connection_need_antispoof_prompt(struct ssh2_connection_state *s)
{
bool success = seat_set_trust_status(s->ppl.seat, false);
seat_set_trust_status(s->ppl.seat, false);
bool success = seat_can_set_trust_status(s->ppl.seat);
return (!success && !ssh_is_bare(s->ppl.ssh));
}

View File

@ -125,6 +125,7 @@ static const SeatVtable server_seat_vt = {
.get_window_pixel_size = nullseat_get_window_pixel_size,
.stripctrl_new = nullseat_stripctrl_new,
.set_trust_status = nullseat_set_trust_status,
.can_set_trust_status = nullseat_can_set_trust_status_no,
.verbose = nullseat_verbose_no,
.interactive = nullseat_interactive_no,
.get_cursor_position = nullseat_get_cursor_position,

View File

@ -204,6 +204,7 @@ static const SeatVtable sesschan_seat_vt = {
.get_window_pixel_size = sesschan_get_window_pixel_size,
.stripctrl_new = nullseat_stripctrl_new,
.set_trust_status = nullseat_set_trust_status,
.can_set_trust_status = nullseat_can_set_trust_status_no,
.verbose = nullseat_verbose_no,
.interactive = nullseat_interactive_no,
.get_cursor_position = nullseat_get_cursor_position,

View File

@ -1950,7 +1950,8 @@ static void ssh2_userauth_antispoof_msg(
struct ssh2_userauth_state *s, const char *msg)
{
strbuf *sb = strbuf_new();
if (seat_set_trust_status(s->ppl.seat, true)) {
seat_set_trust_status(s->ppl.seat, true);
if (seat_can_set_trust_status(s->ppl.seat)) {
/*
* If the seat can directly indicate that this message is
* generated by the client, then we can just use the message