Commit 536fe366 authored by Nicolas Wavrant's avatar Nicolas Wavrant

dropbear: better handling of empty lines in known_hosts file

parent f8735406
...@@ -37,7 +37,9 @@ class KnownHostsFile(dict): ...@@ -37,7 +37,9 @@ class KnownHostsFile(dict):
if os.path.exists(self._filename): if os.path.exists(self._filename):
with open(self._filename, 'r') as keyfile: with open(self._filename, 'r') as keyfile:
for line in keyfile: for line in keyfile:
host, key = [column.strip() for column in line.split(' ', 1) if line != ""] if line.strip() == "":
continue
host, key = [column.strip() for column in line.split(' ', 1)]
self[host] = key self[host] = key
def _dump(self): def _dump(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment