summaryrefslogtreecommitdiff
path: root/ssh-keyscan.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2017-03-10 03:18:24 +0000
committerColin Watson <cjwatson@debian.org>2017-03-14 13:23:57 +0000
commita0f9daa9c3cc2b37b9707b228263eb717d201371 (patch)
tree1cef9400c9ce020ad6db7424113ab5013c7badd1 /ssh-keyscan.c
parent78800aa252da1ebbfb55f7e593f43c337e694cc3 (diff)
upstream commit
correctly hash hosts with a port number. Reported by Josh Powers in bz#2692; ok dtucker@ Upstream-ID: 468e357ff143e00acc05bdd2803a696b3d4b6442 Origin: https://anongit.mindrot.org/openssh.git/commit/?id=8a2834454c73dfc1eb96453c0e97690595f3f4c2 Bug: https://bugzilla.mindrot.org/show_bug.cgi?id=2692 Bug-Debian: https://bugs.debian.org/857736 Bug-Ubuntu: https://bugs.launchpad.net/bugs/1670745 Last-Update: 2017-03-14 Patch-Name: ssh-keyscan-hash-port.patch
Diffstat (limited to 'ssh-keyscan.c')
-rw-r--r--ssh-keyscan.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/ssh-keyscan.c b/ssh-keyscan.c
index c30d54e62..24b51ff12 100644
--- a/ssh-keyscan.c
+++ b/ssh-keyscan.c
@@ -321,16 +321,17 @@ keygrab_ssh2(con *c)
321} 321}
322 322
323static void 323static void
324keyprint_one(char *host, struct sshkey *key) 324keyprint_one(const char *host, struct sshkey *key)
325{ 325{
326 char *hostport; 326 char *hostport;
327 327 const char *known_host, *hashed;
328 if (hash_hosts && (host = host_hash(host, NULL, 0)) == NULL)
329 fatal("host_hash failed");
330 328
331 hostport = put_host_port(host, ssh_port); 329 hostport = put_host_port(host, ssh_port);
330 if (hash_hosts && (hashed = host_hash(host, NULL, 0)) == NULL)
331 fatal("host_hash failed");
332 known_host = hash_hosts ? hashed : hostport;
332 if (!get_cert) 333 if (!get_cert)
333 fprintf(stdout, "%s ", hostport); 334 fprintf(stdout, "%s ", known_host);
334 sshkey_write(key, stdout); 335 sshkey_write(key, stdout);
335 fputs("\n", stdout); 336 fputs("\n", stdout);
336 free(hostport); 337 free(hostport);