1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100
|
From f6e13293378efa51cdc50dfd4c11af97354de7ad Mon Sep 17 00:00:00 2001
From: Simon Tatham <anakin@pobox.com>
Date: Wed, 22 Nov 2023 08:57:54 +0000
Subject: Refactor confirm_weak to use SeatDialogText.
This centralises the messages for weak crypto algorithms (general, and
host keys in particular, the latter including a list of all the other
available host key types) into ssh/common.c, in much the same way as
we previously did for ordinary host key warnings.
The reason is the same too: I'm about to want to vary the text in one
of those dialog boxes, so it's convenient to start by putting it
somewhere that I can modify just once.
Origin: upstream, https://git.tartarus.org/?p=simon/putty.git;a=commit;h=9fcbb86f715bc03e58921482efe663aa0c662d62
Last-Update: 2023-12-18
Patch-Name: refactor-confirm_weak.patch
---
console.c | 14 +-----
proxy/sshproxy.c | 48 +++++++++++++++----
putty.h | 24 +++++-----
ssh.h | 6 +++
ssh/common.c | 73 +++++++++++++++++++++++++++++
ssh/login1.c | 2 +-
ssh/server.c | 4 +-
ssh/transport2.c | 21 ++++-----
stubs/null-seat.c | 6 ++-
unix/console.c | 56 ++++++++++++++---------
unix/dialog.c | 96 ++++++++++++++++++++------------------
unix/platform.h | 4 +-
utils/tempseat.c | 4 +-
windows/console.c | 64 ++++++++++++++------------
windows/dialog.c | 112 ++++++++++++++++++++++-----------------------
windows/platform.h | 4 +-
16 files changed, 331 insertions(+), 207 deletions(-)
diff --git a/console.c b/console.c
index 62c64aff..0ecfb265 100644
--- a/console.c
+++ b/console.c
@@ -9,18 +9,6 @@
#include "misc.h"
#include "console.h"
-const char weakcrypto_msg_common_fmt[] =
- "The first %s supported by the server is\n"
- "%s, which is below the configured warning threshold.\n";
-
-const char weakhk_msg_common_fmt[] =
- "The first host key type we have stored for this server\n"
- "is %s, which is below the configured warning threshold.\n"
- "The server also provides the following types of host key\n"
- "above the threshold, which we do not have stored:\n"
- "%s\n";
-
-const char console_continue_prompt[] = "Continue with connection? (y/n) ";
const char console_abandoned_msg[] = "Connection abandoned.\n";
const SeatDialogPromptDescriptions *console_prompt_descriptions(Seat *seat)
@@ -30,6 +18,8 @@ const SeatDialogPromptDescriptions *console_prompt_descriptions(Seat *seat)
.hk_connect_once_action = "enter \"n\"",
.hk_cancel_action = "press Return",
.hk_cancel_action_Participle = "Pressing Return",
+ .weak_accept_action = "enter \"y\"",
+ .weak_cancel_action = "enter \"n\"",
};
return &descs;
}
diff --git a/proxy/sshproxy.c b/proxy/sshproxy.c
index 165c6c0a..4a797d38 100644
--- a/proxy/sshproxy.c
+++ b/proxy/sshproxy.c
@@ -430,8 +430,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);
@@ -442,22 +466,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);
@@ -468,16 +494,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");
}
diff --git a/putty.h b/putty.h
index 5c3adfe9..2af181f2 100644
--- a/putty.h
+++ b/putty.h
@@ -1292,7 +1292,7 @@ struct SeatVtable {
* confirm_ssh_host_key above.
*/
SeatPromptResult (*confirm_weak_crypto_primitive)(
- Seat *seat, const char *algtype, const char *algname,
+ Seat *seat, SeatDialogText *text,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx);
/*
@@ -1303,11 +1303,10 @@ struct SeatVtable {
* This form is used in the case where we're using a host key
* below the warning threshold because that's the best one we have
* cached, but at least one host key algorithm *above* the
- * threshold is available that we don't have cached. 'betteralgs'
- * lists the better algorithm(s).
+ * threshold is available that we don't have cached.
*/
SeatPromptResult (*confirm_weak_cached_hostkey)(
- Seat *seat, const char *algname, const char *betteralgs,
+ Seat *seat, SeatDialogText *text,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx);
/*
@@ -1443,15 +1442,15 @@ static inline SeatPromptResult seat_confirm_ssh_host_key(
{ return iseat.seat->vt->confirm_ssh_host_key(
iseat.seat, h, p, ktyp, kstr, text, helpctx, cb, ctx); }
static inline SeatPromptResult seat_confirm_weak_crypto_primitive(
- InteractionReadySeat iseat, const char *atyp, const char *aname,
+ InteractionReadySeat iseat, SeatDialogText *text,
void (*cb)(void *ctx, SeatPromptResult result), void *ctx)
{ return iseat.seat->vt->confirm_weak_crypto_primitive(
- iseat.seat, atyp, aname, cb, ctx); }
+ iseat.seat, text, cb, ctx); }
static inline SeatPromptResult seat_confirm_weak_cached_hostkey(
- InteractionReadySeat iseat, const char *aname, const char *better,
+ InteractionReadySeat iseat, SeatDialogText *text,
void (*cb)(void *ctx, SeatPromptResult result), void *ctx)
{ return iseat.seat->vt->confirm_weak_cached_hostkey(
- iseat.seat, aname, better, cb, ctx); }
+ iseat.seat, text, cb, ctx); }
static inline const SeatDialogPromptDescriptions *seat_prompt_descriptions(
Seat *seat)
{ return seat->vt->prompt_descriptions(seat); }
@@ -1504,6 +1503,7 @@ struct SeatDialogPromptDescriptions {
const char *hk_accept_action;
const char *hk_connect_once_action;
const char *hk_cancel_action, *hk_cancel_action_Participle;
+ const char *weak_accept_action, *weak_cancel_action;
};
/* In the utils subdir: print a message to the Seat which can't be
@@ -1536,10 +1536,10 @@ SeatPromptResult nullseat_confirm_ssh_host_key(
char *keystr, SeatDialogText *text, HelpCtx helpctx,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx);
SeatPromptResult nullseat_confirm_weak_crypto_primitive(
- Seat *seat, const char *algtype, const char *algname,
+ Seat *seat, SeatDialogText *text,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx);
SeatPromptResult nullseat_confirm_weak_cached_hostkey(
- Seat *seat, const char *algname, const char *betteralgs,
+ Seat *seat, SeatDialogText *text,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx);
const SeatDialogPromptDescriptions *nullseat_prompt_descriptions(Seat *seat);
bool nullseat_is_never_utf8(Seat *seat);
@@ -1572,10 +1572,10 @@ SeatPromptResult console_confirm_ssh_host_key(
char *keystr, SeatDialogText *text, HelpCtx helpctx,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx);
SeatPromptResult console_confirm_weak_crypto_primitive(
- Seat *seat, const char *algtype, const char *algname,
+ Seat *seat, SeatDialogText *text,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx);
SeatPromptResult console_confirm_weak_cached_hostkey(
- Seat *seat, const char *algname, const char *betteralgs,
+ Seat *seat, SeatDialogText *text,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx);
StripCtrlChars *console_stripctrl_new(
Seat *seat, BinarySink *bs_out, SeatInteractionContext sic);
diff --git a/ssh.h b/ssh.h
index 5ecef0cb..3b9df7d2 100644
--- a/ssh.h
+++ b/ssh.h
@@ -1906,6 +1906,12 @@ SeatPromptResult verify_ssh_host_key(
ssh_key *key, const char *keytype, char *keystr, const char *keydisp,
char **fingerprints, int ca_count,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx);
+SeatPromptResult confirm_weak_crypto_primitive(
+ InteractionReadySeat iseat, const char *algtype, const char *algname,
+ void (*callback)(void *ctx, SeatPromptResult result), void *ctx);
+SeatPromptResult confirm_weak_cached_hostkey(
+ InteractionReadySeat iseat, const char *algname, const char **betteralgs,
+ void (*callback)(void *ctx, SeatPromptResult result), void *ctx);
typedef struct ssh_transient_hostkey_cache ssh_transient_hostkey_cache;
ssh_transient_hostkey_cache *ssh_transient_hostkey_cache_new(void);
diff --git a/ssh/common.c b/ssh/common.c
index a1b4d77d..af534e3b 100644
--- a/ssh/common.c
+++ b/ssh/common.c
@@ -1075,6 +1075,79 @@ SeatPromptResult verify_ssh_host_key(
return toret;
}
+SeatPromptResult confirm_weak_crypto_primitive(
+ InteractionReadySeat iseat, const char *algtype, const char *algname,
+ void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
+{
+ SeatDialogText *text = seat_dialog_text_new();
+ const SeatDialogPromptDescriptions *pds =
+ seat_prompt_descriptions(iseat.seat);
+
+ seat_dialog_text_append(text, SDT_TITLE, "%s Security Alert", appname);
+
+ seat_dialog_text_append(
+ text, SDT_PARA,
+ "The first %s supported by the server is %s, "
+ "which is below the configured warning threshold.",
+ algtype, algname);
+
+ /* In batch mode, we print the above information and then this
+ * abort message, and stop. */
+ seat_dialog_text_append(text, SDT_BATCH_ABORT, "Connection abandoned.");
+
+ seat_dialog_text_append(
+ text, SDT_PARA, "To accept the risk and continue, %s. "
+ "To abandon the connection, %s.",
+ pds->weak_accept_action, pds->weak_cancel_action);
+
+ seat_dialog_text_append(text, SDT_PROMPT, "Continue with connection?");
+
+ SeatPromptResult toret = seat_confirm_weak_crypto_primitive(
+ iseat, text, callback, ctx);
+ seat_dialog_text_free(text);
+ return toret;
+}
+
+SeatPromptResult confirm_weak_cached_hostkey(
+ InteractionReadySeat iseat, const char *algname, const char **betteralgs,
+ void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
+{
+ SeatDialogText *text = seat_dialog_text_new();
+ const SeatDialogPromptDescriptions *pds =
+ seat_prompt_descriptions(iseat.seat);
+
+ seat_dialog_text_append(text, SDT_TITLE, "%s Security Alert", appname);
+
+ seat_dialog_text_append(
+ text, SDT_PARA,
+ "The first host key type we have stored for this server "
+ "is %s, which is below the configured warning threshold.", algname);
+
+ seat_dialog_text_append(
+ text, SDT_PARA,
+ "The server also provides the following types of host key "
+ "above the threshold, which we do not have stored:");
+
+ for (const char **p = betteralgs; *p; p++)
+ seat_dialog_text_append(text, SDT_DISPLAY, "%s", *p);
+
+ /* In batch mode, we print the above information and then this
+ * abort message, and stop. */
+ seat_dialog_text_append(text, SDT_BATCH_ABORT, "Connection abandoned.");
+
+ seat_dialog_text_append(
+ text, SDT_PARA, "To accept the risk and continue, %s. "
+ "To abandon the connection, %s.",
+ pds->weak_accept_action, pds->weak_cancel_action);
+
+ seat_dialog_text_append(text, SDT_PROMPT, "Continue with connection?");
+
+ SeatPromptResult toret = seat_confirm_weak_cached_hostkey(
+ iseat, text, callback, ctx);
+ seat_dialog_text_free(text);
+ return toret;
+}
+
/* ----------------------------------------------------------------------
* Common functions shared between SSH-1 layers.
*/
diff --git a/ssh/login1.c b/ssh/login1.c
index 52aaea0b..ec316575 100644
--- a/ssh/login1.c
+++ b/ssh/login1.c
@@ -322,7 +322,7 @@ static void ssh1_login_process_queue(PacketProtocolLayer *ppl)
/* Warn about chosen cipher if necessary. */
if (warn) {
- s->spr = seat_confirm_weak_crypto_primitive(
+ s->spr = confirm_weak_crypto_primitive(
ppl_get_iseat(&s->ppl), "cipher", cipher_string,
ssh1_login_dialog_callback, s);
crMaybeWaitUntilV(s->spr.kind != SPRK_INCOMPLETE);
diff --git a/ssh/server.c b/ssh/server.c
index 188426b3..a0aa277d 100644
--- a/ssh/server.c
+++ b/ssh/server.c
@@ -98,11 +98,11 @@ void mainchan_terminal_size(mainchan *mc, int width, int height) {}
/* Seat functions to ensure we don't get choosy about crypto - as the
* server, it's not up to us to give user warnings */
static SeatPromptResult server_confirm_weak_crypto_primitive(
- Seat *seat, const char *algtype, const char *algname,
+ Seat *seat, SeatDialogText *text,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
{ return SPR_OK; }
static SeatPromptResult server_confirm_weak_cached_hostkey(
- Seat *seat, const char *algname, const char *betteralgs,
+ Seat *seat, SeatDialogText *text,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
{ return SPR_OK; }
diff --git a/ssh/transport2.c b/ssh/transport2.c
index 42fcb34e..ec93dae0 100644
--- a/ssh/transport2.c
+++ b/ssh/transport2.c
@@ -1511,7 +1511,8 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl)
if (s->warn_hk) {
int j, k;
- char *betteralgs;
+ const char **betteralgs = NULL;
+ size_t nbetter = 0, bettersize = 0;
/*
* Change warning box wording depending on why we chose a
@@ -1520,7 +1521,6 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl)
* could usefully cross-certify. Otherwise, use the same
* standard wording as any other weak crypto primitive.
*/
- betteralgs = NULL;
for (j = 0; j < s->n_uncert_hostkeys; j++) {
const struct ssh_signkey_with_user_pref_id *hktype =
&ssh2_hostkey_algs[s->uncert_hostkeys[j]];
@@ -1535,19 +1535,16 @@ static void ssh2_transport_process_queue(PacketProtocolLayer *ppl)
}
}
if (better) {
- if (betteralgs) {
- char *old_ba = betteralgs;
- betteralgs = dupcat(betteralgs, ",", hktype->alg->ssh_id);
- sfree(old_ba);
- } else {
- betteralgs = dupstr(hktype->alg->ssh_id);
- }
+ sgrowarray(betteralgs, bettersize, nbetter);
+ betteralgs[nbetter++] = hktype->alg->ssh_id;
}
}
if (betteralgs) {
/* Use the special warning prompt that lets us provide
* a list of better algorithms */
- s->spr = seat_confirm_weak_cached_hostkey(
+ sgrowarray(betteralgs, bettersize, nbetter);
+ betteralgs[nbetter] = NULL;
+ s->spr = confirm_weak_cached_hostkey(
ppl_get_iseat(&s->ppl), s->hostkey_alg->ssh_id, betteralgs,
ssh2_transport_dialog_callback, s);
sfree(betteralgs);
@@ -2386,7 +2383,7 @@ static int ca_blob_compare(void *av, void *bv)
}
/*
- * Wrapper on seat_confirm_weak_crypto_primitive(), which uses the
+ * Wrapper on confirm_weak_crypto_primitive(), which uses the
* tree234 s->weak_algorithms_consented_to to ensure we ask at most
* once about any given crypto primitive.
*/
@@ -2398,7 +2395,7 @@ static SeatPromptResult ssh2_transport_confirm_weak_crypto_primitive(
return SPR_OK;
add234(s->weak_algorithms_consented_to, (void *)alg);
- return seat_confirm_weak_crypto_primitive(
+ return confirm_weak_crypto_primitive(
ppl_get_iseat(&s->ppl), type, name, ssh2_transport_dialog_callback, s);
}
diff --git a/stubs/null-seat.c b/stubs/null-seat.c
index 37cb0f4c..2db45127 100644
--- a/stubs/null-seat.c
+++ b/stubs/null-seat.c
@@ -26,11 +26,11 @@ SeatPromptResult nullseat_confirm_ssh_host_key(
void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
{ return SPR_SW_ABORT("this seat can't handle interactive prompts"); }
SeatPromptResult nullseat_confirm_weak_crypto_primitive(
- Seat *seat, const char *algtype, const char *algname,
+ Seat *seat, SeatDialogText *text,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
{ return SPR_SW_ABORT("this seat can't handle interactive prompts"); }
SeatPromptResult nullseat_confirm_weak_cached_hostkey(
- Seat *seat, const char *algname, const char *betteralgs,
+ Seat *seat, SeatDialogText *text,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
{ return SPR_SW_ABORT("this seat can't handle interactive prompts"); }
bool nullseat_is_never_utf8(Seat *seat) { return false; }
@@ -60,6 +60,8 @@ const SeatDialogPromptDescriptions *nullseat_prompt_descriptions(Seat *seat)
.hk_connect_once_action = "",
.hk_cancel_action = "",
.hk_cancel_action_Participle = "",
+ .weak_accept_action = "",
+ .weak_cancel_action = "",
};
return &descs;
}
diff --git a/unix/console.c b/unix/console.c
index 286ecf29..ba35ccea 100644
--- a/unix/console.c
+++ b/unix/console.c
@@ -102,20 +102,18 @@ static int block_and_read(int fd, void *buf, size_t len)
return ret;
}
-SeatPromptResult console_confirm_ssh_host_key(
- Seat *seat, const char *host, int port, const char *keytype,
- char *keystr, SeatDialogText *text, HelpCtx helpctx,
- void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
+/*
+ * Helper function to print the message from a SeatDialogText. Returns
+ * the final prompt to print on the input line, or NULL if a
+ * batch-mode abort is needed. In the latter case it will have printed
+ * the abort text already.
+ */
+static const char *console_print_seatdialogtext(SeatDialogText *text)
{
- char line[32];
- struct termios cf;
const char *prompt = NULL;
-
stdio_sink errsink[1];
stdio_sink_init(errsink, stderr);
- premsg(&cf);
-
for (SeatDialogTextItem *item = text->items,
*end = item+text->nitems; item < end; item++) {
switch (item->type) {
@@ -135,8 +133,7 @@ SeatPromptResult console_confirm_ssh_host_key(
if (console_batch_mode) {
fprintf(stderr, "%s\n", item->text);
fflush(stderr);
- postmsg(&cf);
- return SPR_SW_ABORT("Cannot confirm a host key in batch mode");
+ return NULL;
}
break;
case SDT_PROMPT:
@@ -146,7 +143,26 @@ SeatPromptResult console_confirm_ssh_host_key(
break;
}
}
+
assert(prompt); /* something in the SeatDialogText should have set this */
+ return prompt;
+}
+
+SeatPromptResult console_confirm_ssh_host_key(
+ Seat *seat, const char *host, int port, const char *keytype,
+ char *keystr, SeatDialogText *text, HelpCtx helpctx,
+ void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
+{
+ char line[32];
+ struct termios cf;
+
+ premsg(&cf);
+
+ const char *prompt = console_print_seatdialogtext(text);
+ if (!prompt) {
+ postmsg(&cf);
+ return SPR_SW_ABORT("Cannot confirm a host key in batch mode");
+ }
while (true) {
fprintf(stderr,
@@ -202,23 +218,22 @@ SeatPromptResult console_confirm_ssh_host_key(
}
SeatPromptResult console_confirm_weak_crypto_primitive(
- Seat *seat, const char *algtype, const char *algname,
+ Seat *seat, SeatDialogText *text,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
{
char line[32];
struct termios cf;
premsg(&cf);
- fprintf(stderr, weakcrypto_msg_common_fmt, algtype, algname);
- if (console_batch_mode) {
- fputs(console_abandoned_msg, stderr);
+ const char *prompt = console_print_seatdialogtext(text);
+ if (!prompt) {
postmsg(&cf);
return SPR_SW_ABORT("Cannot confirm a weak crypto primitive "
"in batch mode");
}
- fputs(console_continue_prompt, stderr);
+ fprintf(stderr, "%s (y/n) ", prompt);
fflush(stderr);
{
@@ -244,23 +259,22 @@ SeatPromptResult console_confirm_weak_crypto_primitive(
}
SeatPromptResult console_confirm_weak_cached_hostkey(
- Seat *seat, const char *algname, const char *betteralgs,
+ Seat *seat, SeatDialogText *text,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
{
char line[32];
struct termios cf;
premsg(&cf);
- fprintf(stderr, weakhk_msg_common_fmt, algname, betteralgs);
- if (console_batch_mode) {
- fputs(console_abandoned_msg, stderr);
+ const char *prompt = console_print_seatdialogtext(text);
+ if (!prompt) {
postmsg(&cf);
return SPR_SW_ABORT("Cannot confirm a weak cached host key "
"in batch mode");
}
- fputs(console_continue_prompt, stderr);
+ fprintf(stderr, "%s (y/n) ", prompt);
fflush(stderr);
{
diff --git a/unix/dialog.c b/unix/dialog.c
index 5846466a..80f886bb 100644
--- a/unix/dialog.c
+++ b/unix/dialog.c
@@ -3601,27 +3601,20 @@ const SeatDialogPromptDescriptions *gtk_seat_prompt_descriptions(Seat *seat)
.hk_connect_once_action = "press \"Connect Once\"",
.hk_cancel_action = "press \"Cancel\"",
.hk_cancel_action_Participle = "Pressing \"Cancel\"",
+ .weak_accept_action = "press \"Yes\"",
+ .weak_cancel_action = "press \"No\"",
};
return &descs;
}
-SeatPromptResult gtk_seat_confirm_ssh_host_key(
- Seat *seat, const char *host, int port, const char *keytype,
- char *keystr, SeatDialogText *text, HelpCtx helpctx,
- void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
+/*
+ * Format a SeatDialogText into a strbuf, also adjusting the box width
+ * to cope with displayed text. Returns the dialog box title.
+ */
+static const char *gtk_format_seatdialogtext(
+ SeatDialogText *text, strbuf *dlg_text, int *width)
{
- static const struct message_box_button button_array_hostkey[] = {
- {"Accept", 'a', 0, 2},
- {"Connect Once", 'o', 0, 1},
- {"Cancel", 'c', -1, 0},
- };
- static const struct message_box_buttons buttons_hostkey = {
- button_array_hostkey, lenof(button_array_hostkey),
- };
-
const char *dlg_title = NULL;
- strbuf *dlg_text = strbuf_new();
- int width = string_width("default dialog width determination string");
for (SeatDialogTextItem *item = text->items,
*end = item + text->nitems; item < end; item++) {
@@ -3632,8 +3625,8 @@ SeatPromptResult gtk_seat_confirm_ssh_host_key(
case SDT_DISPLAY: {
put_fmt(dlg_text, "%s\n\n", item->text);
int thiswidth = string_width(item->text);
- if (width < thiswidth)
- width = thiswidth;
+ if (*width < thiswidth)
+ *width = thiswidth;
break;
}
case SDT_SCARY_HEADING:
@@ -3647,8 +3640,33 @@ SeatPromptResult gtk_seat_confirm_ssh_host_key(
break;
}
}
+
+ /*
+ * Trim trailing newlines.
+ */
while (strbuf_chomp(dlg_text, '\n'));
+ return dlg_title;
+}
+
+SeatPromptResult gtk_seat_confirm_ssh_host_key(
+ Seat *seat, const char *host, int port, const char *keytype,
+ char *keystr, SeatDialogText *text, HelpCtx helpctx,
+ void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
+{
+ static const struct message_box_button button_array_hostkey[] = {
+ {"Accept", 'a', 0, 2},
+ {"Connect Once", 'o', 0, 1},
+ {"Cancel", 'c', -1, 0},
+ };
+ static const struct message_box_buttons buttons_hostkey = {
+ button_array_hostkey, lenof(button_array_hostkey),
+ };
+
+ int width = string_width("default dialog width determination string");
+ strbuf *dlg_text = strbuf_new();
+ const char *dlg_title = gtk_format_seatdialogtext(text, dlg_text, &width);
+
GtkWidget *mainwin, *msgbox;
struct confirm_ssh_host_key_dialog_ctx *result_ctx =
@@ -3744,19 +3762,16 @@ static void simple_prompt_result_spr_callback(void *vctx, int result)
* below the configured 'warn' threshold).
*/
SeatPromptResult gtk_seat_confirm_weak_crypto_primitive(
- Seat *seat, const char *algtype, const char *algname,
+ Seat *seat, SeatDialogText *text,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
{
- static const char msg[] =
- "The first %s supported by the server is "
- "%s, which is below the configured warning threshold.\n"
- "Continue with connection?";
-
- char *text;
struct simple_prompt_result_spr_ctx *result_ctx;
GtkWidget *mainwin, *msgbox;
- text = dupprintf(msg, algtype, algname);
+ int width = string_width("Reasonably long line of text "
+ "as a width template");
+ strbuf *dlg_text = strbuf_new();
+ const char *dlg_title = gtk_format_seatdialogtext(text, dlg_text, &width);
result_ctx = snew(struct simple_prompt_result_spr_ctx);
result_ctx->callback = callback;
@@ -3766,33 +3781,26 @@ SeatPromptResult gtk_seat_confirm_weak_crypto_primitive(
mainwin = GTK_WIDGET(gtk_seat_get_window(seat));
msgbox = create_message_box(
- mainwin, "PuTTY Security Alert", text,
- string_width("Reasonably long line of text as a width template"),
- false, &buttons_yn, simple_prompt_result_spr_callback, result_ctx);
+ mainwin, dlg_title, dlg_text->s, width, false,
+ &buttons_yn, simple_prompt_result_spr_callback, result_ctx);
register_dialog(seat, result_ctx->dialog_slot, msgbox);
- sfree(text);
+ strbuf_free(dlg_text);
return SPR_INCOMPLETE;
}
SeatPromptResult gtk_seat_confirm_weak_cached_hostkey(
- Seat *seat, const char *algname, const char *betteralgs,
+ Seat *seat, SeatDialogText *text,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
{
- static const char msg[] =
- "The first host key type we have stored for this server\n"
- "is %s, which is below the configured warning threshold.\n"
- "The server also provides the following types of host key\n"
- "above the threshold, which we do not have stored:\n"
- "%s\n"
- "Continue with connection?";
-
- char *text;
struct simple_prompt_result_spr_ctx *result_ctx;
GtkWidget *mainwin, *msgbox;
- text = dupprintf(msg, algname, betteralgs);
+ int width = string_width("is ecdsa-nistp521, which is below the configured"
+ " warning threshold.");
+ strbuf *dlg_text = strbuf_new();
+ const char *dlg_title = gtk_format_seatdialogtext(text, dlg_text, &width);
result_ctx = snew(struct simple_prompt_result_spr_ctx);
result_ctx->callback = callback;
@@ -3802,13 +3810,11 @@ SeatPromptResult gtk_seat_confirm_weak_cached_hostkey(
mainwin = GTK_WIDGET(gtk_seat_get_window(seat));
msgbox = create_message_box(
- mainwin, "PuTTY Security Alert", text,
- string_width("is ecdsa-nistp521, which is below the configured"
- " warning threshold."),
- false, &buttons_yn, simple_prompt_result_spr_callback, result_ctx);
+ mainwin, dlg_title, dlg_text->s, width, false,
+ &buttons_yn, simple_prompt_result_spr_callback, result_ctx);
register_dialog(seat, result_ctx->dialog_slot, msgbox);
- sfree(text);
+ strbuf_free(dlg_text);
return SPR_INCOMPLETE;
}
diff --git a/unix/platform.h b/unix/platform.h
index 3b1db9ba..a6bc7ad1 100644
--- a/unix/platform.h
+++ b/unix/platform.h
@@ -225,10 +225,10 @@ SeatPromptResult gtk_seat_confirm_ssh_host_key(
char *keystr, SeatDialogText *text, HelpCtx helpctx,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx);
SeatPromptResult gtk_seat_confirm_weak_crypto_primitive(
- Seat *seat, const char *algtype, const char *algname,
+ Seat *seat, SeatDialogText *text,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx);
SeatPromptResult gtk_seat_confirm_weak_cached_hostkey(
- Seat *seat, const char *algname, const char *betteralgs,
+ Seat *seat, SeatDialogText *text,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx);
const SeatDialogPromptDescriptions *gtk_seat_prompt_descriptions(Seat *seat);
#ifdef MAY_REFER_TO_GTK_IN_HEADERS
diff --git a/utils/tempseat.c b/utils/tempseat.c
index ad37b0e3..39e641f9 100644
--- a/utils/tempseat.c
+++ b/utils/tempseat.c
@@ -255,7 +255,7 @@ static SeatPromptResult tempseat_confirm_ssh_host_key(
}
static SeatPromptResult tempseat_confirm_weak_crypto_primitive(
- Seat *seat, const char *algtype, const char *algname,
+ Seat *seat, SeatDialogText *text,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
{
unreachable("confirm_weak_crypto_primitive "
@@ -263,7 +263,7 @@ static SeatPromptResult tempseat_confirm_weak_crypto_primitive(
}
static SeatPromptResult tempseat_confirm_weak_cached_hostkey(
- Seat *seat, const char *algname, const char *betteralgs,
+ Seat *seat, SeatDialogText *text,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
{
unreachable("confirm_weak_cached_hostkey "
diff --git a/windows/console.c b/windows/console.c
index 2fd572b4..df10ae51 100644
--- a/windows/console.c
+++ b/windows/console.c
@@ -32,20 +32,18 @@ void console_print_error_msg(const char *prefix, const char *msg)
fflush(stderr);
}
-SeatPromptResult console_confirm_ssh_host_key(
- Seat *seat, const char *host, int port, const char *keytype,
- char *keystr, SeatDialogText *text, HelpCtx helpctx,
- void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
+/*
+ * Helper function to print the message from a SeatDialogText. Returns
+ * the final prompt to print on the input line, or NULL if a
+ * batch-mode abort is needed. In the latter case it will have printed
+ * the abort text already.
+ */
+static const char *console_print_seatdialogtext(SeatDialogText *text)
{
- HANDLE hin;
- DWORD savemode, i;
const char *prompt = NULL;
-
stdio_sink errsink[1];
stdio_sink_init(errsink, stderr);
- char line[32];
-
for (SeatDialogTextItem *item = text->items,
*end = item+text->nitems; item < end; item++) {
switch (item->type) {
@@ -65,7 +63,7 @@ SeatPromptResult console_confirm_ssh_host_key(
if (console_batch_mode) {
fprintf(stderr, "%s\n", item->text);
fflush(stderr);
- return SPR_SW_ABORT("Cannot confirm a host key in batch mode");
+ return NULL;
}
break;
case SDT_PROMPT:
@@ -76,6 +74,22 @@ SeatPromptResult console_confirm_ssh_host_key(
}
}
assert(prompt); /* something in the SeatDialogText should have set this */
+ return prompt;
+}
+
+SeatPromptResult console_confirm_ssh_host_key(
+ Seat *seat, const char *host, int port, const char *keytype,
+ char *keystr, SeatDialogText *text, HelpCtx helpctx,
+ void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
+{
+ HANDLE hin;
+ DWORD savemode, i;
+
+ const char *prompt = console_print_seatdialogtext(text);
+ if (!prompt)
+ return SPR_SW_ABORT("Cannot confirm a host key in batch mode");
+
+ char line[32];
while (true) {
fprintf(stderr,
@@ -128,23 +142,20 @@ SeatPromptResult console_confirm_ssh_host_key(
}
SeatPromptResult console_confirm_weak_crypto_primitive(
- Seat *seat, const char *algtype, const char *algname,
+ Seat *seat, SeatDialogText *text,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
{
HANDLE hin;
DWORD savemode, i;
- char line[32];
-
- fprintf(stderr, weakcrypto_msg_common_fmt, algtype, algname);
-
- if (console_batch_mode) {
- fputs(console_abandoned_msg, stderr);
+ const char *prompt = console_print_seatdialogtext(text);
+ if (!prompt)
return SPR_SW_ABORT("Cannot confirm a weak crypto primitive "
"in batch mode");
- }
- fputs(console_continue_prompt, stderr);
+ char line[32];
+
+ fprintf(stderr, "%s (y/n) ", prompt);
fflush(stderr);
hin = GetStdHandle(STD_INPUT_HANDLE);
@@ -163,23 +174,20 @@ SeatPromptResult console_confirm_weak_crypto_primitive(
}
SeatPromptResult console_confirm_weak_cached_hostkey(
- Seat *seat, const char *algname, const char *betteralgs,
+ Seat *seat, SeatDialogText *text,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
{
HANDLE hin;
DWORD savemode, i;
- char line[32];
-
- fprintf(stderr, weakhk_msg_common_fmt, algname, betteralgs);
-
- if (console_batch_mode) {
- fputs(console_abandoned_msg, stderr);
+ const char *prompt = console_print_seatdialogtext(text);
+ if (!prompt)
return SPR_SW_ABORT("Cannot confirm a weak cached host key "
"in batch mode");
- }
- fputs(console_continue_prompt, stderr);
+ char line[32];
+
+ fprintf(stderr, "%s (y/n) ", prompt);
fflush(stderr);
hin = GetStdHandle(STD_INPUT_HANDLE);
diff --git a/windows/dialog.c b/windows/dialog.c
index 5e49cca9..03d63806 100644
--- a/windows/dialog.c
+++ b/windows/dialog.c
@@ -963,6 +963,39 @@ static INT_PTR HostKeyMoreInfoProc(HWND hwnd, UINT msg, WPARAM wParam,
return 0;
}
+static const char *process_seatdialogtext(
+ strbuf *dlg_text, const char **scary_heading, SeatDialogText *text)
+{
+ const char *dlg_title = "";
+
+ for (SeatDialogTextItem *item = text->items,
+ *end = item + 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:
+ assert(scary_heading != NULL && "only expect a scary heading if "
+ "the dialog has somewhere to put it");
+ *scary_heading = item->text;
+ break;
+ case SDT_TITLE:
+ dlg_title = item->text;
+ break;
+ default:
+ break;
+ }
+ }
+
+ /* Trim any trailing newlines */
+ while (strbuf_chomp(dlg_text, '\r') || strbuf_chomp(dlg_text, '\n'));
+
+ return dlg_title;
+}
+
static INT_PTR HostKeyDialogProc(HWND hwnd, UINT msg,
WPARAM wParam, LPARAM lParam, void *vctx)
{
@@ -971,32 +1004,15 @@ static INT_PTR HostKeyDialogProc(HWND hwnd, UINT msg,
switch (msg) {
case WM_INITDIALOG: {
strbuf *dlg_text = strbuf_new();
- const char *dlg_title = "";
- ctx->has_title = false;
- LPCTSTR iconid = IDI_QUESTION;
+ const char *scary_heading = NULL;
+ const char *dlg_title = process_seatdialogtext(
+ dlg_text, &scary_heading, ctx->text);
- 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->has_title = true;
- break;
- case SDT_TITLE:
- dlg_title = item->text;
- break;
- default:
- break;
- }
+ LPCTSTR iconid = IDI_QUESTION;
+ if (scary_heading) {
+ SetDlgItemText(hwnd, IDC_HK_TITLE, scary_heading);
+ iconid = IDI_WARNING;
}
- while (strbuf_chomp(dlg_text, '\r') || strbuf_chomp(dlg_text, '\n'));
SetDlgItemText(hwnd, IDC_HK_TEXT, dlg_text->s);
MakeDlgItemBorderless(hwnd, IDC_HK_TEXT);
@@ -1135,6 +1151,8 @@ const SeatDialogPromptDescriptions *win_seat_prompt_descriptions(Seat *seat)
.hk_connect_once_action = "press \"Connect Once\"",
.hk_cancel_action = "press \"Cancel\"",
.hk_cancel_action_Participle = "Pressing \"Cancel\"",
+ .weak_accept_action = "press \"Yes\"",
+ .weak_cancel_action = "press \"No\"",
};
return &descs;
}
@@ -1169,25 +1187,17 @@ SeatPromptResult win_seat_confirm_ssh_host_key(
* below the configured 'warn' threshold).
*/
SeatPromptResult win_seat_confirm_weak_crypto_primitive(
- Seat *seat, const char *algtype, const char *algname,
+ Seat *seat, SeatDialogText *text,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
{
- static const char mbtitle[] = "%s Security Alert";
- static const char msg[] =
- "The first %s supported by the server\n"
- "is %s, which is below the configured\n"
- "warning threshold.\n"
- "Do you want to continue with this connection?\n";
- char *message, *title;
- int mbret;
+ strbuf *dlg_text = strbuf_new();
+ const char *dlg_title = process_seatdialogtext(dlg_text, NULL, text);
- message = dupprintf(msg, algtype, algname);
- title = dupprintf(mbtitle, appname);
- mbret = MessageBox(NULL, message, title,
- MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2);
+ int mbret = MessageBox(NULL, dlg_text->s, dlg_title,
+ MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2);
socket_reselect_all();
- sfree(message);
- sfree(title);
+ strbuf_free(dlg_text);
+
if (mbret == IDYES)
return SPR_OK;
else
@@ -1195,27 +1205,17 @@ SeatPromptResult win_seat_confirm_weak_crypto_primitive(
}
SeatPromptResult win_seat_confirm_weak_cached_hostkey(
- Seat *seat, const char *algname, const char *betteralgs,
+ Seat *seat, SeatDialogText *text,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx)
{
- static const char mbtitle[] = "%s Security Alert";
- static const char msg[] =
- "The first host key type we have stored for this server\n"
- "is %s, which is below the configured warning threshold.\n"
- "The server also provides the following types of host key\n"
- "above the threshold, which we do not have stored:\n"
- "%s\n"
- "Do you want to continue with this connection?\n";
- char *message, *title;
- int mbret;
+ strbuf *dlg_text = strbuf_new();
+ const char *dlg_title = process_seatdialogtext(dlg_text, NULL, text);
- message = dupprintf(msg, algname, betteralgs);
- title = dupprintf(mbtitle, appname);
- mbret = MessageBox(NULL, message, title,
- MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2);
+ int mbret = MessageBox(NULL, dlg_text->s, dlg_title,
+ MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2);
socket_reselect_all();
- sfree(message);
- sfree(title);
+ strbuf_free(dlg_text);
+
if (mbret == IDYES)
return SPR_OK;
else
diff --git a/windows/platform.h b/windows/platform.h
index 959a207c..cd9ef989 100644
--- a/windows/platform.h
+++ b/windows/platform.h
@@ -237,10 +237,10 @@ SeatPromptResult win_seat_confirm_ssh_host_key(
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,
+ Seat *seat, SeatDialogText *text,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx);
SeatPromptResult win_seat_confirm_weak_cached_hostkey(
- Seat *seat, const char *algname, const char *betteralgs,
+ Seat *seat, SeatDialogText *text,
void (*callback)(void *ctx, SeatPromptResult result), void *ctx);
const SeatDialogPromptDescriptions *win_seat_prompt_descriptions(Seat *seat);
|