1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-03 20:42:48 -05:00

Mention the host name in host-key prompts.

Now that it's possible for a single invocation of PuTTY to connect to
multiple SSH servers (jump host followed by ultimate destination
host), it's rather unhelpful for host key prompts to just say "the
server". To check an unknown host key, users will need to know _which_
host it's purporting to be the key for.

Another possibility is to put a message in the terminal window
indicating which server we're currently in the SSH setup phase for.
That will certainly be what we have to end up doing for userpass
prompts that appear _in_ the terminal window. But that by itself is
still unhelpful for host key prompts in a separate dialog, because the
user would have to check both windows to get all the information they
need. Easier if the host key dialog itself tells you everything you
need to know to answer the question: is _this_ key the one you expect
for _that_ host?
This commit is contained in:
Simon Tatham
2021-09-15 14:41:00 +01:00
parent f317f8e67e
commit d1dc1e927c
8 changed files with 89 additions and 61 deletions

View File

@ -825,6 +825,8 @@ void showabout(HWND hwnd)
struct hostkey_dialog_ctx {
const char *const *keywords;
const char *const *values;
const char *host;
int port;
FingerprintType fptype_default;
char **fingerprints;
const char *keydisp;
@ -901,6 +903,11 @@ static INT_PTR CALLBACK HostKeyDialogProc(HWND hwnd, UINT msg,
}
strbuf_free(sb);
char *hostport = dupprintf("%s (port %d)", ctx->host, ctx->port);
SetDlgItemText(hwnd, IDC_HK_HOST, hostport);
sfree(hostport);
MakeDlgItemBorderless(hwnd, IDC_HK_HOST);
SetDlgItemText(hwnd, IDC_HK_FINGERPRINT,
ctx->fingerprints[ctx->fptype_default]);
MakeDlgItemBorderless(hwnd, IDC_HK_FINGERPRINT);
@ -1002,6 +1009,8 @@ int win_seat_verify_ssh_host_key(
ctx->iconid = (ret == 2 ? IDI_WARNING : IDI_QUESTION);
ctx->helpctx = (ret == 2 ? WINHELP_CTX_errors_hostkey_changed :
WINHELP_CTX_errors_hostkey_absent);
ctx->host = host;
ctx->port = port;
int dlgid = (ret == 2 ? IDD_HK_WRONG : IDD_HK_ABSENT);
int mbret = DialogBoxParam(
hinst, MAKEINTRESOURCE(dlgid), wgs->term_hwnd,