diff options
author | 2015-04-10 00:08:55 +0000 | |
---|---|---|
committer | 2015-04-10 00:08:55 +0000 | |
commit | bd00f1210c51d228986dc40df4cfde15cb17697e (patch) | |
tree | 8198e5f3241dc458682adb704a074d766f0f32db | |
parent | sync (diff) | |
download | wireguard-openbsd-bd00f1210c51d228986dc40df4cfde15cb17697e.tar.xz wireguard-openbsd-bd00f1210c51d228986dc40df4cfde15cb17697e.zip |
include port number if a non-default one has been specified;
based on patch from Michael Handler
-rw-r--r-- | usr.bin/ssh/ssh-keyscan.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/ssh/ssh-keyscan.c b/usr.bin/ssh/ssh-keyscan.c index 1ae7c631c0e..85bfb7a25ce 100644 --- a/usr.bin/ssh/ssh-keyscan.c +++ b/usr.bin/ssh/ssh-keyscan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh-keyscan.c,v 1.100 2015/04/05 15:43:43 miod Exp $ */ +/* $OpenBSD: ssh-keyscan.c,v 1.101 2015/04/10 00:08:55 djm Exp $ */ /* * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>. * @@ -279,15 +279,18 @@ static void keyprint(con *c, struct sshkey *key) { char *host = c->c_output_name ? c->c_output_name : c->c_name; + char *hostport = NULL; if (!key) return; if (hash_hosts && (host = host_hash(host, NULL, 0)) == NULL) fatal("host_hash failed"); - fprintf(stdout, "%s ", host); + hostport = put_host_port(host, ssh_port); + fprintf(stdout, "%s ", hostport); sshkey_write(key, stdout); fputs("\n", stdout); + free(hostport); } static int @@ -468,7 +471,7 @@ congreet(int s) confree(s); return; } - fprintf(stderr, "# %s %s\n", c->c_name, chop(buf)); + fprintf(stderr, "# %s:%d %s\n", c->c_name, ssh_port, chop(buf)); n = snprintf(buf, sizeof buf, "SSH-%d.%d-OpenSSH-keyscan\r\n", c->c_keytype == KT_RSA1? PROTOCOL_MAJOR_1 : PROTOCOL_MAJOR_2, c->c_keytype == KT_RSA1? PROTOCOL_MINOR_1 : PROTOCOL_MINOR_2); |