net-ssh 2.9.1 → 2.9.2.beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/test/test_config.rb CHANGED
@@ -93,7 +93,8 @@ class TestConfig < Test::Unit::TestCase
93
93
  'port' => 1234,
94
94
  'pubkeyauthentication' => true,
95
95
  'rekeylimit' => 1024,
96
- 'sendenv' => "LC_*"
96
+ 'sendenv' => "LC_*",
97
+ 'numberofpasswordprompts' => '123'
97
98
  }
98
99
 
99
100
  net_ssh = Net::SSH::Config.translate(open_ssh)
@@ -111,6 +112,7 @@ class TestConfig < Test::Unit::TestCase
111
112
  assert_equal 1024, net_ssh[:rekey_limit]
112
113
  assert_equal "127.0.0.1", net_ssh[:bind_address]
113
114
  assert_equal [/^LC_.*$/], net_ssh[:send_env]
115
+ assert_equal 123, net_ssh[:number_of_password_prompts]
114
116
  end
115
117
 
116
118
  def test_translate_should_turn_off_authentication_methods
@@ -17,16 +17,11 @@ module Transport
17
17
  end
18
18
 
19
19
  def test_constructor_should_build_default_list_of_preferred_algorithms
20
- if defined?(OpenSSL::PKey::EC)
21
- assert_equal %w(ssh-rsa ssh-dss ssh-rsa-cert-v01@openssh.com ssh-rsa-cert-v00@openssh.com ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521 ssh-ed25519-cert-v01@openssh.com ssh-ed25519), algorithms[:host_key]
22
- assert_equal %w(diffie-hellman-group-exchange-sha1 diffie-hellman-group1-sha1 diffie-hellman-group14-sha1 diffie-hellman-group-exchange-sha256 ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521 curve25519-sha256@libssh.org), algorithms[:kex]
23
- else
24
- assert_equal %w(ssh-rsa ssh-dss ssh-rsa-cert-v01@openssh.com ssh-rsa-cert-v00@openssh.com), algorithms[:host_key]
25
- assert_equal %w(diffie-hellman-group-exchange-sha1 diffie-hellman-group1-sha1 diffie-hellman-group14-sha1 diffie-hellman-group-exchange-sha256 aes256-gcm@openssh.com aes128-gcm@openssh.com), algorithms[:kex]
26
- end
27
- assert_equal %w(aes128-cbc 3des-cbc blowfish-cbc cast128-cbc aes192-cbc aes256-cbc rijndael-cbc@lysator.liu.se idea-cbc none arcfour128 arcfour256 arcfour aes128-ctr aes192-ctr aes256-ctr camellia128-cbc camellia192-cbc camellia256-cbc camellia128-cbc@openssh.org camellia192-cbc@openssh.org camellia256-cbc@openssh.org camellia128-ctr camellia192-ctr camellia256-ctr camellia128-ctr@openssh.org camellia192-ctr@openssh.org camellia256-ctr@openssh.org cast128-ctr blowfish-ctr 3des-ctr aes256-gcm@openssh.com aes128-gcm@openssh.com), algorithms[:encryption]
20
+ assert_equal %w(ssh-rsa ssh-dss ssh-rsa-cert-v01@openssh.com ssh-rsa-cert-v00@openssh.com)+ec_host_keys, algorithms[:host_key]
21
+ assert_equal %w(diffie-hellman-group-exchange-sha1 diffie-hellman-group1-sha1 diffie-hellman-group14-sha1 diffie-hellman-group-exchange-sha256)+ec_kex, algorithms[:kex]
22
+ assert_equal %w(aes128-cbc 3des-cbc blowfish-cbc cast128-cbc aes192-cbc aes256-cbc rijndael-cbc@lysator.liu.se idea-cbc none arcfour128 arcfour256 arcfour aes128-ctr aes192-ctr aes256-ctr camellia128-cbc camellia192-cbc camellia256-cbc camellia128-cbc@openssh.org camellia192-cbc@openssh.org camellia256-cbc@openssh.org camellia128-ctr camellia192-ctr camellia256-ctr camellia128-ctr@openssh.org camellia192-ctr@openssh.org camellia256-ctr@openssh.org cast128-ctr blowfish-ctr 3des-ctr), algorithms[:encryption]
28
23
  if defined?(OpenSSL::Digest::SHA256)
29
- assert_equal %w(hmac-sha1 hmac-md5 hmac-sha1-96 hmac-md5-96 hmac-ripemd160 hmac-ripemd160@openssh.com hmac-sha2-256 hmac-sha2-512 hmac-sha2-256-96 hmac-sha2-512-96 none hmac-sha2-512-etm@openssh.com hmac-sha2-256-etm@openssh.com umac-128-etm@openssh.com), algorithms[:hmac]
24
+ assert_equal %w(hmac-sha1 hmac-md5 hmac-sha1-96 hmac-md5-96 hmac-ripemd160 hmac-ripemd160@openssh.com hmac-sha2-256 hmac-sha2-512 hmac-sha2-256-96 hmac-sha2-512-96 none), algorithms[:hmac]
30
25
  else
31
26
  assert_equal %w(hmac-sha1 hmac-md5 hmac-sha1-96 hmac-md5-96 hmac-ripemd160 hmac-ripemd160@openssh.com none umac-128-etm@openssh.com), algorithms[:hmac] end
32
27
  assert_equal %w(none zlib@openssh.com zlib), algorithms[:compression]
@@ -41,60 +36,65 @@ module Transport
41
36
  end
42
37
 
43
38
  def test_constructor_with_preferred_host_key_type_should_put_preferred_host_key_type_first
44
- if defined?(OpenSSL::PKey::EC)
45
- assert_equal %w(ssh-dss ssh-rsa ssh-rsa-cert-v01@openssh.com ssh-rsa-cert-v00@openssh.com ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521 ssh-ed25519-cert-v01@openssh.com ssh-ed25519), algorithms(:host_key => "ssh-dss")[:host_key]
46
- else
47
- assert_equal %w(ssh-dss ssh-rsa ssh-rsa-cert-v01@openssh.com ssh-rsa-cert-v00@openssh.com), algorithms(:host_key => "ssh-dss")[:host_key]
48
- end
39
+ assert_equal %w(ssh-dss ssh-rsa ssh-rsa-cert-v01@openssh.com ssh-rsa-cert-v00@openssh.com)+ec_host_keys, algorithms(:host_key => "ssh-dss")[:host_key]
49
40
  end
50
41
 
51
42
  def test_constructor_with_known_hosts_reporting_known_host_key_should_use_that_host_key_type
52
43
  Net::SSH::KnownHosts.expects(:search_for).with("net.ssh.test,127.0.0.1", {}).returns([stub("key", :ssh_type => "ssh-dss")])
44
+ assert_equal %w(ssh-dss ssh-rsa ssh-rsa-cert-v01@openssh.com ssh-rsa-cert-v00@openssh.com )+ec_host_keys, algorithms[:host_key]
45
+ end
46
+
47
+ def ec_host_keys
53
48
  if defined?(OpenSSL::PKey::EC)
54
- assert_equal %w(ssh-dss ssh-rsa ssh-rsa-cert-v01@openssh.com ssh-rsa-cert-v00@openssh.com ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521 ssh-ed25519-cert-v01@openssh.com ssh-ed25519), algorithms[:host_key]
49
+ %w(ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521)
55
50
  else
56
- assert_equal %w(ssh-dss ssh-rsa), algorithms[:host_key]
51
+ []
57
52
  end
58
53
  end
59
54
 
60
- def test_constructor_with_unrecognized_host_key_type_should_raise_exception
61
- assert_raises(NotImplementedError) { algorithms(:host_key => "bogus") }
55
+ def test_constructor_with_unrecognized_host_key_type_should_return_whats_supported
56
+ assert_equal %w(ssh-rsa ssh-dss ssh-rsa-cert-v01@openssh.com ssh-rsa-cert-v00@openssh.com )+ec_host_keys, algorithms(:host_key => "bogus ssh-rsa")[:host_key]
62
57
  end
63
58
 
64
- def test_constructor_with_preferred_kex_should_put_preferred_kex_first
59
+ def ec_kex
65
60
  if defined?(OpenSSL::PKey::EC)
66
- assert_equal %w(diffie-hellman-group1-sha1 diffie-hellman-group-exchange-sha1 diffie-hellman-group14-sha1 diffie-hellman-group-exchange-sha256 ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521 curve25519-sha256@libssh.org), algorithms(:kex => "diffie-hellman-group1-sha1")[:kex]
61
+ %w(ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521 curve25519-sha256@libssh.org)
67
62
  else
68
- assert_equal %w(diffie-hellman-group1-sha1 diffie-hellman-group-exchange-sha1 diffie-hellman-group14-sha1 diffie-hellman-group-exchange-sha256), algorithms(:kex => "diffie-hellman-group1-sha1")[:kex]
63
+ []
69
64
  end
70
65
  end
71
66
 
67
+ def test_constructor_with_preferred_kex_should_put_preferred_kex_first
68
+ assert_equal %w(diffie-hellman-group1-sha1 diffie-hellman-group-exchange-sha1 diffie-hellman-group14-sha1 diffie-hellman-group-exchange-sha256)+ec_kex, algorithms(:kex => "diffie-hellman-group1-sha1")[:kex]
69
+ end
70
+
72
71
  def test_constructor_with_unrecognized_kex_should_raise_exception
73
- assert_raises(NotImplementedError) { algorithms(:kex => "bogus") }
72
+ assert_equal %w(diffie-hellman-group1-sha1 diffie-hellman-group-exchange-sha1 diffie-hellman-group14-sha1 diffie-hellman-group-exchange-sha256)+ec_kex, algorithms(:kex => %w(bogus diffie-hellman-group1-sha1))[:kex]
74
73
  end
75
74
 
76
75
  def test_constructor_with_preferred_encryption_should_put_preferred_encryption_first
77
- assert_equal %w(aes256-cbc aes128-cbc 3des-cbc blowfish-cbc cast128-cbc aes192-cbc rijndael-cbc@lysator.liu.se idea-cbc none arcfour128 arcfour256 arcfour aes128-ctr aes192-ctr aes256-ctr camellia128-cbc camellia192-cbc camellia256-cbc camellia128-cbc@openssh.org camellia192-cbc@openssh.org camellia256-cbc@openssh.org camellia128-ctr camellia192-ctr camellia256-ctr camellia128-ctr@openssh.org camellia192-ctr@openssh.org camellia256-ctr@openssh.org cast128-ctr blowfish-ctr 3des-ctr aes256-gcm@openssh.com aes128-gcm@openssh.com), algorithms(:encryption => "aes256-cbc")[:encryption]
76
+ assert_equal %w(aes256-cbc aes128-cbc 3des-cbc blowfish-cbc cast128-cbc aes192-cbc rijndael-cbc@lysator.liu.se idea-cbc none arcfour128 arcfour256 arcfour aes128-ctr aes192-ctr aes256-ctr camellia128-cbc camellia192-cbc camellia256-cbc camellia128-cbc@openssh.org camellia192-cbc@openssh.org camellia256-cbc@openssh.org camellia128-ctr camellia192-ctr camellia256-ctr camellia128-ctr@openssh.org camellia192-ctr@openssh.org camellia256-ctr@openssh.org cast128-ctr blowfish-ctr 3des-ctr), algorithms(:encryption => "aes256-cbc")[:encryption]
78
77
  end
79
78
 
80
79
  def test_constructor_with_multiple_preferred_encryption_should_put_all_preferred_encryption_first
81
- assert_equal %w(aes256-cbc 3des-cbc idea-cbc aes128-cbc blowfish-cbc cast128-cbc aes192-cbc rijndael-cbc@lysator.liu.se none arcfour128 arcfour256 arcfour aes128-ctr aes192-ctr aes256-ctr camellia128-cbc camellia192-cbc camellia256-cbc camellia128-cbc@openssh.org camellia192-cbc@openssh.org camellia256-cbc@openssh.org camellia128-ctr camellia192-ctr camellia256-ctr camellia128-ctr@openssh.org camellia192-ctr@openssh.org camellia256-ctr@openssh.org cast128-ctr blowfish-ctr 3des-ctr aes256-gcm@openssh.com aes128-gcm@openssh.com), algorithms(:encryption => %w(aes256-cbc 3des-cbc idea-cbc))[:encryption]
80
+ assert_equal %w(aes256-cbc 3des-cbc idea-cbc aes128-cbc blowfish-cbc cast128-cbc aes192-cbc rijndael-cbc@lysator.liu.se none arcfour128 arcfour256 arcfour aes128-ctr aes192-ctr aes256-ctr camellia128-cbc camellia192-cbc camellia256-cbc camellia128-cbc@openssh.org camellia192-cbc@openssh.org camellia256-cbc@openssh.org camellia128-ctr camellia192-ctr camellia256-ctr camellia128-ctr@openssh.org camellia192-ctr@openssh.org camellia256-ctr@openssh.org cast128-ctr blowfish-ctr 3des-ctr), algorithms(:encryption => %w(aes256-cbc 3des-cbc idea-cbc))[:encryption]
82
81
  end
83
82
 
84
- def test_constructor_with_unrecognized_encryption_should_raise_exception
85
- assert_raises(NotImplementedError) { algorithms(:encryption => "bogus") }
83
+ def test_constructor_with_unrecognized_encryption_should_keep_whats_supported
84
+ assert_equal %w(aes256-cbc aes128-cbc 3des-cbc blowfish-cbc cast128-cbc aes192-cbc rijndael-cbc@lysator.liu.se idea-cbc none arcfour128 arcfour256 arcfour aes128-ctr aes192-ctr aes256-ctr camellia128-cbc camellia192-cbc camellia256-cbc camellia128-cbc@openssh.org camellia192-cbc@openssh.org camellia256-cbc@openssh.org camellia128-ctr camellia192-ctr camellia256-ctr camellia128-ctr@openssh.org camellia192-ctr@openssh.org camellia256-ctr@openssh.org cast128-ctr blowfish-ctr 3des-ctr), algorithms(:encryption => %w(bogus aes256-cbc))[:encryption]
86
85
  end
87
86
 
88
87
  def test_constructor_with_preferred_hmac_should_put_preferred_hmac_first
89
- assert_equal %w(hmac-md5-96 hmac-sha1 hmac-md5 hmac-sha1-96 hmac-ripemd160 hmac-ripemd160@openssh.com hmac-sha2-256 hmac-sha2-512 hmac-sha2-256-96 hmac-sha2-512-96 none hmac-sha2-512-etm@openssh.com hmac-sha2-256-etm@openssh.com umac-128-etm@openssh.com), algorithms(:hmac => "hmac-md5-96")[:hmac]
88
+ assert_equal %w(hmac-md5-96 hmac-sha1 hmac-md5 hmac-sha1-96 hmac-ripemd160 hmac-ripemd160@openssh.com hmac-sha2-256 hmac-sha2-512 hmac-sha2-256-96 hmac-sha2-512-96 none), algorithms(:hmac => "hmac-md5-96")[:hmac]
90
89
  end
91
90
 
92
91
  def test_constructor_with_multiple_preferred_hmac_should_put_all_preferred_hmac_first
93
- assert_equal %w(hmac-md5-96 hmac-sha1-96 hmac-sha1 hmac-md5 hmac-ripemd160 hmac-ripemd160@openssh.com hmac-sha2-256 hmac-sha2-512 hmac-sha2-256-96 hmac-sha2-512-96 none hmac-sha2-512-etm@openssh.com hmac-sha2-256-etm@openssh.com umac-128-etm@openssh.com), algorithms(:hmac => %w(hmac-md5-96 hmac-sha1-96))[:hmac]
92
+ assert_equal %w(hmac-md5-96 hmac-sha1-96 hmac-sha1 hmac-md5 hmac-ripemd160 hmac-ripemd160@openssh.com hmac-sha2-256 hmac-sha2-512 hmac-sha2-256-96 hmac-sha2-512-96 none), algorithms(:hmac => %w(hmac-md5-96 hmac-sha1-96))[:hmac]
94
93
  end
95
94
 
96
- def test_constructor_with_unrecognized_hmac_should_raise_exception
97
- assert_raises(NotImplementedError) { algorithms(:hmac => "bogus") }
95
+ def test_constructor_with_unrecognized_hmac_should_ignore_those
96
+ assert_equal %w(hmac-md5-96 hmac-sha1 hmac-md5 hmac-sha1-96 hmac-ripemd160 hmac-ripemd160@openssh.com hmac-sha2-256 hmac-sha2-512 hmac-sha2-256-96 hmac-sha2-512-96 none),
97
+ algorithms(:hmac => "hmac-md5-96")[:hmac]
98
98
  end
99
99
 
100
100
  def test_constructor_with_preferred_compression_should_put_preferred_compression_first
@@ -109,8 +109,8 @@ module Transport
109
109
  assert_equal %w(zlib@openssh.com zlib none), algorithms(:compression => true)[:compression]
110
110
  end
111
111
 
112
- def test_constructor_with_unrecognized_compression_should_raise_exception
113
- assert_raises(NotImplementedError) { algorithms(:compression => "bogus") }
112
+ def test_constructor_with_unrecognized_compression_should_return_whats_supported
113
+ assert_equal %w(none zlib zlib@openssh.com), algorithms(:compression => %w(bogus none zlib))[:compression]
114
114
  end
115
115
 
116
116
  def test_initial_state_should_be_neither_pending_nor_initialized
@@ -278,8 +278,8 @@ module Transport
278
278
  :string, options[:encryption_server] || "aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,idea-cbc",
279
279
  :string, options[:hmac_client] || "hmac-sha1,hmac-md5,hmac-sha1-96,hmac-md5-96",
280
280
  :string, options[:hmac_server] || "hmac-sha1,hmac-md5,hmac-sha1-96,hmac-md5-96",
281
- :string, options[:compmression_client] || "none,zlib@openssh.com,zlib",
282
- :string, options[:compmression_server] || "none,zlib@openssh.com,zlib",
281
+ :string, options[:compression_client] || "none,zlib@openssh.com,zlib",
282
+ :string, options[:compression_server] || "none,zlib@openssh.com,zlib",
283
283
  :string, options[:language_client] || "",
284
284
  :string, options[:langauge_server] || "",
285
285
  :bool, options[:first_kex_follows])
@@ -288,17 +288,12 @@ module Transport
288
288
  def assert_kexinit(buffer, options={})
289
289
  assert_equal KEXINIT, buffer.type
290
290
  assert_equal 16, buffer.read(16).length
291
- if defined?(OpenSSL::PKey::EC)
292
- assert_equal options[:kex] || "diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,curve25519-sha256@libssh.org", buffer.read_string
293
- assert_equal options[:host_key] || "ssh-rsa,ssh-dss,ssh-rsa-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519-cert-v01@openssh.com,ssh-ed25519", buffer.read_string
294
- else
295
- assert_equal options[:kex] || "diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha256", buffer.read_string
296
- assert_equal options[:host_key] || "ssh-rsa,ssh-dss", buffer.read_string
297
- end
298
- assert_equal options[:encryption_client] || "aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,idea-cbc,none,arcfour128,arcfour256,arcfour,aes128-ctr,aes192-ctr,aes256-ctr,camellia128-cbc,camellia192-cbc,camellia256-cbc,camellia128-cbc@openssh.org,camellia192-cbc@openssh.org,camellia256-cbc@openssh.org,camellia128-ctr,camellia192-ctr,camellia256-ctr,camellia128-ctr@openssh.org,camellia192-ctr@openssh.org,camellia256-ctr@openssh.org,cast128-ctr,blowfish-ctr,3des-ctr,aes256-gcm@openssh.com,aes128-gcm@openssh.com", buffer.read_string
299
- assert_equal options[:encryption_server] || "aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,idea-cbc,none,arcfour128,arcfour256,arcfour,aes128-ctr,aes192-ctr,aes256-ctr,camellia128-cbc,camellia192-cbc,camellia256-cbc,camellia128-cbc@openssh.org,camellia192-cbc@openssh.org,camellia256-cbc@openssh.org,camellia128-ctr,camellia192-ctr,camellia256-ctr,camellia128-ctr@openssh.org,camellia192-ctr@openssh.org,camellia256-ctr@openssh.org,cast128-ctr,blowfish-ctr,3des-ctr,aes256-gcm@openssh.com,aes128-gcm@openssh.com", buffer.read_string
300
- assert_equal options[:hmac_client] || "hmac-sha1,hmac-md5,hmac-sha1-96,hmac-md5-96,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha2-256-96,hmac-sha2-512-96,none,hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com", buffer.read_string
301
- assert_equal options[:hmac_server] || "hmac-sha1,hmac-md5,hmac-sha1-96,hmac-md5-96,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha2-256-96,hmac-sha2-512-96,none,hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com", buffer.read_string
291
+ assert_equal options[:kex] || (%w(diffie-hellman-group-exchange-sha1 diffie-hellman-group1-sha1 diffie-hellman-group14-sha1 diffie-hellman-group-exchange-sha256)+ec_kex).join(','), buffer.read_string
292
+ assert_equal options[:host_key] || (%w(ssh-rsa ssh-dss ssh-rsa-cert-v01@openssh.com ssh-rsa-cert-v00@openssh.com)+ec_host_keys).join(','), buffer.read_string
293
+ assert_equal options[:encryption_client] || "aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,idea-cbc,none,arcfour128,arcfour256,arcfour,aes128-ctr,aes192-ctr,aes256-ctr,camellia128-cbc,camellia192-cbc,camellia256-cbc,camellia128-cbc@openssh.org,camellia192-cbc@openssh.org,camellia256-cbc@openssh.org,camellia128-ctr,camellia192-ctr,camellia256-ctr,camellia128-ctr@openssh.org,camellia192-ctr@openssh.org,camellia256-ctr@openssh.org,cast128-ctr,blowfish-ctr,3des-ctr", buffer.read_string
294
+ assert_equal options[:encryption_server] || "aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,idea-cbc,none,arcfour128,arcfour256,arcfour,aes128-ctr,aes192-ctr,aes256-ctr,camellia128-cbc,camellia192-cbc,camellia256-cbc,camellia128-cbc@openssh.org,camellia192-cbc@openssh.org,camellia256-cbc@openssh.org,camellia128-ctr,camellia192-ctr,camellia256-ctr,camellia128-ctr@openssh.org,camellia192-ctr@openssh.org,camellia256-ctr@openssh.org,cast128-ctr,blowfish-ctr,3des-ctr", buffer.read_string
295
+ assert_equal options[:hmac_client] || "hmac-sha1,hmac-md5,hmac-sha1-96,hmac-md5-96,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha2-256-96,hmac-sha2-512-96,none", buffer.read_string
296
+ assert_equal options[:hmac_server] || "hmac-sha1,hmac-md5,hmac-sha1-96,hmac-md5-96,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha2-256-96,hmac-sha2-512-96,none", buffer.read_string
302
297
  assert_equal options[:compression_client] || "none,zlib@openssh.com,zlib", buffer.read_string
303
298
  assert_equal options[:compression_server] || "none,zlib@openssh.com,zlib", buffer.read_string
304
299
  assert_equal options[:language_client] || "", buffer.read_string
@@ -45,6 +45,12 @@ module Transport
45
45
  assert_equal "1.2.3.4", stream.peer_ip
46
46
  end
47
47
 
48
+ def test_peer_ip_should_return_no_hostip_when_socket_has_no_peername
49
+ assert_equal false, stream.respond_to?(:getpeername)
50
+ assert_equal Net::SSH::Transport::PacketStream::PROXY_COMMAND_HOST_IP, stream.peer_ip
51
+ assert_equal '<no hostip for proxy command>', stream.peer_ip
52
+ end
53
+
48
54
  def test_available_for_read_should_return_nontrue_when_select_fails
49
55
  IO.expects(:select).returns(nil)
50
56
  assert !stream.available_for_read?
@@ -1678,7 +1684,7 @@ module Transport
1678
1684
  hmacs = Net::SSH::Transport::HMAC::MAP.keys
1679
1685
 
1680
1686
  ciphers.each do |cipher_name|
1681
- unless Net::SSH::Transport::CipherFactory.supported?(cipher_name)
1687
+ unless Net::SSH::Transport::CipherFactory.supported?(cipher_name) && PACKETS.has_key?(cipher_name)
1682
1688
  puts "Skipping packet stream test for #{cipher_name}"
1683
1689
  next
1684
1690
  end
@@ -69,6 +69,18 @@ module Transport
69
69
  assert_equal "[1.2.3.4]:1234", session.host_as_string
70
70
  end
71
71
 
72
+ def test_host_as_string_should_return_only_host_when_proxy_command_is_set
73
+ session!(:host => "1.2.3.4")
74
+ socket.stubs(:peer_ip).returns(Net::SSH::Transport::PacketStream::PROXY_COMMAND_HOST_IP)
75
+ assert_equal "1.2.3.4", session.host_as_string
76
+ end
77
+
78
+ def test_host_as_string_should_return_only_host_and_port_when_host_is_ip_and_port_is_not_default_and_proxy_command_is_set
79
+ session!(:host => "1.2.3.4", :port => 1234)
80
+ socket.stubs(:peer_ip).returns(Net::SSH::Transport::PacketStream::PROXY_COMMAND_HOST_IP)
81
+ assert_equal "[1.2.3.4]:1234", session.host_as_string
82
+ end
83
+
72
84
  def test_close_should_cleanup_and_close_socket
73
85
  session!
74
86
  socket.expects(:cleanup)
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-ssh
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.1
5
- prerelease:
4
+ version: 2.9.2.beta
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jamis Buck
@@ -10,71 +9,60 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain:
13
- - !binary |-
14
- LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUROakNDQWg2Z0F3SUJB
15
- Z0lCQURBTkJna3Foa2lHOXcwQkFRVUZBREJCTVE4d0RRWURWUVFEREFaa1pX
16
- eGgKYm04eEdUQVhCZ29Ka2lhSmsvSXNaQUVaRmdsemIyeDFkR2x2ZFhNeEV6
17
- QVJCZ29Ka2lhSmsvSXNaQUVaRmdOagpiMjB3SGhjTk1UUXdORE13TVRjek5q
18
- STJXaGNOTVRVd05ETXdNVGN6TmpJMldqQkJNUTh3RFFZRFZRUUREQVprClpX
19
- eGhibTh4R1RBWEJnb0praWFKay9Jc1pBRVpGZ2x6YjJ4MWRHbHZkWE14RXpB
20
- UkJnb0praWFKay9Jc1pBRVoKRmdOamIyMHdnZ0VpTUEwR0NTcUdTSWIzRFFF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INGa8XUUtrZtzrgX0/iyXNkKY1ld85g1N3WKEAVLfQI7TlGr0Qv2Ekx6RqlxbR
27
+ Vyq08pytSnghW2otR3bIGMGQzqxAeRLb25cjEwH7YIJ32n7ZC1fpMnBZOBDmueWA
28
+ B9EonmoO3ne7AJSgIvBbZzBPhzM4HrQGRW8LsPFsuj+dcJI43HOQwkmv2TRz0+t6
29
+ mGZldmqLcK0abv4JepLfB9XTue3kuyA29NGBibqyvRwlKckLpvKfHZX6Jxad8xxm
30
+ MbvRpzgROzyfw1qYi4dnIyMwTtXFFcZ0a2jpxHPkcTYFK6TzvFgDLAP0Y/u9jqUQ
31
+ eZ7/3CdSi/isZHEw
32
+ -----END CERTIFICATE-----
33
+ date: 2014-12-02 00:00:00.000000000 Z
42
34
  dependencies:
43
35
  - !ruby/object:Gem::Dependency
44
36
  name: test-unit
45
37
  requirement: !ruby/object:Gem::Requirement
46
- none: false
47
38
  requirements:
48
- - - ! '>='
39
+ - - '>='
49
40
  - !ruby/object:Gem::Version
50
41
  version: '0'
51
42
  type: :development
52
43
  prerelease: false
53
44
  version_requirements: !ruby/object:Gem::Requirement
54
- none: false
55
45
  requirements:
56
- - - ! '>='
46
+ - - '>='
57
47
  - !ruby/object:Gem::Version
58
48
  version: '0'
59
49
  - !ruby/object:Gem::Dependency
60
50
  name: mocha
61
51
  requirement: !ruby/object:Gem::Requirement
62
- none: false
63
52
  requirements:
64
- - - ! '>='
53
+ - - '>='
65
54
  - !ruby/object:Gem::Version
66
55
  version: '0'
67
56
  type: :development
68
57
  prerelease: false
69
58
  version_requirements: !ruby/object:Gem::Requirement
70
- none: false
71
59
  requirements:
72
- - - ! '>='
60
+ - - '>='
73
61
  - !ruby/object:Gem::Version
74
62
  version: '0'
75
- description: ! 'Net::SSH: a pure-Ruby implementation of the SSH2 client protocol.
76
- It allows you to write programs that invoke and interact with processes on remote
77
- servers, via SSH2.'
63
+ description: 'Net::SSH: a pure-Ruby implementation of the SSH2 client protocol. It
64
+ allows you to write programs that invoke and interact with processes on remote servers,
65
+ via SSH2.'
78
66
  email: net-ssh@solutious.com
79
67
  executables: []
80
68
  extensions: []
@@ -90,7 +78,6 @@ files:
90
78
  - Rakefile
91
79
  - Rudyfile
92
80
  - THANKS.txt
93
- - gem-public_cert.pem
94
81
  - lib/net/ssh.rb
95
82
  - lib/net/ssh/authentication/agent.rb
96
83
  - lib/net/ssh/authentication/agent/java_pageant.rb
@@ -110,6 +97,7 @@ files:
110
97
  - lib/net/ssh/config.rb
111
98
  - lib/net/ssh/connection/channel.rb
112
99
  - lib/net/ssh/connection/constants.rb
100
+ - lib/net/ssh/connection/keepalive.rb
113
101
  - lib/net/ssh/connection/session.rb
114
102
  - lib/net/ssh/connection/term.rb
115
103
  - lib/net/ssh/errors.rb
@@ -170,6 +158,7 @@ files:
170
158
  - lib/net/ssh/verifiers/secure.rb
171
159
  - lib/net/ssh/verifiers/strict.rb
172
160
  - lib/net/ssh/version.rb
161
+ - net-ssh-public_cert.pem
173
162
  - net-ssh.gemspec
174
163
  - setup.rb
175
164
  - support/arcfour_check.rb
@@ -241,26 +230,25 @@ files:
241
230
  homepage: https://github.com/net-ssh/net-ssh
242
231
  licenses:
243
232
  - MIT
233
+ metadata: {}
244
234
  post_install_message:
245
235
  rdoc_options: []
246
236
  require_paths:
247
237
  - lib
248
238
  required_ruby_version: !ruby/object:Gem::Requirement
249
- none: false
250
239
  requirements:
251
- - - ! '>='
240
+ - - '>='
252
241
  - !ruby/object:Gem::Version
253
242
  version: '0'
254
243
  required_rubygems_version: !ruby/object:Gem::Requirement
255
- none: false
256
244
  requirements:
257
- - - ! '>='
245
+ - - '>'
258
246
  - !ruby/object:Gem::Version
259
- version: '0'
247
+ version: 1.3.1
260
248
  requirements: []
261
249
  rubyforge_project: net-ssh
262
- rubygems_version: 1.8.23
250
+ rubygems_version: 2.2.2
263
251
  signing_key:
264
- specification_version: 3
265
- summary: ! 'Net::SSH: a pure-Ruby implementation of the SSH2 client protocol.'
252
+ specification_version: 4
253
+ summary: 'Net::SSH: a pure-Ruby implementation of the SSH2 client protocol.'
266
254
  test_files: []
metadata.gz.sig CHANGED
Binary file
data/gem-public_cert.pem DELETED
@@ -1,20 +0,0 @@
1
- -----BEGIN CERTIFICATE-----
2
- MIIDNjCCAh6gAwIBAgIBADANBgkqhkiG9w0BAQUFADBBMQ8wDQYDVQQDDAZkZWxh
3
- bm8xGTAXBgoJkiaJk/IsZAEZFglzb2x1dGlvdXMxEzARBgoJkiaJk/IsZAEZFgNj
4
- b20wHhcNMTQwNDMwMTczNjI2WhcNMTUwNDMwMTczNjI2WjBBMQ8wDQYDVQQDDAZk
5
- ZWxhbm8xGTAXBgoJkiaJk/IsZAEZFglzb2x1dGlvdXMxEzARBgoJkiaJk/IsZAEZ
6
- FgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDdbeFjM67+Txrq
7
- +8HaD4wKEiacRoB8ps17Vzt9TBUyoMMj5KTtFiptr/+ZTug/YdYBquMprPsKlYM2
8
- NoG6BzvDcvQK1zrdHnyVosIDKAHk2wnyN/psZikS1bo9nUHCS5hJdPEnQZx/MxTZ
9
- +GjuRsiBxPYBXnqObLhR83LBeWsauWTuo5gJt1DYxDTVrLoB+Z+ceMV+3vh0HBCb
10
- iwegkx9GWG45h5wTksUIpzOMB3VsHGtGmBjCvdCgLJ2H6b8U9rmL7chunjdqfNf3
11
- zPtnH32c/zrFzeWJTyH2s8Ia+3D6vum2xjjn8FnLg3V4zOf5x598GFBJYDQv7zX/
12
- rV9eCzHDAgMBAAGjOTA3MAkGA1UdEwQCMAAwHQYDVR0OBBYEFA+Buc8ySEw2qKnq
13
- VH4wh8KAm6hUMAsGA1UdDwQEAwIEsDANBgkqhkiG9w0BAQUFAAOCAQEAYsM0M42h
14
- ZEUXvr/i18gkwHKLFDKDAcimgCoS5+syG6rkuSOnKGQolyKTNczNM4gWJJPH5aVq
15
- mW2BtqpIom4YRYb9m3fDNNs6kcB5DedY9UPhVvJ8X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