summaryrefslogtreecommitdiff
path: root/ssh-keyscan.c
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2017-08-03 10:10:20 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2017-08-03 10:10:20 +0000
commit343d57711556d429eda777ab259ff924acbd6b34 (patch)
tree0c8ee260ab0112046d9f1d588d0c2845ce82f16b /ssh-keyscan.c
parent19ca85510bbe080af3faf5e9ae394608428ac953 (diff)
Notes
Diffstat (limited to 'ssh-keyscan.c')
-rw-r--r--ssh-keyscan.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/ssh-keyscan.c b/ssh-keyscan.c
index c30d54e628f5..1f95239a37c6 100644
--- a/ssh-keyscan.c
+++ b/ssh-keyscan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh-keyscan.c,v 1.106 2016/05/02 10:26:04 djm Exp $ */
+/* $OpenBSD: ssh-keyscan.c,v 1.109 2017/03/10 04:26:06 djm Exp $ */
/*
* Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>.
*
@@ -321,16 +321,18 @@ keygrab_ssh2(con *c)
}
static void
-keyprint_one(char *host, struct sshkey *key)
+keyprint_one(const char *host, struct sshkey *key)
{
char *hostport;
-
- if (hash_hosts && (host = host_hash(host, NULL, 0)) == NULL)
- fatal("host_hash failed");
+ const char *known_host, *hashed;
hostport = put_host_port(host, ssh_port);
+ lowercase(hostport);
+ if (hash_hosts && (hashed = host_hash(host, NULL, 0)) == NULL)
+ fatal("host_hash failed");
+ known_host = hash_hosts ? hashed : hostport;
if (!get_cert)
- fprintf(stdout, "%s ", hostport);
+ fprintf(stdout, "%s ", known_host);
sshkey_write(key, stdout);
fputs("\n", stdout);
free(hostport);
@@ -752,10 +754,13 @@ main(int argc, char **argv)
tname = strtok(optarg, ",");
while (tname) {
int type = sshkey_type_from_name(tname);
+
switch (type) {
+#ifdef WITH_SSH1
case KEY_RSA1:
get_keytypes |= KT_RSA1;
break;
+#endif
case KEY_DSA:
get_keytypes |= KT_DSA;
break;
@@ -769,7 +774,8 @@ main(int argc, char **argv)
get_keytypes |= KT_ED25519;
break;
case KEY_UNSPEC:
- fatal("unknown key type %s", tname);
+ default:
+ fatal("Unknown key type \"%s\"", tname);
}
tname = strtok(NULL, ",");
}