1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 11:32:48 -05:00

Merge tag '0.80'.

This involved a trivial merge conflict fix in terminal.c because of
the way the cherry-pick 73b41feba5 differed from its original
bdbd5f429c.

But a more significant rework was needed in windows/console.c, because
the updates to confirm_weak_* conflicted with the changes on main to
abstract out the ConsoleIO system.
This commit is contained in:
Simon Tatham
2023-12-18 14:32:57 +00:00
24 changed files with 803 additions and 283 deletions

View File

@ -438,8 +438,32 @@ static SeatPromptResult sshproxy_confirm_ssh_host_key(
return SPR_SW_ABORT("Noninteractive SSH proxy cannot confirm host key");
}
static void sshproxy_format_seatdialogtext(strbuf *sb, SeatDialogText *text)
{
for (SeatDialogTextItem *item = text->items,
*end = item+text->nitems; item < end; item++) {
switch (item->type) {
case SDT_SCARY_HEADING:
case SDT_PARA:
case SDT_DISPLAY:
put_stringz(sb, item->text);
put_byte(sb, '\n');
break;
case SDT_BATCH_ABORT:
put_stringz(sb, item->text);
put_byte(sb, '\n');
goto endloop;
default:
break;
}
}
endloop:
while (strbuf_chomp(sb, '\n'));
}
static SeatPromptResult sshproxy_confirm_weak_crypto_primitive(
Seat *seat, const char *algtype, const char *algname,
Seat *seat, SeatDialogText *text,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
{
SshProxy *sp = container_of(seat, SshProxy, seat);
@ -450,22 +474,24 @@ static SeatPromptResult sshproxy_confirm_weak_crypto_primitive(
* request on to it.
*/
return seat_confirm_weak_crypto_primitive(
wrap(sp->clientseat), algtype, algname, callback, ctx);
wrap(sp->clientseat), text, callback, ctx);
}
/*
* Otherwise, behave as if we're in batch mode: take the safest
* option.
*/
sshproxy_error(sp, "First %s supported by server is %s, below warning "
"threshold. Abandoning proxy SSH connection.",
algtype, algname);
strbuf *sb = strbuf_new();
sshproxy_format_seatdialogtext(sb, text);
sshproxy_error(sp, sb->s);
strbuf_free(sb);
return SPR_SW_ABORT("Noninteractive SSH proxy cannot confirm "
"weak crypto primitive");
}
static SeatPromptResult sshproxy_confirm_weak_cached_hostkey(
Seat *seat, const char *algname, const char *betteralgs,
Seat *seat, SeatDialogText *text,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
{
SshProxy *sp = container_of(seat, SshProxy, seat);
@ -476,16 +502,18 @@ static SeatPromptResult sshproxy_confirm_weak_cached_hostkey(
* request on to it.
*/
return seat_confirm_weak_cached_hostkey(
wrap(sp->clientseat), algname, betteralgs, callback, ctx);
wrap(sp->clientseat), text, callback, ctx);
}
/*
* Otherwise, behave as if we're in batch mode: take the safest
* option.
*/
sshproxy_error(sp, "First host key type stored for server is %s, below "
"warning threshold. Abandoning proxy SSH connection.",
algname);
strbuf *sb = strbuf_new();
sshproxy_format_seatdialogtext(sb, text);
sshproxy_error(sp, sb->s);
strbuf_free(sb);
return SPR_SW_ABORT("Noninteractive SSH proxy cannot confirm "
"weak cached host key");
}