net-ssh 2.9.1 → 2.9.2

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.
@@ -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)
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)
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,80 +1,69 @@
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
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jamis Buck
9
8
  - Delano Mandelbaum
9
+ - Miklós Fazekas
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain:
13
- - !binary |-
14
- LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUROakNDQWg2Z0F3SUJB
15
- Z0lCQURBTkJna3Foa2lHOXcwQkFRVUZBREJCTVE4d0RRWURWUVFEREFaa1pX
16
- eGgKYm04eEdUQVhCZ29Ka2lhSmsvSXNaQUVaRmdsemIyeDFkR2x2ZFhNeEV6
17
- QVJCZ29Ka2lhSmsvSXNaQUVaRmdOagpiMjB3SGhjTk1UUXdORE13TVRjek5q
18
- STJXaGNOTVRVd05ETXdNVGN6TmpJMldqQkJNUTh3RFFZRFZRUUREQVprClpX
19
- eGhibTh4R1RBWEJnb0praWFKay9Jc1pBRVpGZ2x6YjJ4MWRHbHZkWE14RXpB
20
- UkJnb0praWFKay9Jc1pBRVoKRmdOamIyMHdnZ0VpTUEwR0NTcUdTSWIzRFFF
21
- QkFRVUFBNElCRHdBd2dnRUtBb0lCQVFEZGJlRmpNNjcrVHhycQorOEhhRDR3
22
- S0VpYWNSb0I4cHMxN1Z6dDlUQlV5b01NajVLVHRGaXB0ci8rWlR1Zy9ZZFlC
23
- cXVNcHJQc0tsWU0yCk5vRzZCenZEY3ZRSzF6cmRIbnlWb3NJREtBSGsyd255
24
- Ti9wc1ppa1MxYm85blVIQ1M1aEpkUEVuUVp4L014VFoKK0dqdVJzaUJ4UFlC
25
- WG5xT2JMaFI4M0xCZVdzYXVXVHVvNWdKdDFEWXhEVFZyTG9CK1orY2VNVisz
26
- dmgwSEJDYgppd2Vna3g5R1dHNDVoNXdUa3NVSXB6T01CM1ZzSEd0R21CakN2
27
- ZENnTEoySDZiOFU5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z
42
35
  dependencies:
43
36
  - !ruby/object:Gem::Dependency
44
37
  name: test-unit
45
38
  requirement: !ruby/object:Gem::Requirement
46
- none: false
47
39
  requirements:
48
- - - ! '>='
40
+ - - '>='
49
41
  - !ruby/object:Gem::Version
50
42
  version: '0'
51
43
  type: :development
52
44
  prerelease: false
53
45
  version_requirements: !ruby/object:Gem::Requirement
54
- none: false
55
46
  requirements:
56
- - - ! '>='
47
+ - - '>='
57
48
  - !ruby/object:Gem::Version
58
49
  version: '0'
59
50
  - !ruby/object:Gem::Dependency
60
51
  name: mocha
61
52
  requirement: !ruby/object:Gem::Requirement
62
- none: false
63
53
  requirements:
64
- - - ! '>='
54
+ - - '>='
65
55
  - !ruby/object:Gem::Version
66
56
  version: '0'
67
57
  type: :development
68
58
  prerelease: false
69
59
  version_requirements: !ruby/object:Gem::Requirement
70
- none: false
71
60
  requirements:
72
- - - ! '>='
61
+ - - '>='
73
62
  - !ruby/object:Gem::Version
74
63
  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.'
64
+ description: 'Net::SSH: a pure-Ruby implementation of the SSH2 client protocol. It
65
+ allows you to write programs that invoke and interact with processes on remote servers,
66
+ via SSH2.'
78
67
  email: net-ssh@solutious.com
79
68
  executables: []
80
69
  extensions: []
@@ -90,7 +79,6 @@ files:
90
79
  - Rakefile
91
80
  - Rudyfile
92
81
  - THANKS.txt
93
- - gem-public_cert.pem
94
82
  - lib/net/ssh.rb
95
83
  - lib/net/ssh/authentication/agent.rb
96
84
  - lib/net/ssh/authentication/agent/java_pageant.rb
@@ -110,6 +98,7 @@ files:
110
98
  - lib/net/ssh/config.rb
111
99
  - lib/net/ssh/connection/channel.rb
112
100
  - lib/net/ssh/connection/constants.rb
101
+ - lib/net/ssh/connection/keepalive.rb
113
102
  - lib/net/ssh/connection/session.rb
114
103
  - lib/net/ssh/connection/term.rb
115
104
  - lib/net/ssh/errors.rb
@@ -170,6 +159,7 @@ files:
170
159
  - lib/net/ssh/verifiers/secure.rb
171
160
  - lib/net/ssh/verifiers/strict.rb
172
161
  - lib/net/ssh/version.rb
162
+ - net-ssh-public_cert.pem
173
163
  - net-ssh.gemspec
174
164
  - setup.rb
175
165
  - support/arcfour_check.rb
@@ -241,26 +231,25 @@ files:
241
231
  homepage: https://github.com/net-ssh/net-ssh
242
232
  licenses:
243
233
  - MIT
234
+ metadata: {}
244
235
  post_install_message:
245
236
  rdoc_options: []
246
237
  require_paths:
247
238
  - lib
248
239
  required_ruby_version: !ruby/object:Gem::Requirement
249
- none: false
250
240
  requirements:
251
- - - ! '>='
241
+ - - '>='
252
242
  - !ruby/object:Gem::Version
253
243
  version: '0'
254
244
  required_rubygems_version: !ruby/object:Gem::Requirement
255
- none: false
256
245
  requirements:
257
- - - ! '>='
246
+ - - '>='
258
247
  - !ruby/object:Gem::Version
259
248
  version: '0'
260
249
  requirements: []
261
250
  rubyforge_project: net-ssh
262
- rubygems_version: 1.8.23
251
+ rubygems_version: 2.2.2
263
252
  signing_key:
264
- specification_version: 3
265
- summary: ! 'Net::SSH: a pure-Ruby implementation of the SSH2 client protocol.'
253
+ specification_version: 4
254
+ summary: 'Net::SSH: a pure-Ruby implementation of the SSH2 client protocol.'
266
255
  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
- FgNjb20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