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,7 +168,12 @@ class HostKeys (UserDict.DictMixin):
|
||||||
continue
|
continue
|
||||||
e = HostKeyEntry.from_line(line)
|
e = HostKeyEntry.from_line(line)
|
||||||
if e is not None:
|
if e is not None:
|
||||||
self._entries.append(e)
|
_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()
|
f.close()
|
||||||
|
|
||||||
def save(self, filename):
|
def save(self, filename):
|
||||||
|
|
Loading…
Reference in New Issue