summaryrefslogtreecommitdiff
path: root/ssh-keyscan.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-keyscan.c')
-rw-r--r--ssh-keyscan.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/ssh-keyscan.c b/ssh-keyscan.c
index 61b4ca568..57d88429b 100644
--- a/ssh-keyscan.c
+++ b/ssh-keyscan.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-keyscan.c,v 1.100 2015/04/05 15:43:43 miod Exp $ */ 1/* $OpenBSD: ssh-keyscan.c,v 1.101 2015/04/10 00:08:55 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 *
@@ -299,15 +299,18 @@ static void
299keyprint(con *c, struct sshkey *key) 299keyprint(con *c, struct sshkey *key)
300{ 300{
301 char *host = c->c_output_name ? c->c_output_name : c->c_name; 301 char *host = c->c_output_name ? c->c_output_name : c->c_name;
302 char *hostport = NULL;
302 303
303 if (!key) 304 if (!key)
304 return; 305 return;
305 if (hash_hosts && (host = host_hash(host, NULL, 0)) == NULL) 306 if (hash_hosts && (host = host_hash(host, NULL, 0)) == NULL)
306 fatal("host_hash failed"); 307 fatal("host_hash failed");
307 308
308 fprintf(stdout, "%s ", host); 309 hostport = put_host_port(host, ssh_port);
310 fprintf(stdout, "%s ", hostport);
309 sshkey_write(key, stdout); 311 sshkey_write(key, stdout);
310 fputs("\n", stdout); 312 fputs("\n", stdout);
313 free(hostport);
311} 314}
312 315
313static int 316static int
@@ -488,7 +491,7 @@ congreet(int s)
488 confree(s); 491 confree(s);
489 return; 492 return;
490 } 493 }
491 fprintf(stderr, "# %s %s\n", c->c_name, chop(buf)); 494 fprintf(stderr, "# %s:%d %s\n", c->c_name, ssh_port, chop(buf));
492 n = snprintf(buf, sizeof buf, "SSH-%d.%d-OpenSSH-keyscan\r\n", 495 n = snprintf(buf, sizeof buf, "SSH-%d.%d-OpenSSH-keyscan\r\n",
493 c->c_keytype == KT_RSA1? PROTOCOL_MAJOR_1 : PROTOCOL_MAJOR_2, 496 c->c_keytype == KT_RSA1? PROTOCOL_MAJOR_1 : PROTOCOL_MAJOR_2,
494 c->c_keytype == KT_RSA1? PROTOCOL_MINOR_1 : PROTOCOL_MINOR_2); 497 c->c_keytype == KT_RSA1? PROTOCOL_MINOR_1 : PROTOCOL_MINOR_2);