Fix ProxyCommand equals splitting.
Uses regex approach from @lndbrg
This commit is contained in:
parent
928c062748
commit
270bb94a46
|
@ -22,9 +22,12 @@ L{SSHConfig}.
|
||||||
|
|
||||||
import fnmatch
|
import fnmatch
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
SSH_PORT=22
|
SSH_PORT=22
|
||||||
|
proxy_re = re.compile(r"^(proxycommand)\s*=*\s*(.*)", re.I)
|
||||||
|
|
||||||
|
|
||||||
class SSHConfig (object):
|
class SSHConfig (object):
|
||||||
"""
|
"""
|
||||||
|
@ -56,8 +59,13 @@ class SSHConfig (object):
|
||||||
if (line == '') or (line[0] == '#'):
|
if (line == '') or (line[0] == '#'):
|
||||||
continue
|
continue
|
||||||
if '=' in line:
|
if '=' in line:
|
||||||
key, value = line.split('=', 1)
|
# Ensure ProxyCommand gets properly split
|
||||||
key = key.strip().lower()
|
if line.lower().strip().startswith('proxycommand'):
|
||||||
|
match = proxy_re.match(line)
|
||||||
|
key, value = match.group(1).lower(), match.group(2)
|
||||||
|
else:
|
||||||
|
key, value = line.split('=', 1)
|
||||||
|
key = key.strip().lower()
|
||||||
else:
|
else:
|
||||||
# find first whitespace, and split there
|
# find first whitespace, and split there
|
||||||
i = 0
|
i = 0
|
||||||
|
|
Loading…
Reference in New Issue