From a528bc3b46222b2f480da75606e4fd0754673629 Mon Sep 17 00:00:00 2001 From: Lee Marlow Date: Tue, 13 Apr 2010 04:34:55 +0800 Subject: Allow host aliases to be numeric when parsing ssh_config files A host with a numeric alias would raise an error because it was coerced into an integer before trying to split it by spaces when trying to handle multiple hosts. For example: Host 1 Hostname my.favoritehost.com --- test/configs/numeric_host | 4 ++++ test/test_config.rb | 7 +++++++ 2 files changed, 11 insertions(+) create mode 100644 test/configs/numeric_host (limited to 'test') diff --git a/test/configs/numeric_host b/test/configs/numeric_host new file mode 100644 index 0000000..cf75e50 --- /dev/null +++ b/test/configs/numeric_host @@ -0,0 +1,4 @@ +Host 1234 + Compression yes + Port 1980 + RekeyLimit 2G diff --git a/test/test_config.rb b/test/test_config.rb index 37e6eba..361c067 100644 --- a/test/test_config.rb +++ b/test/test_config.rb @@ -102,6 +102,13 @@ class TestConfig < Test::Unit::TestCase assert config['compression'] end + def test_load_with_numeric_host + config = Net::SSH::Config.load(config(:numeric_host), "1234") + assert config['compression'] + assert_equal '2G', config['rekeylimit'] + assert_equal 1980, config['port'] + end + private def config(name) -- cgit v1.2.1