1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-26 09:42:25 +00:00

Fix log message about alternate host keys.

Since we got a dynamic preference order, it's been bailing out at a
random point, and listing keys we wouldn't use.
(It would still be nice to only mention keys that we'd actually use, but
that's now quite fiddly.)
This commit is contained in:
Jacob Nevins 2016-03-26 18:40:16 +00:00
parent 15386cbe92
commit 6b401c7166

13
ssh.c
View File

@ -7253,16 +7253,14 @@ static void do_ssh2_transport(Ssh ssh, const void *vin, int inlen,
s->keystr = ssh->hostkey->fmtkey(s->hkey); s->keystr = ssh->hostkey->fmtkey(s->hkey);
if (!s->got_session_id) { if (!s->got_session_id) {
/* /*
* Make a note of any host key format we'd have preferred to use, * Make a note of any other host key formats that are available.
* had we already known the corresponding keys.
*/ */
{ {
int i, j = 0; int i, j = 0;
char *list = NULL; char *list = NULL;
for (i = 0; i < lenof(hostkey_algs); i++) { for (i = 0; i < lenof(hostkey_algs); i++) {
if (hostkey_algs[i].alg == ssh->hostkey) if (hostkey_algs[i].alg == ssh->hostkey)
/* Not worth mentioning key types we wouldn't use */ continue;
break;
else if (ssh->uncert_hostkeys[j] == i) { else if (ssh->uncert_hostkeys[j] == i) {
char *newlist; char *newlist;
if (list) if (list)
@ -7284,10 +7282,9 @@ static void do_ssh2_transport(Ssh ssh, const void *vin, int inlen,
} }
if (list) { if (list) {
logeventf(ssh, logeventf(ssh,
"Server has %s host key%s, but we don't know %s; " "Server also has %s host key%s, but we "
"using %s instead", "don't know %s", list,
list, j ? "s" : "", j ? "any of them" : "it", j > 1 ? "s" : "", j > 1 ? "any of them" : "it");
ssh->hostkey->name);
sfree(list); sfree(list);
} }
} }