]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: piece of UpdateHostkeys client strictification: when
authordjm@openbsd.org <djm@openbsd.org>
Thu, 6 Jan 2022 22:02:52 +0000 (22:02 +0000)
committerDamien Miller <djm@mindrot.org>
Thu, 6 Jan 2022 22:21:38 +0000 (09:21 +1100)
updating known_hosts with new keys, ignore NULL keys (forgot to include in
prior commit)

OpenBSD-Commit-ID: 49d2eda6379490e1ceec40c3b670b973f63dea08

hostfile.c

index a035b38134a340939130ea9686d643b818b8806e..bd49e3ac7c48b12f09316a028e471019b7ea3b4c 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: hostfile.c,v 1.92 2021/10/02 03:17:01 dtucker Exp $ */
+/* $OpenBSD: hostfile.c,v 1.93 2022/01/06 22:02:52 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -642,7 +642,7 @@ hostfile_replace_entries(const char *filename, const char *host, const char *ip,
        /* Re-add the requested keys */
        want = HKF_MATCH_HOST | (ip == NULL ? 0 : HKF_MATCH_IP);
        for (i = 0; i < nkeys; i++) {
-               if ((want & ctx.match_keys[i]) == want)
+               if (keys[i] == NULL || (want & ctx.match_keys[i]) == want)
                        continue;
                if ((fp = sshkey_fingerprint(keys[i], hash_alg,
                    SSH_FP_DEFAULT)) == NULL) {