X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=windows%2Fwinpgnt.c;h=fe0822e4889f4f10706cbe7b63cae9d53e783252;hb=e22120fe;hp=6e8016408186a9fe3a9e00672bb2aa8642749d40;hpb=984fe3dde809681f91d72152a4f96e91d79a2855;p=PuTTY.git diff --git a/windows/winpgnt.c b/windows/winpgnt.c index 6e801640..fe0822e4 100644 --- a/windows/winpgnt.c +++ b/windows/winpgnt.c @@ -49,7 +49,7 @@ #define APPNAME "Pageant" -extern char ver[]; +extern const char ver[]; static HWND keylist; static HWND aboutbox; @@ -152,10 +152,12 @@ static INT_PTR CALLBACK AboutProc(HWND hwnd, UINT msg, switch (msg) { case WM_INITDIALOG: { + char *buildinfo_text = buildinfo("\r\n"); char *text = dupprintf - ("Pageant\r\n\r\n%s\r\n\r\n%s", - ver, + ("Pageant\r\n\r\n%s\r\n\r\n%s\r\n\r\n%s", + ver, buildinfo_text, "\251 " SHORT_COPYRIGHT_DETAILS ". All rights reserved."); + sfree(buildinfo_text); SetDlgItemText(hwnd, 1000, text); sfree(text); } @@ -301,11 +303,32 @@ void keylist_update(void) for (i = 0; NULL != (skey = pageant_nth_ssh2_key(i)); i++) { char *listentry, *p; int pos; - /* - * Replace spaces with tabs in the fingerprint prefix, for - * nice alignment in the list box, until we encounter a : - * meaning we're into the fingerprint proper. - */ + + /* + * For nice alignment in the list box, we would ideally + * want every entry to align to the tab stop settings, and + * have a column for algorithm name, one for bit count, + * one for hex fingerprint, and one for key comment. + * + * Unfortunately, some of the algorithm names are so long + * that they overflow into the bit-count field. + * Fortunately, at the moment, those are _precisely_ the + * algorithm names that don't need a bit count displayed + * anyway (because for NIST-style ECDSA the bit count is + * mentioned in the algorithm name, and for ssh-ed25519 + * there is only one possible value anyway). So we fudge + * this by simply omitting the bit count field in that + * situation. + * + * This is fragile not only in the face of further key + * types that don't follow this pattern, but also in the + * face of font metrics changes - the Windows semantics + * for list box tab stops is that \t aligns to the next + * one you haven't already exceeded, so I have to guess + * when the key type will overflow past the bit-count tab + * stop and leave out a tab character. Urgh. + */ + p = ssh2_fingerprint(skey->alg, skey->data); listentry = dupprintf("%s\t%s", p, skey->comment); sfree(p); @@ -317,6 +340,26 @@ void keylist_update(void) break; listentry[pos++] = '\t'; } + if (skey->alg != &ssh_dss && skey->alg != &ssh_rsa) { + /* + * Remove the bit-count field, which is between the + * first and second \t. + */ + int outpos; + pos = 0; + while (listentry[pos] && listentry[pos] != '\t') + pos++; + outpos = pos; + pos++; + while (listentry[pos] && listentry[pos] != '\t') + pos++; + while (1) { + if ((listentry[outpos] = listentry[pos]) == '\0') + break; + outpos++; + pos++; + } + } SendDlgItemMessage(keylist, 100, LB_ADDSTRING, 0, (LPARAM) listentry); @@ -1031,6 +1074,8 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) int argc, i; char **argv, **argstart; + dll_hijacking_protection(); + hinst = inst; hwnd = NULL; @@ -1114,6 +1159,10 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) if (!strcmp(argv[i], "-pgpfp")) { pgp_fingerprints(); return 1; + } else if (!strcmp(argv[i], "-restrict-acl") || + !strcmp(argv[i], "-restrict_acl") || + !strcmp(argv[i], "-restrictacl")) { + restrict_process_acl(); } else if (!strcmp(argv[i], "-c")) { /* * If we see `-c', then the rest of the