1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 01:18:00 +00:00

Fix trust status when Interactor returns a seat.

While testing the unrelated pile of commits just past, I accidentally
started a Cygwin saved session I hadn't run in ages which used the old
Telnet-based cygtermd as a local proxy command, and found that it
presented the Cygwin prompt with a trust sigil. Oops!

It turns out that this is because interactor_return_seat does two
things that can change the real seat's trust status, and it does them
in the wrong order: it defaults the status back to trusted (as if the
seat was brand new, because that's how they start out), and it calls
tempseat_flush which may have buffered a trust-status reset while the
seat was borrowed. The former should not override the latter!
This commit is contained in:
Simon Tatham 2022-03-12 20:17:30 +00:00
parent f23a84cf7c
commit 5d58931b51

View File

@ -47,8 +47,18 @@ void interactor_return_seat(Interactor *itr)
if (!is_tempseat(tempseat))
return; /* no-op */
tempseat_flush(tempseat);
/*
* We're about to hand this seat back to the parent Interactor to
* do its own thing with. It will typically expect to start in the
* same state as if the seat had never been borrowed, i.e. in the
* starting trust state.
*
* However, this may be overridden by the tempseat_flush call.
*/
Seat *realseat = tempseat_get_real(tempseat);
seat_set_trust_status(realseat, true);
tempseat_flush(tempseat);
interactor_set_seat(itr, realseat);
tempseat_free(tempseat);
@ -60,14 +70,6 @@ void interactor_return_seat(Interactor *itr)
Interactor *itr_top = interactor_toplevel(itr, NULL);
if (itr_top->last_to_talk)
interactor_announce(itr);
/*
* We're about to hand this seat back to the parent Interactor to
* do its own thing with. It will typically expect to start in the
* same state as if the seat had never been borrowed, i.e. in the
* starting trust state.
*/
seat_set_trust_status(realseat, true);
}
InteractionReadySeat interactor_announce(Interactor *itr)