diff options
author | djm@openbsd.org <djm@openbsd.org> | 2019-01-26 23:35:01 +0100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2019-01-26 23:42:19 +0100 |
commit | c2c18a39683db382a15b438632afab3f551d50ce (patch) | |
tree | 19d3fcface81337f2793de0949283bbcf78bd1db /ssh-keyscan.c | |
parent | upstream: Accept the host key fingerprint as a synonym for "yes" (diff) | |
download | openssh-c2c18a39683db382a15b438632afab3f551d50ce.tar.xz openssh-c2c18a39683db382a15b438632afab3f551d50ce.zip |
upstream: make ssh-keyscan return a non-zero exit status if it
finds no keys. bz#2903
OpenBSD-Commit-ID: 89f1081fb81d950ebb48e6e73d21807b2723d488
Diffstat (limited to 'ssh-keyscan.c')
-rw-r--r-- | ssh-keyscan.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/ssh-keyscan.c b/ssh-keyscan.c index 144daa6df..2ed041559 100644 --- a/ssh-keyscan.c +++ b/ssh-keyscan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh-keyscan.c,v 1.125 2019/01/21 10:38:54 djm Exp $ */ +/* $OpenBSD: ssh-keyscan.c,v 1.126 2019/01/26 22:35:01 djm Exp $ */ /* * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>. * @@ -70,6 +70,8 @@ int hash_hosts = 0; /* Hash hostname on output */ int print_sshfp = 0; /* Print SSHFP records instead of known_hosts */ +int found_one = 0; /* Successfully found a key */ + #define MAXMAXFD 256 /* The number of seconds after which to give up on a TCP connection */ @@ -287,6 +289,8 @@ keyprint_one(const char *host, struct sshkey *key) char *hostport; const char *known_host, *hashed; + found_one = 1; + if (print_sshfp) { export_dns_rr(host, key, stdout, 0); return; @@ -802,5 +806,5 @@ main(int argc, char **argv) while (ncon > 0) conloop(); - return (0); + return found_one ? 0 : 1; } |