Assure that host entries in known_hosts files do not duplicate endlessly if keys from known_hosts are loaded via HostKeys.load() more than once (e.g. for refreshing the list of known hosts during runtime).
This commit is contained in:
parent
4f481a57a2
commit
080bece258
|
@ -168,6 +168,11 @@ class HostKeys (UserDict.DictMixin):
|
|||
continue
|
||||
e = HostKeyEntry.from_line(line)
|
||||
if e is not None:
|
||||
_hostnames = e.hostnames
|
||||
for h in _hostnames:
|
||||
if self.check(h, e.key):
|
||||
e.hostnames.remove(h)
|
||||
if len(e.hostnames):
|
||||
self._entries.append(e)
|
||||
f.close()
|
||||
|
||||
|
|
Loading…
Reference in New Issue