mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 03:22:48 -05:00
Centralise most details of host-key prompting.
The text of the host key warnings was replicated in three places: the Windows rc file, the GTK dialog setup function, and the console.c shared between both platforms' CLI tools. Now it lives in just one place, namely ssh/common.c where the rest of the centralised host-key checking is done, so it'll be easier to adjust the wording in future. This comes with some extra automation. Paragraph wrapping is no longer done by hand in any version of these prompts. (Previously we let GTK do the wrapping on GTK, but on Windows the resource file contained a bunch of pre-wrapped LTEXT lines, and console.c had pre-wrapped terminal messages.) And the dialog heights in Windows are determined automatically based on the amount of stuff in the window. The main idea of all this is that it'll be easier to set up more elaborate kinds of host key prompt that deal with certificates (if, e.g., a server sends us a certified host key which we don't trust the CA for). But there are side benefits of this refactoring too: each tool now reliably inserts its own appname in the prompts, and also, on Windows the entire prompt text is copy-pastable. Details of implementation: there's a new type SeatDialogText which holds a set of (type, string) pairs describing the contents of a prompt. Type codes distinguish ordinary text paragraphs, paragraphs to be displayed prominently (like key fingerprints), the extra-bold scary title at the top of the 'host key changed' version of the dialog, and the various information that lives in the subsidiary 'more info' box. ssh/common.c constructs this, and passes it to the Seat to present the actual prompt. In order to deal with the different UI for answering the prompt, I've added an extra Seat method 'prompt_descriptions' which returns some snippets of text to interpolate into the messages. ssh/common.c calls that while it's still constructing the text, and incorporates the resulting snippets into the SeatDialogText. For the moment, this refactoring only affects the host key prompts. The warnings about outmoded crypto are still done the old-fashioned way; they probably ought to be similarly refactored to use this new SeatDialogText system, but it's not immediately critical for the purpose I have right now.
This commit is contained in:
@ -34,44 +34,52 @@ void console_print_error_msg(const char *prefix, const char *msg)
|
||||
|
||||
SeatPromptResult console_confirm_ssh_host_key(
|
||||
Seat *seat, const char *host, int port, const char *keytype,
|
||||
char *keystr, const char *keydisp, char **fingerprints, bool mismatch,
|
||||
char *keystr, SeatDialogText *text, HelpCtx helpctx,
|
||||
void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
|
||||
{
|
||||
HANDLE hin;
|
||||
DWORD savemode, i;
|
||||
char *common;
|
||||
const char *intro, *prompt;
|
||||
const char *prompt;
|
||||
|
||||
stdio_sink errsink[1];
|
||||
stdio_sink_init(errsink, stderr);
|
||||
|
||||
char line[32];
|
||||
|
||||
FingerprintType fptype_default =
|
||||
ssh2_pick_default_fingerprint(fingerprints);
|
||||
|
||||
if (mismatch) { /* key was different */
|
||||
common = hk_wrongmsg_common(host, port, keytype,
|
||||
fingerprints[fptype_default]);
|
||||
intro = hk_wrongmsg_interactive_intro;
|
||||
prompt = hk_wrongmsg_interactive_prompt;
|
||||
} else { /* key was absent */
|
||||
common = hk_absentmsg_common(host, port, keytype,
|
||||
fingerprints[fptype_default]);
|
||||
intro = hk_absentmsg_interactive_intro;
|
||||
prompt = hk_absentmsg_interactive_prompt;
|
||||
for (SeatDialogTextItem *item = text->items,
|
||||
*end = item+text->nitems; item < end; item++) {
|
||||
switch (item->type) {
|
||||
case SDT_PARA:
|
||||
wordwrap(BinarySink_UPCAST(errsink),
|
||||
ptrlen_from_asciz(item->text), 60);
|
||||
fputc('\n', stderr);
|
||||
break;
|
||||
case SDT_DISPLAY:
|
||||
fprintf(stderr, " %s\n", item->text);
|
||||
break;
|
||||
case SDT_SCARY_HEADING:
|
||||
/* Can't change font size or weight in this context */
|
||||
fprintf(stderr, "%s\n", item->text);
|
||||
break;
|
||||
case SDT_BATCH_ABORT:
|
||||
if (console_batch_mode) {
|
||||
fprintf(stderr, "%s\n", item->text);
|
||||
fflush(stderr);
|
||||
return SPR_SW_ABORT("Cannot confirm a host key in batch mode");
|
||||
}
|
||||
break;
|
||||
case SDT_PROMPT:
|
||||
prompt = item->text;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fputs(common, stderr);
|
||||
sfree(common);
|
||||
|
||||
if (console_batch_mode) {
|
||||
fputs(console_abandoned_msg, stderr);
|
||||
return SPR_SW_ABORT("Cannot confirm a host key in batch mode");
|
||||
}
|
||||
|
||||
fputs(intro, stderr);
|
||||
fflush(stderr);
|
||||
|
||||
while (true) {
|
||||
fputs(prompt, stderr);
|
||||
fprintf(stderr,
|
||||
"%s (y/n, Return cancels connection, i for more info) ",
|
||||
prompt);
|
||||
fflush(stderr);
|
||||
|
||||
line[0] = '\0'; /* fail safe if ReadFile returns no data */
|
||||
@ -84,13 +92,22 @@ SeatPromptResult console_confirm_ssh_host_key(
|
||||
SetConsoleMode(hin, savemode);
|
||||
|
||||
if (line[0] == 'i' || line[0] == 'I') {
|
||||
fprintf(stderr, "Full public key:\n%s\n", keydisp);
|
||||
if (fingerprints[SSH_FPTYPE_SHA256])
|
||||
fprintf(stderr, "SHA256 key fingerprint:\n%s\n",
|
||||
fingerprints[SSH_FPTYPE_SHA256]);
|
||||
if (fingerprints[SSH_FPTYPE_MD5])
|
||||
fprintf(stderr, "MD5 key fingerprint:\n%s\n",
|
||||
fingerprints[SSH_FPTYPE_MD5]);
|
||||
for (SeatDialogTextItem *item = text->items,
|
||||
*end = item+text->nitems; item < end; item++) {
|
||||
switch (item->type) {
|
||||
case SDT_MORE_INFO_KEY:
|
||||
fprintf(stderr, "%s", item->text);
|
||||
break;
|
||||
case SDT_MORE_INFO_VALUE_SHORT:
|
||||
fprintf(stderr, ": %s\n", item->text);
|
||||
break;
|
||||
case SDT_MORE_INFO_VALUE_BLOB:
|
||||
fprintf(stderr, ":\n%s\n", item->text);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
272
windows/dialog.c
272
windows/dialog.c
@ -842,14 +842,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;
|
||||
LPCTSTR iconid;
|
||||
SeatDialogText *text;
|
||||
bool has_title;
|
||||
const char *helpctx;
|
||||
};
|
||||
|
||||
@ -860,16 +854,99 @@ static INT_PTR HostKeyMoreInfoProc(HWND hwnd, UINT msg, WPARAM wParam,
|
||||
|
||||
switch (msg) {
|
||||
case WM_INITDIALOG: {
|
||||
int index = 100, y = 12;
|
||||
|
||||
if (ctx->fingerprints[SSH_FPTYPE_SHA256])
|
||||
SetDlgItemText(hwnd, IDC_HKI_SHA256,
|
||||
ctx->fingerprints[SSH_FPTYPE_SHA256]);
|
||||
if (ctx->fingerprints[SSH_FPTYPE_MD5])
|
||||
SetDlgItemText(hwnd, IDC_HKI_MD5,
|
||||
ctx->fingerprints[SSH_FPTYPE_MD5]);
|
||||
WPARAM font = SendMessage(hwnd, WM_GETFONT, 0, 0);
|
||||
|
||||
SetDlgItemText(hwnd, IDA_TEXT, ctx->keydisp);
|
||||
const char *key = NULL;
|
||||
for (SeatDialogTextItem *item = ctx->text->items,
|
||||
*end = item + ctx->text->nitems; item < end; item++) {
|
||||
switch (item->type) {
|
||||
case SDT_MORE_INFO_KEY:
|
||||
key = item->text;
|
||||
break;
|
||||
case SDT_MORE_INFO_VALUE_SHORT:
|
||||
case SDT_MORE_INFO_VALUE_BLOB: {
|
||||
RECT rk, rv;
|
||||
DWORD editstyle = WS_CHILD | WS_VISIBLE | WS_TABSTOP |
|
||||
ES_AUTOHSCROLL | ES_READONLY;
|
||||
if (item->type == SDT_MORE_INFO_VALUE_BLOB) {
|
||||
rk.left = 12;
|
||||
rk.right = 376;
|
||||
rk.top = y;
|
||||
rk.bottom = 8;
|
||||
y += 10;
|
||||
|
||||
editstyle |= ES_MULTILINE;
|
||||
rv.left = 12;
|
||||
rv.right = 376;
|
||||
rv.top = y;
|
||||
rv.bottom = 64;
|
||||
y += 68;
|
||||
} else {
|
||||
rk.left = 12;
|
||||
rk.right = 80;
|
||||
rk.top = y+2;
|
||||
rk.bottom = 8;
|
||||
|
||||
rv.left = 100;
|
||||
rv.right = 288;
|
||||
rv.top = y;
|
||||
rv.bottom = 12;
|
||||
|
||||
y += 16;
|
||||
}
|
||||
|
||||
MapDialogRect(hwnd, &rk);
|
||||
HWND ctl = CreateWindowEx(
|
||||
0, "STATIC", key, WS_CHILD | WS_VISIBLE,
|
||||
rk.left, rk.top, rk.right, rk.bottom,
|
||||
hwnd, (HMENU)(ULONG_PTR)index++, hinst, NULL);
|
||||
SendMessage(ctl, WM_SETFONT, font, MAKELPARAM(true, 0));
|
||||
|
||||
MapDialogRect(hwnd, &rv);
|
||||
ctl = CreateWindowEx(
|
||||
WS_EX_CLIENTEDGE, "EDIT", item->text, editstyle,
|
||||
rv.left, rv.top, rv.right, rv.bottom,
|
||||
hwnd, (HMENU)(ULONG_PTR)index++, hinst, NULL);
|
||||
SendMessage(ctl, WM_SETFONT, font, MAKELPARAM(true, 0));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Now resize the overall window, and move the Close button at
|
||||
* the bottom.
|
||||
*/
|
||||
RECT r;
|
||||
r.left = 176;
|
||||
r.top = y + 10;
|
||||
r.right = r.bottom = 0;
|
||||
MapDialogRect(hwnd, &r);
|
||||
HWND ctl = GetDlgItem(hwnd, IDOK);
|
||||
SetWindowPos(ctl, NULL, r.left, r.top, 0, 0,
|
||||
SWP_NOSIZE | SWP_NOREDRAW | SWP_NOZORDER);
|
||||
|
||||
r.left = r.top = r.right = 0;
|
||||
r.bottom = 300;
|
||||
MapDialogRect(hwnd, &r);
|
||||
int oldheight = r.bottom;
|
||||
|
||||
r.left = r.top = r.right = 0;
|
||||
r.bottom = y + 30;
|
||||
MapDialogRect(hwnd, &r);
|
||||
int newheight = r.bottom;
|
||||
|
||||
GetWindowRect(hwnd, &r);
|
||||
|
||||
SetWindowPos(hwnd, NULL, 0, 0, r.right - r.left,
|
||||
r.bottom - r.top + newheight - oldheight,
|
||||
SWP_NOMOVE | SWP_NOREDRAW | SWP_NOZORDER);
|
||||
|
||||
ShowWindow(hwnd, SW_SHOWNORMAL);
|
||||
return 1;
|
||||
}
|
||||
case WM_COMMAND:
|
||||
@ -893,44 +970,106 @@ static INT_PTR HostKeyDialogProc(HWND hwnd, UINT msg,
|
||||
|
||||
switch (msg) {
|
||||
case WM_INITDIALOG: {
|
||||
strbuf *sb = strbuf_new();
|
||||
for (int id = 100;; id++) {
|
||||
char buf[256];
|
||||
strbuf *dlg_text = strbuf_new();
|
||||
const char *dlg_title = "";
|
||||
ctx->has_title = false;
|
||||
LPCTSTR iconid = IDI_QUESTION;
|
||||
ctx->helpctx = WINHELP_CTX_errors_hostkey_absent;
|
||||
|
||||
if (!GetDlgItemText(hwnd, id, buf, (int)lenof(buf)))
|
||||
for (SeatDialogTextItem *item = ctx->text->items,
|
||||
*end = item + ctx->text->nitems; item < end; item++) {
|
||||
switch (item->type) {
|
||||
case SDT_PARA:
|
||||
put_fmt(dlg_text, "%s\r\n\r\n", item->text);
|
||||
break;
|
||||
case SDT_DISPLAY:
|
||||
put_fmt(dlg_text, "%s\r\n\r\n", item->text);
|
||||
break;
|
||||
case SDT_SCARY_HEADING:
|
||||
SetDlgItemText(hwnd, IDC_HK_TITLE, item->text);
|
||||
iconid = IDI_WARNING;
|
||||
ctx->helpctx = WINHELP_CTX_errors_hostkey_changed;
|
||||
ctx->has_title = true;
|
||||
break;
|
||||
case SDT_TITLE:
|
||||
dlg_title = item->text;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
strbuf_clear(sb);
|
||||
for (const char *p = buf; *p ;) {
|
||||
if (*p == '{') {
|
||||
for (size_t i = 0; ctx->keywords[i]; i++) {
|
||||
if (strstartswith(p, ctx->keywords[i])) {
|
||||
p += strlen(ctx->keywords[i]);
|
||||
put_dataz(sb, ctx->values[i]);
|
||||
goto matched;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
put_byte(sb, *p++);
|
||||
}
|
||||
matched:;
|
||||
}
|
||||
|
||||
SetDlgItemText(hwnd, id, sb->s);
|
||||
}
|
||||
strbuf_free(sb);
|
||||
while (strbuf_chomp(dlg_text, '\r') || strbuf_chomp(dlg_text, '\n'));
|
||||
|
||||
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_TEXT, dlg_text->s);
|
||||
MakeDlgItemBorderless(hwnd, IDC_HK_TEXT);
|
||||
strbuf_free(dlg_text);
|
||||
|
||||
SetDlgItemText(hwnd, IDC_HK_FINGERPRINT,
|
||||
ctx->fingerprints[ctx->fptype_default]);
|
||||
MakeDlgItemBorderless(hwnd, IDC_HK_FINGERPRINT);
|
||||
SetWindowText(hwnd, dlg_title);
|
||||
|
||||
if (!ctx->has_title) {
|
||||
HWND item = GetDlgItem(hwnd, IDC_HK_TITLE);
|
||||
if (item)
|
||||
DestroyWindow(item);
|
||||
}
|
||||
|
||||
/*
|
||||
* Find out how tall the text in the edit control really ended
|
||||
* up (after line wrapping), and adjust the height of the
|
||||
* whole box to match it.
|
||||
*/
|
||||
int height = SendDlgItemMessage(hwnd, IDC_HK_TEXT,
|
||||
EM_GETLINECOUNT, 0, 0);
|
||||
height *= 8; /* height of a text line, by definition of dialog units */
|
||||
|
||||
int edittop = ctx->has_title ? 40 : 20;
|
||||
|
||||
RECT r;
|
||||
r.left = 40;
|
||||
r.top = edittop;
|
||||
r.right = 290;
|
||||
r.bottom = height;
|
||||
MapDialogRect(hwnd, &r);
|
||||
SetWindowPos(GetDlgItem(hwnd, IDC_HK_TEXT), NULL,
|
||||
r.left, r.top, r.right, r.bottom,
|
||||
SWP_NOREDRAW | SWP_NOZORDER);
|
||||
|
||||
static const struct {
|
||||
int id, x;
|
||||
} buttons[] = {
|
||||
{ IDCANCEL, 288 },
|
||||
{ IDC_HK_ACCEPT, 168 },
|
||||
{ IDC_HK_ONCE, 216 },
|
||||
{ IDC_HK_MOREINFO, 60 },
|
||||
{ IDHELP, 12 },
|
||||
};
|
||||
for (size_t i = 0; i < lenof(buttons); i++) {
|
||||
HWND ctl = GetDlgItem(hwnd, buttons[i].id);
|
||||
r.left = buttons[i].x;
|
||||
r.top = edittop + height + 20;
|
||||
r.right = r.bottom = 0;
|
||||
MapDialogRect(hwnd, &r);
|
||||
SetWindowPos(ctl, NULL, r.left, r.top, 0, 0,
|
||||
SWP_NOSIZE | SWP_NOREDRAW | SWP_NOZORDER);
|
||||
}
|
||||
|
||||
r.left = r.top = r.right = 0;
|
||||
r.bottom = 240;
|
||||
MapDialogRect(hwnd, &r);
|
||||
int oldheight = r.bottom;
|
||||
|
||||
r.left = r.top = r.right = 0;
|
||||
r.bottom = edittop + height + 40;
|
||||
MapDialogRect(hwnd, &r);
|
||||
int newheight = r.bottom;
|
||||
|
||||
GetWindowRect(hwnd, &r);
|
||||
|
||||
SetWindowPos(hwnd, NULL, 0, 0, r.right - r.left,
|
||||
r.bottom - r.top + newheight - oldheight,
|
||||
SWP_NOMOVE | SWP_NOREDRAW | SWP_NOZORDER);
|
||||
|
||||
HANDLE icon = LoadImage(
|
||||
NULL, ctx->iconid, IMAGE_ICON,
|
||||
NULL, iconid, IMAGE_ICON,
|
||||
GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON),
|
||||
LR_SHARED);
|
||||
SendDlgItemMessage(hwnd, IDC_HK_ICON, STM_SETICON, (WPARAM)icon, 0);
|
||||
@ -941,13 +1080,16 @@ static INT_PTR HostKeyDialogProc(HWND hwnd, UINT msg,
|
||||
DestroyWindow(item);
|
||||
}
|
||||
|
||||
ShowWindow(hwnd, SW_SHOWNORMAL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
case WM_CTLCOLORSTATIC: {
|
||||
HDC hdc = (HDC)wParam;
|
||||
HWND control = (HWND)lParam;
|
||||
|
||||
if (GetWindowLongPtr(control, GWLP_ID) == IDC_HK_TITLE) {
|
||||
if (GetWindowLongPtr(control, GWLP_ID) == IDC_HK_TITLE &&
|
||||
ctx->has_title) {
|
||||
SetBkMode(hdc, TRANSPARENT);
|
||||
HFONT prev_font = (HFONT)SelectObject(
|
||||
hdc, (HFONT)GetStockObject(SYSTEM_FONT));
|
||||
@ -988,34 +1130,30 @@ static INT_PTR HostKeyDialogProc(HWND hwnd, UINT msg,
|
||||
return 0;
|
||||
}
|
||||
|
||||
const SeatDialogPromptDescriptions *win_seat_prompt_descriptions(Seat *seat)
|
||||
{
|
||||
static const SeatDialogPromptDescriptions descs = {
|
||||
.hk_accept_action = "press \"Accept\"",
|
||||
.hk_connect_once_action = "press \"Connect Once\"",
|
||||
.hk_cancel_action = "press \"Cancel\"",
|
||||
.hk_cancel_action_Participle = "Pressing \"Cancel\"",
|
||||
};
|
||||
return &descs;
|
||||
}
|
||||
|
||||
SeatPromptResult win_seat_confirm_ssh_host_key(
|
||||
Seat *seat, const char *host, int port, const char *keytype,
|
||||
char *keystr, const char *keydisp, char **fingerprints, bool mismatch,
|
||||
void (*callback)(void *ctx, SeatPromptResult result), void *vctx)
|
||||
char *keystr, SeatDialogText *text, HelpCtx helpctx,
|
||||
void (*callback)(void *ctx, SeatPromptResult result), void *cbctx)
|
||||
{
|
||||
WinGuiSeat *wgs = container_of(seat, WinGuiSeat, seat);
|
||||
|
||||
static const char *const keywords[] =
|
||||
{ "{KEYTYPE}", "{APPNAME}", NULL };
|
||||
|
||||
const char *values[2];
|
||||
values[0] = keytype;
|
||||
values[1] = appname;
|
||||
|
||||
struct hostkey_dialog_ctx ctx[1];
|
||||
ctx->keywords = keywords;
|
||||
ctx->values = values;
|
||||
ctx->fingerprints = fingerprints;
|
||||
ctx->fptype_default = ssh2_pick_default_fingerprint(fingerprints);
|
||||
ctx->keydisp = keydisp;
|
||||
ctx->iconid = (mismatch ? IDI_WARNING : IDI_QUESTION);
|
||||
ctx->helpctx = (mismatch ? WINHELP_CTX_errors_hostkey_changed :
|
||||
WINHELP_CTX_errors_hostkey_absent);
|
||||
ctx->host = host;
|
||||
ctx->port = port;
|
||||
int dlgid = (mismatch ? IDD_HK_WRONG : IDD_HK_ABSENT);
|
||||
ctx->text = text;
|
||||
ctx->helpctx = helpctx;
|
||||
|
||||
int mbret = ShinyDialogBox(
|
||||
hinst, MAKEINTRESOURCE(dlgid), "PuTTYHostKeyDialog",
|
||||
hinst, MAKEINTRESOURCE(IDD_HOSTKEY), "PuTTYHostKeyDialog",
|
||||
wgs->term_hwnd, HostKeyDialogProc, ctx);
|
||||
assert(mbret==IDC_HK_ACCEPT || mbret==IDC_HK_ONCE || mbret==IDCANCEL);
|
||||
if (mbret == IDC_HK_ACCEPT) {
|
||||
|
@ -226,7 +226,7 @@ int has_embedded_chm(void); /* 1 = yes, 0 = no, -1 = N/A */
|
||||
*/
|
||||
SeatPromptResult win_seat_confirm_ssh_host_key(
|
||||
Seat *seat, const char *host, int port, const char *keytype,
|
||||
char *keystr, const char *keydisp, char **key_fingerprints, bool mismatch,
|
||||
char *keystr, SeatDialogText *text, HelpCtx helpctx,
|
||||
void (*callback)(void *ctx, SeatPromptResult result), void *ctx);
|
||||
SeatPromptResult win_seat_confirm_weak_crypto_primitive(
|
||||
Seat *seat, const char *algtype, const char *algname,
|
||||
@ -234,6 +234,7 @@ SeatPromptResult win_seat_confirm_weak_crypto_primitive(
|
||||
SeatPromptResult win_seat_confirm_weak_cached_hostkey(
|
||||
Seat *seat, const char *algname, const char *betteralgs,
|
||||
void (*callback)(void *ctx, SeatPromptResult result), void *ctx);
|
||||
const SeatDialogPromptDescriptions *win_seat_prompt_descriptions(Seat *seat);
|
||||
|
||||
/*
|
||||
* Windows-specific clipboard helper function shared with dialog.c,
|
||||
|
@ -102,6 +102,7 @@ static const SeatVtable plink_seat_vt = {
|
||||
.confirm_ssh_host_key = console_confirm_ssh_host_key,
|
||||
.confirm_weak_crypto_primitive = console_confirm_weak_crypto_primitive,
|
||||
.confirm_weak_cached_hostkey = console_confirm_weak_cached_hostkey,
|
||||
.prompt_descriptions = console_prompt_descriptions,
|
||||
.is_utf8 = nullseat_is_never_utf8,
|
||||
.echoedit_update = plink_echoedit_update,
|
||||
.get_x_display = nullseat_get_x_display,
|
||||
|
@ -57,78 +57,32 @@ BEGIN
|
||||
END
|
||||
|
||||
/* No accelerators used */
|
||||
IDD_HK_ABSENT DIALOG DISCARDABLE 50, 50, 340, 160
|
||||
IDD_HOSTKEY DIALOG DISCARDABLE 50, 50, 340, 240
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "PuTTY Security Alert"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
CLASS "PuTTYHostKeyDialog"
|
||||
BEGIN
|
||||
LTEXT "The host key is not cached for this server:", 100, 40, 20, 300, 8
|
||||
LTEXT "You have no guarantee that the server is the computer you think it is.", 101, 40, 40, 300, 8
|
||||
LTEXT "The server's {KEYTYPE} key fingerprint is:", 102, 40, 52, 300, 8
|
||||
LTEXT "If you trust this host, press ""Accept"" to add the key to {APPNAME}'s", 103, 40, 72, 300, 8
|
||||
LTEXT "cache and carry on connecting.", 104, 40, 80, 300, 8
|
||||
LTEXT "If you want to carry on connecting just once, without adding the key", 105, 40, 92, 300, 8
|
||||
LTEXT "to the cache, press ""Connect Once"".", 106, 40, 100, 300, 8
|
||||
LTEXT "If you do not trust this host, press ""Cancel"" to abandon the connection.", 107, 40, 112, 300, 8
|
||||
|
||||
ICON "", IDC_HK_ICON, 10, 18, 0, 0
|
||||
|
||||
PUSHBUTTON "&Cancel", IDCANCEL, 288, 140, 40, 14
|
||||
PUSHBUTTON "&Accept", IDC_HK_ACCEPT, 168, 140, 40, 14
|
||||
PUSHBUTTON "Connect &Once", IDC_HK_ONCE, 216, 140, 64, 14
|
||||
PUSHBUTTON "More &info...", IDC_HK_MOREINFO, 60, 140, 64, 14
|
||||
PUSHBUTTON "&Help", IDHELP, 12, 140, 40, 14
|
||||
PUSHBUTTON "Cancel", IDCANCEL, 288, 220, 40, 14
|
||||
PUSHBUTTON "&Accept", IDC_HK_ACCEPT, 168, 220, 40, 14
|
||||
PUSHBUTTON "Connect &Once", IDC_HK_ONCE, 216, 220, 64, 14
|
||||
PUSHBUTTON "More &info...", IDC_HK_MOREINFO, 60, 220, 64, 14
|
||||
PUSHBUTTON "&Help", IDHELP, 12, 220, 40, 14
|
||||
|
||||
EDITTEXT IDC_HK_HOST, 40, 28, 300, 12, ES_READONLY | ES_LEFT, 0
|
||||
EDITTEXT IDC_HK_FINGERPRINT, 40, 60, 300, 12, ES_READONLY | ES_LEFT, 0
|
||||
END
|
||||
LTEXT "", IDC_HK_TITLE, 40, 20, 300, 12
|
||||
|
||||
/* No accelerators used */
|
||||
IDD_HK_WRONG DIALOG DISCARDABLE 50, 50, 340, 200
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "PuTTY Security Alert"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
BEGIN
|
||||
LTEXT "WARNING - POTENTIAL SECURITY BREACH!", IDC_HK_TITLE, 40, 20, 300, 12
|
||||
|
||||
LTEXT "The host key does not match the one {APPNAME} has cached for this server:", 100, 40, 36, 300, 8
|
||||
LTEXT "This means that either the server administrator has changed the", 101, 40, 56, 300, 8
|
||||
LTEXT "host key, or you have actually connected to another computer", 102, 40, 64, 300, 8
|
||||
LTEXT "pretending to be the server.", 103, 40, 72, 300, 8
|
||||
LTEXT "The new {KEYTYPE} key fingerprint is:", 104, 40, 84, 300, 8
|
||||
LTEXT "If you were expecting this change and trust the new key, press", 105, 40, 104, 300, 8
|
||||
LTEXT """Accept"" to update {APPNAME}'s cache and continue connecting.", 106, 40, 112, 300, 8
|
||||
LTEXT "If you want to carry on connecting but without updating the cache,", 107, 40, 124, 300, 8
|
||||
LTEXT "press ""Connect Once"".", 108, 40, 132, 300, 8
|
||||
LTEXT "If you want to abandon the connection completely, press ""Cancel"".", 109, 40, 144, 300, 8
|
||||
LTEXT "Pressing ""Cancel"" is the ONLY guaranteed safe choice.", 110, 40, 152, 300, 8
|
||||
|
||||
ICON "", IDC_HK_ICON, 10, 16, 0, 0
|
||||
|
||||
PUSHBUTTON "Cancel", IDCANCEL, 288, 180, 40, 14
|
||||
PUSHBUTTON "Accept", IDC_HK_ACCEPT, 168, 180, 40, 14
|
||||
PUSHBUTTON "Connect Once", IDC_HK_ONCE, 216, 180, 64, 14
|
||||
PUSHBUTTON "More info...", IDC_HK_MOREINFO, 60, 180, 64, 14
|
||||
PUSHBUTTON "Help", IDHELP, 12, 180, 40, 14
|
||||
|
||||
EDITTEXT IDC_HK_HOST, 40, 44, 300, 12, ES_READONLY | ES_LEFT, 0
|
||||
EDITTEXT IDC_HK_FINGERPRINT, 40, 92, 300, 12, ES_READONLY | ES_LEFT, 0
|
||||
EDITTEXT IDC_HK_TEXT, 40, 20, 290, 200, ES_READONLY | ES_MULTILINE | ES_LEFT, WS_EX_STATICEDGE
|
||||
END
|
||||
|
||||
/* Accelerators used: clw */
|
||||
IDD_HK_MOREINFO DIALOG DISCARDABLE 140, 40, 400, 156
|
||||
IDD_HK_MOREINFO DIALOG DISCARDABLE 140, 40, 400, 300
|
||||
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "PuTTY: information about the server's host key"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
CLASS "PuTTYHostKeyMoreInfo"
|
||||
BEGIN
|
||||
LTEXT "SHA256 fingerprint:", 100, 12, 12, 80, 8
|
||||
EDITTEXT IDC_HKI_SHA256, 100, 10, 288, 12, ES_READONLY
|
||||
LTEXT "MD5 fingerprint:", 101, 12, 28, 80, 8
|
||||
EDITTEXT IDC_HKI_MD5, 100, 26, 288, 12, ES_READONLY
|
||||
LTEXT "Full public key:", 102, 12, 44, 376, 8
|
||||
EDITTEXT IDC_HKI_PUBKEY, 12, 54, 376, 64, ES_READONLY | ES_MULTILINE | ES_LEFT | ES_AUTOVSCROLL, WS_EX_STATICEDGE
|
||||
DEFPUSHBUTTON "&Close", IDOK, 176, 130, 48, 14
|
||||
END
|
||||
|
||||
|
@ -13,8 +13,7 @@
|
||||
#define IDD_ABOUTBOX 111
|
||||
#define IDD_RECONF 112
|
||||
#define IDD_LICENCEBOX 113
|
||||
#define IDD_HK_ABSENT 114
|
||||
#define IDD_HK_WRONG 115
|
||||
#define IDD_HOSTKEY 114
|
||||
#define IDD_HK_MOREINFO 116
|
||||
#define IDD_CA_CONFIG 117
|
||||
|
||||
@ -35,6 +34,7 @@
|
||||
|
||||
#define IDC_HK_ICON 98
|
||||
#define IDC_HK_TITLE 99
|
||||
#define IDC_HK_TEXT 100
|
||||
#define IDC_HK_ACCEPT 1001
|
||||
#define IDC_HK_ONCE 1000
|
||||
#define IDC_HK_HOST 1002
|
||||
|
@ -346,6 +346,7 @@ static const SeatVtable win_seat_vt = {
|
||||
.confirm_ssh_host_key = win_seat_confirm_ssh_host_key,
|
||||
.confirm_weak_crypto_primitive = win_seat_confirm_weak_crypto_primitive,
|
||||
.confirm_weak_cached_hostkey = win_seat_confirm_weak_cached_hostkey,
|
||||
.prompt_descriptions = win_seat_prompt_descriptions,
|
||||
.is_utf8 = win_seat_is_utf8,
|
||||
.echoedit_update = nullseat_echoedit_update,
|
||||
.get_x_display = nullseat_get_x_display,
|
||||
|
Reference in New Issue
Block a user