Skip to content

Commit

Permalink
upstream: Fix UpdateHostkeys/HashKnownHosts/CheckHostIP bug
Browse files Browse the repository at this point in the history
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@

OpenBSD-Commit-ID: a654a8290bd1c930aac509e8158cf85e42e49cb7
  • Loading branch information
djmdjm committed Oct 7, 2020
1 parent b70e337 commit 04c06d0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion hostfile.c
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
* Copyright (c) 1995 Tatu Ylonen <[email protected]>, Espoo, Finland
Expand Down Expand Up @@ -451,6 +451,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;
}

Expand Down

0 comments on commit 04c06d0

Please sign in to comment.