summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordjm <djm@openbsd.org>2020-10-07 02:25:43 +0000
committerdjm <djm@openbsd.org>2020-10-07 02:25:43 +0000
commit814470b91a8ad97d6a8ebc5606c48e827c6e8017 (patch)
treeab1c35d44a2cf6aadd42ba05a0086628b990484b
parentdon't UpdateHostkeys when the hostkey is verified by the (diff)
downloadwireguard-openbsd-814470b91a8ad97d6a8ebc5606c48e827c6e8017.tar.xz
wireguard-openbsd-814470b91a8ad97d6a8ebc5606c48e827c6e8017.zip
Fix UpdateHostkeys/HashKnownHosts/CheckHostIP bug
When all of UpdateHostkeys, HashKnownHosts and ChechHostIP were enabled and new host keys were learned, known_hosts IP entries were not being recorded for new host keys. reported by matthieu@ ok markus@
-rw-r--r--usr.bin/ssh/hostfile.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/ssh/hostfile.c b/usr.bin/ssh/hostfile.c
index 3dc980984b8..8483eb3baab 100644
--- a/usr.bin/ssh/hostfile.c
+++ b/usr.bin/ssh/hostfile.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hostfile.c,v 1.83 2020/10/04 09:45:01 djm Exp $ */
+/* $OpenBSD: hostfile.c,v 1.84 2020/10/07 02:25:43 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -449,6 +449,9 @@ write_host_entry(FILE *f, const char *host, const char *ip,
else
error("%s: sshkey_write failed: %s", __func__, ssh_err(r));
fputc('\n', f);
+ /* If hashing is enabled, the IP address needs to go on its own line */
+ if (success && store_hash && ip != NULL)
+ success = write_host_entry(f, ip, NULL, key, 1);
return success;
}