1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-02 12:02:47 -05:00

Pass more information to interactive host key check.

Now we pass the whole set of fingerprints, and also a displayable
format for the full host public key.

NFC: this commit doesn't modify any of the host key prompts to _use_
any of the new information. That's coming next.
This commit is contained in:
Simon Tatham
2021-03-13 10:59:47 +00:00
parent 04758cb3ec
commit 3461196197
10 changed files with 51 additions and 33 deletions

View File

@ -33,8 +33,8 @@ void console_print_error_msg(const char *prefix, const char *msg)
}
int console_verify_ssh_host_key(
Seat *seat, const char *host, int port,
const char *keytype, char *keystr, char *fingerprint,
Seat *seat, const char *host, int port, const char *keytype,
char *keystr, const char *keydisp, char **fingerprints,
void (*callback)(void *ctx, int result), void *ctx)
{
int ret;
@ -62,7 +62,10 @@ int console_verify_ssh_host_key(
prompt = hk_absentmsg_interactive_prompt;
}
fprintf(stderr, common_fmt, keytype, fingerprint);
FingerprintType fptype_default =
ssh2_pick_default_fingerprint(fingerprints);
fprintf(stderr, common_fmt, keytype, fingerprints[fptype_default]);
if (console_batch_mode) {
fputs(console_abandoned_msg, stderr);
return 0;

View File

@ -939,8 +939,8 @@ static INT_PTR CALLBACK HostKeyDialogProc(HWND hwnd, UINT msg,
}
int win_seat_verify_ssh_host_key(
Seat *seat, const char *host, int port,
const char *keytype, char *keystr, char *fingerprint,
Seat *seat, const char *host, int port, const char *keytype,
char *keystr, const char *keydisp, char **fingerprints,
void (*callback)(void *ctx, int result), void *ctx)
{
int ret;
@ -965,7 +965,8 @@ int win_seat_verify_ssh_host_key(
struct hostkey_dialog_ctx ctx[1];
ctx->keywords = keywords;
ctx->values = values;
ctx->fingerprint = fingerprint;
ctx->fingerprint = fingerprints[
ssh2_pick_default_fingerprint(fingerprints)];
ctx->iconid = (ret == 2 ? IDI_WARNING : IDI_QUESTION);
ctx->helpctx = (ret == 2 ? WINHELP_CTX_errors_hostkey_changed :
WINHELP_CTX_errors_hostkey_absent);

View File

@ -218,8 +218,8 @@ int has_embedded_chm(void); /* 1 = yes, 0 = no, -1 = N/A */
* window.c can refer to them.
*/
int win_seat_verify_ssh_host_key(
Seat *seat, const char *host, int port,
const char *keytype, char *keystr, char *key_fingerprint,
Seat *seat, const char *host, int port, const char *keytype,
char *keystr, const char *keydisp, char **key_fingerprints,
void (*callback)(void *ctx, int result), void *ctx);
int win_seat_confirm_weak_crypto_primitive(
Seat *seat, const char *algtype, const char *algname,