]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: return correct exit code when searching for and hashing
authordjm@openbsd.org <djm@openbsd.org>
Fri, 1 Jun 2018 03:51:34 +0000 (03:51 +0000)
committerDamien Miller <djm@mindrot.org>
Fri, 1 Jun 2018 04:20:12 +0000 (14:20 +1000)
known_hosts entries in a single operation (ssh-keygen -HF hostname); bz2772
Report and fix from Anton Kremenetsky

OpenBSD-Commit-ID: ac10ca13eb9bb0bc50fcd42ad11c56c317437b58

ssh-keygen.c

index 9aac64fc3b14a8e859c9de6db5be566dcb4ac9b2..fdd236bda4a0d40b75a93d12d9cf6bf087eae4b4 100644 (file)
@@ -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
@@ -1254,13 +1254,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));