diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2018-06-01 03:51:35 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2018-06-01 03:51:35 +0000 |
commit | ac86fc48b7693b7ac2fb50c12537015557680fe7 (patch) | |
tree | 91ffdf095e0cbd06f671235810427c9d26252a57 /usr.bin | |
parent | 75ccf1a7af5937fdb1fe38c2595ac14ccf389a6f (diff) |
return correct exit code when searching for and hashing known_hosts
entries in a single operation (ssh-keygen -HF hostname); bz2772
Report and fix from Anton Kremenetsky
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ssh/ssh-keygen.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/usr.bin/ssh/ssh-keygen.c b/usr.bin/ssh/ssh-keygen.c index a15b85c0868..9674e14152e 100644 --- a/usr.bin/ssh/ssh-keygen.c +++ b/usr.bin/ssh/ssh-keygen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh-keygen.c,v 1.314 2018/03/12 00:52:01 djm Exp $ */ +/* $OpenBSD: ssh-keygen.c,v 1.315 2018/06/01 03:51:34 djm Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -1238,13 +1238,12 @@ do_known_hosts(struct passwd *pw, const char *name) } inplace = 1; } - /* XXX support identity_file == "-" for stdin */ foreach_options = find_host ? HKF_WANT_MATCH : 0; foreach_options |= print_fingerprint ? HKF_WANT_PARSE_KEY : 0; - if ((r = hostkeys_foreach(identity_file, - hash_hosts ? known_hosts_hash : known_hosts_find_delete, &ctx, - name, NULL, foreach_options)) != 0) { + if ((r = hostkeys_foreach(identity_file, (find_host || !hash_hosts) ? + known_hosts_find_delete : known_hosts_hash, &ctx, name, NULL, + foreach_options)) != 0) { if (inplace) unlink(tmp); fatal("%s: hostkeys_foreach failed: %s", __func__, ssh_err(r)); |