Skip to content

Commit 9ad9688

Browse files
committed
Fix issue with parsing the SSH config file
This commit fixes a previous parsing change that made the code too aggressive about converting equals sign delimiters to spaces. Thanks go to Siddh Raman Pant for reporting this issue!
1 parent 43bcd2d commit 9ad9688

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

asyncssh/config.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,9 @@ def parse(self, path: Path) -> None:
320320
self._error(str(exc))
321321

322322
args = []
323+
loption = ''
323324

324-
for arg in split_args:
325+
for i, arg in enumerate(split_args, 1):
325326
if arg.startswith('='):
326327
if len(arg) > 1:
327328
args.append(arg[1:])
@@ -334,8 +335,11 @@ def parse(self, path: Path) -> None:
334335
else:
335336
args.append(arg)
336337

337-
option = args.pop(0)
338-
loption = option.lower()
338+
if i == 1:
339+
loption = args.pop(0).lower()
340+
elif i > 1 and loption not in self._conditionals:
341+
args.extend(split_args[i:])
342+
break
339343

340344
if loption in self._no_split:
341345
args = [line.lstrip()[len(loption):].strip()]
@@ -562,7 +566,7 @@ def _set_tokens(self) -> None:
562566
('SendEnv', SSHConfig._append_string_list),
563567
('ServerAliveCountMax', SSHConfig._set_int),
564568
('ServerAliveInterval', SSHConfig._set_int),
565-
('SetEnv', SSHConfig._append_string_list),
569+
('SetEnv', SSHConfig._set_string_list),
566570
('Tag', SSHConfig._set_string),
567571
('TCPKeepAlive', SSHConfig._set_bool),
568572
('User', SSHConfig._set_string),

0 commit comments

Comments
 (0)