Fixes #5021 safely split hostkeys with quotes
This commit is contained in:
parent
e54a574bb2
commit
32986c4d64
1 changed files with 6 additions and 1 deletions
|
@ -209,7 +209,12 @@ def parsekey(raw_key):
|
||||||
key_type = None # type of ssh key
|
key_type = None # type of ssh key
|
||||||
type_index = None # index of keytype in key string|list
|
type_index = None # index of keytype in key string|list
|
||||||
|
|
||||||
key_parts = shlex.split(raw_key)
|
# split key safely
|
||||||
|
lex = shlex.shlex(raw_key)
|
||||||
|
lex.quotes = ["'", '"']
|
||||||
|
lex.whitespace_split = True
|
||||||
|
key_parts = list(lex)
|
||||||
|
|
||||||
for i in range(0, len(key_parts)):
|
for i in range(0, len(key_parts)):
|
||||||
if key_parts[i] in VALID_SSH2_KEY_TYPES:
|
if key_parts[i] in VALID_SSH2_KEY_TYPES:
|
||||||
type_index = i
|
type_index = i
|
||||||
|
|
Loading…
Reference in a new issue