1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 19:12:48 -05:00

Seat method to set the current trust status.

In terminal-based GUI applications, this is passed through to
term_set_trust_status, to toggle whether lines are prefixed with the
new trust sigil. In console applications, the function returns false,
indicating to the backend that it should employ some other technique
for spoofing protection.
This commit is contained in:
Simon Tatham
2019-03-10 14:42:11 +00:00
parent 9c367eba4c
commit 76d8d363be
20 changed files with 105 additions and 12 deletions

View File

@ -373,6 +373,7 @@ static const char *gtk_seat_get_x_display(Seat *seat);
#ifndef NOT_X_WINDOWS
static bool gtk_seat_get_windowid(Seat *seat, long *id);
#endif
static bool gtk_seat_set_trust_status(Seat *seat, bool trusted);
static const SeatVtable gtk_seat_vt = {
gtk_seat_output,
@ -396,6 +397,7 @@ static const SeatVtable gtk_seat_vt = {
#endif
gtk_seat_get_window_pixel_size,
gtk_seat_stripctrl_new,
gtk_seat_set_trust_status,
};
static void gtk_eventlog(LogPolicy *lp, const char *string)
@ -5503,3 +5505,10 @@ void new_session_window(Conf *conf, const char *geometry_string)
if (inst->ldisc) /* early backend failure might make this NULL already */
ldisc_echoedit_update(inst->ldisc); /* cause ldisc to notice changes */
}
static bool gtk_seat_set_trust_status(Seat *seat, bool trusted)
{
GtkFrontend *inst = container_of(seat, GtkFrontend, seat);
term_set_trust_status(inst->term, trusted);
return true;
}

View File

@ -414,6 +414,11 @@ static int console_askappend(LogPolicy *lp, Filename *filename,
return 0;
}
bool console_set_trust_status(Seat *seat, bool trusted)
{
return false;
}
/*
* Warn about the obsolescent key file format.
*

View File

@ -401,6 +401,7 @@ static const SeatVtable plink_seat_vt = {
nullseat_get_windowid,
nullseat_get_window_pixel_size,
console_stripctrl_new,
console_set_trust_status,
};
static Seat plink_seat[1] = {{ &plink_seat_vt }};

View File

@ -868,6 +868,9 @@ Backend *pty_backend_create(
Pty *pty;
int i;
/* No local authentication phase in this protocol */
seat_set_trust_status(seat, false);
if (single_pty) {
pty = single_pty;
assert(pty->conf == NULL);

View File

@ -288,6 +288,9 @@ static const char *serial_init(Seat *seat, Backend **backend_handle,
const char *err;
char *line;
/* No local authentication phase in this protocol */
seat_set_trust_status(seat, false);
serial = snew(Serial);
serial->backend.vt = &serial_backend;
*backend_handle = &serial->backend;