diff options
-rw-r--r-- | .ruby-version | 1 | ||||
-rw-r--r-- | lib/net/ssh.rb | 4 | ||||
-rw-r--r-- | lib/net/ssh/buffer.rb | 4 | ||||
-rw-r--r-- | lib/net/ssh/transport/cipher_factory.rb | 10 | ||||
-rw-r--r-- | support/arcfour_check.rb | 10 | ||||
-rw-r--r-- | test/test_buffer.rb | 2 | ||||
-rw-r--r-- | test/test_key_factory.rb | 4 |
7 files changed, 18 insertions, 17 deletions
diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..005119b --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.4.1 diff --git a/lib/net/ssh.rb b/lib/net/ssh.rb index a7aa298..761044b 100644 --- a/lib/net/ssh.rb +++ b/lib/net/ssh.rb @@ -177,7 +177,7 @@ module Net # * :user_known_hosts_file => the location of the user known hosts file. # Set to an array to specify multiple user known hosts files. # Defaults to %w(~/.ssh/known_hosts ~/.ssh/known_hosts2). - # * :use_agent => Set false to disable the use of ssh-agent. Defaults to + # * :use_agent => Set false to disable the use of ssh-agent. Defaults to # true # * :non_interactive => set to true if your app is non interactive and prefers # authentication failure vs password prompt @@ -219,7 +219,7 @@ module Net if options[:verbose] options[:logger].level = case options[:verbose] - when Fixnum then options[:verbose] + when Integer then options[:verbose] when :debug then Logger::DEBUG when :info then Logger::INFO when :warn then Logger::WARN diff --git a/lib/net/ssh/buffer.rb b/lib/net/ssh/buffer.rb index d0c4ced..563966a 100644 --- a/lib/net/ssh/buffer.rb +++ b/lib/net/ssh/buffer.rb @@ -152,7 +152,7 @@ module Net; module SSH end # Reads all data up to and including the given pattern, which may be a - # String, Fixnum, or Regexp and is interpreted exactly as String#index + # String, Integer, or Regexp and is interpreted exactly as String#index # does. Returns nil if nothing matches. Increments the position to point # immediately after the pattern, if it does match. Returns all data up to # and including the text that matched the pattern. @@ -160,7 +160,7 @@ module Net; module SSH index = @content.index(pattern, @position) or return nil length = case pattern when String then pattern.length - when Fixnum then 1 + when Integer then 1 when Regexp then $&.length end index && read(index+length) diff --git a/lib/net/ssh/transport/cipher_factory.rb b/lib/net/ssh/transport/cipher_factory.rb index 7bb1946..3574120 100644 --- a/lib/net/ssh/transport/cipher_factory.rb +++ b/lib/net/ssh/transport/cipher_factory.rb @@ -45,8 +45,8 @@ module Net; module SSH; module Transport } # Ruby's OpenSSL bindings always return a key length of 16 for RC4 ciphers - # resulting in the error: OpenSSL::CipherError: key length too short. - # The following ciphers will override this key length. + # resulting in the error: OpenSSL::CipherError: key length too short. + # The following ciphers will override this key length. KEY_LEN_OVERRIDE = { "arcfour256" => 32, "arcfour512" => 64 @@ -69,7 +69,7 @@ module Net; module SSH; module Transport def self.get(name, options={}) ossl_name = SSH_TO_OSSL[name] or raise NotImplementedError, "unimplemented cipher `#{name}'" return IdentityCipher if ossl_name == "none" - cipher = OpenSSL::Cipher::Cipher.new(ossl_name) + cipher = OpenSSL::Cipher.new(ossl_name) cipher.send(options[:encrypt] ? :encrypt : :decrypt) @@ -94,10 +94,10 @@ module Net; module SSH; module Transport ossl_name = SSH_TO_OSSL[name] return [0, 0] if ossl_name.nil? || ossl_name == "none" - cipher = OpenSSL::Cipher::Cipher.new(ossl_name) + cipher = OpenSSL::Cipher.new(ossl_name) key_len = KEY_LEN_OVERRIDE[name] || cipher.key_len cipher.key_len = key_len - + return [key_len, ossl_name=="rc4" ? 8 : cipher.block_size] end end diff --git a/support/arcfour_check.rb b/support/arcfour_check.rb index a823a1f..7cea334 100644 --- a/support/arcfour_check.rb +++ b/support/arcfour_check.rb @@ -1,15 +1,15 @@ require 'net/ssh' -# ARCFOUR CHECK -# +# ARCFOUR CHECK +# # Usage: # $ ruby support/arcfour_check.rb # # Expected Output: -# arcfour128: [16, 8] OpenSSL::Cipher::Cipher -# arcfour256: [32, 8] OpenSSL::Cipher::Cipher -# arcfour512: [64, 8] OpenSSL::Cipher::Cipher +# arcfour128: [16, 8] OpenSSL::Cipher +# arcfour256: [32, 8] OpenSSL::Cipher +# arcfour512: [64, 8] OpenSSL::Cipher [['arcfour128', 16], ['arcfour256', 32], ['arcfour512', 64]].each do |cipher| print "#{cipher[0]}: " diff --git a/test/test_buffer.rb b/test/test_buffer.rb index ea2a584..1fda343 100644 --- a/test/test_buffer.rb +++ b/test/test_buffer.rb @@ -264,7 +264,7 @@ class TestBuffer < Test::Unit::TestCase assert_equal 6, buffer.position end - def test_read_to_should_grok_fixnum_patterns + def test_read_to_should_grok_integer_patterns buffer = new("one two three") assert_equal "one tw", buffer.read_to(?w) assert_equal 6, buffer.position diff --git a/test/test_key_factory.rb b/test/test_key_factory.rb index 5bc90b2..e3976f0 100644 --- a/test/test_key_factory.rb +++ b/test/test_key_factory.rb @@ -5,7 +5,7 @@ class TestKeyFactory < Test::Unit::TestCase def setup @key_file = File.expand_path("/key-file") end - + def test_load_unencrypted_private_RSA_key_should_return_key File.expects(:read).with(@key_file).returns(rsa_key.export) assert_equal rsa_key.to_der, Net::SSH::KeyFactory.load_private_key(@key_file).to_der @@ -176,7 +176,7 @@ WEKt5v3QsUEgVrzkM4K9UbI= end def encrypted(key, password) - key.export(OpenSSL::Cipher::Cipher.new("des-ede3-cbc"), password) + key.export(OpenSSL::Cipher.new("des-ede3-cbc"), password) end def public(key, args = nil) |