diff options
-rw-r--r-- | ssh-keyscan.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/ssh-keyscan.c b/ssh-keyscan.c index eea8d0a0a..e34286e47 100644 --- a/ssh-keyscan.c +++ b/ssh-keyscan.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-keyscan.c,v 1.107 2017/01/06 03:41:58 djm Exp $ */ | 1 | /* $OpenBSD: ssh-keyscan.c,v 1.108 2017/03/10 03:18:24 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>. | 3 | * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>. |
4 | * | 4 | * |
@@ -321,16 +321,17 @@ keygrab_ssh2(con *c) | |||
321 | } | 321 | } |
322 | 322 | ||
323 | static void | 323 | static void |
324 | keyprint_one(char *host, struct sshkey *key) | 324 | keyprint_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); |