summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ssh-keyscan.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/ssh-keyscan.c b/ssh-keyscan.c
index 57d88429b..7db0e10e5 100644
--- a/ssh-keyscan.c
+++ b/ssh-keyscan.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-keyscan.c,v 1.101 2015/04/10 00:08:55 djm Exp $ */ 1/* $OpenBSD: ssh-keyscan.c,v 1.102 2015/10/24 22:56:19 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 *
@@ -296,13 +296,10 @@ keygrab_ssh2(con *c)
296} 296}
297 297
298static void 298static void
299keyprint(con *c, struct sshkey *key) 299keyprint_one(char *host, struct sshkey *key)
300{ 300{
301 char *host = c->c_output_name ? c->c_output_name : c->c_name; 301 char *hostport;
302 char *hostport = NULL;
303 302
304 if (!key)
305 return;
306 if (hash_hosts && (host = host_hash(host, NULL, 0)) == NULL) 303 if (hash_hosts && (host = host_hash(host, NULL, 0)) == NULL)
307 fatal("host_hash failed"); 304 fatal("host_hash failed");
308 305
@@ -313,6 +310,24 @@ keyprint(con *c, struct sshkey *key)
313 free(hostport); 310 free(hostport);
314} 311}
315 312
313static void
314keyprint(con *c, struct sshkey *key)
315{
316 char *hosts = c->c_output_name ? c->c_output_name : c->c_name;
317 char *host, *ohosts;
318
319 if (key == NULL)
320 return;
321 if (!hash_hosts && ssh_port == SSH_DEFAULT_PORT) {
322 keyprint_one(hosts, key);
323 return;
324 }
325 ohosts = hosts = xstrdup(hosts);
326 while ((host = strsep(&hosts, ",")) != NULL)
327 keyprint_one(host, key);
328 free(ohosts);
329}
330
316static int 331static int
317tcpconnect(char *host) 332tcpconnect(char *host)
318{ 333{