Store hostname hashes in memory rathen than the non-hashed host entries. Also assures that the host entries in known_hosts get saved in hashed format as it is currently standard in OpenSSH.

This commit is contained in:
Mike Gabriel 2012-10-12 09:36:42 +02:00 committed by Jeff Forcier
parent b329512636
commit 4f481a57a2
1 changed files with 2 additions and 0 deletions

View File

@ -141,6 +141,8 @@ class HostKeys (UserDict.DictMixin):
if (hostname in e.hostnames) and (e.key.get_name() == keytype): if (hostname in e.hostnames) and (e.key.get_name() == keytype):
e.key = key e.key = key
return return
if not hostname.startswith('|1|') and hash_hostname:
hostname = self.hash_host(hostname)
self._entries.append(HostKeyEntry([hostname], key)) self._entries.append(HostKeyEntry([hostname], key))
def load(self, filename): def load(self, filename):