Skip to content

Commit

Permalink
Added check for proxycommand none and associated test as per Paramiko…
Browse files Browse the repository at this point in the history
… Issue 415

Conflicts:
	tests/test_util.py
  • Loading branch information
Sean Johnson authored and bitprophet committed Dec 17, 2014
1 parent e5b105c commit d120ce4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions paramiko/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ def parse(self, file_obj):
'host': self._get_hosts(value),
'config': {}
}
elif key == 'proxycommand' and value.lower() == 'none':
# Proxycommands of none should not be added as an actual value. (Issue #415)
continue
else:
if value.startswith('"') and value.endswith('"'):
value = value[1:-1]
Expand Down
20 changes: 20 additions & 0 deletions tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,3 +464,23 @@ def test_safe_string(self):
assert safe_vanilla == vanilla, err.format(safe_vanilla, vanilla)
assert safe_has_bytes == expected_bytes, \
err.format(safe_has_bytes, expected_bytes)

def test_proxycommand_none_issue_418(self):
test_config_file = """
Host proxycommand-standard-none
ProxyCommand None
Host proxycommand-with-equals-none
ProxyCommand=None
"""
for host, values in {
'proxycommand-standard-none': {'hostname': 'proxycommand-standard-none'},
'proxycommand-with-equals-none': {'hostname': 'proxycommand-with-equals-none'}
}.items():

f = StringIO(test_config_file)
config = paramiko.util.parse_ssh_config(f)
self.assertEqual(
paramiko.util.lookup_ssh_host_config(host, config),
values
)

0 comments on commit d120ce4

Please sign in to comment.