summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Wininger <fw.centrale@gmail.com>2021-10-25 15:25:57 +0200
committerFlorian Wininger <fw.centrale@gmail.com>2021-10-25 15:55:44 +0200
commitf79ed49dc068317fb280bd2fb554ecb0ce13a7e1 (patch)
tree32fbf2392f8225905d6cf77412f0f01dbbf82097
parentcf1b4da0d56e6b0598f9d5fbc3c335011f42bc26 (diff)
downloadnet-ssh-f79ed49dc068317fb280bd2fb554ecb0ce13a7e1.tar.gz
Fix rubocop coding style.
Lot of spacing issues :)
-rw-r--r--.rubocop_todo.yml70
-rw-r--r--lib/net/ssh.rb6
-rw-r--r--lib/net/ssh/authentication/agent.rb22
-rw-r--r--lib/net/ssh/authentication/certificate.rb4
-rw-r--r--lib/net/ssh/authentication/ed25519.rb8
-rw-r--r--lib/net/ssh/authentication/key_manager.rb4
-rw-r--r--lib/net/ssh/authentication/methods/abstract.rb4
-rw-r--r--lib/net/ssh/authentication/methods/hostbased.rb6
-rw-r--r--lib/net/ssh/authentication/methods/keyboard_interactive.rb2
-rw-r--r--lib/net/ssh/authentication/methods/none.rb2
-rw-r--r--lib/net/ssh/authentication/methods/password.rb2
-rw-r--r--lib/net/ssh/authentication/methods/publickey.rb8
-rw-r--r--lib/net/ssh/authentication/pageant.rb16
-rw-r--r--lib/net/ssh/authentication/pub_key_fingerprint.rb4
-rw-r--r--lib/net/ssh/authentication/session.rb4
-rw-r--r--lib/net/ssh/buffer.rb8
-rw-r--r--lib/net/ssh/buffered_io.rb12
-rw-r--r--lib/net/ssh/config.rb8
-rw-r--r--lib/net/ssh/connection/channel.rb26
-rw-r--r--lib/net/ssh/connection/event_loop.rb16
-rw-r--r--lib/net/ssh/connection/session.rb26
-rw-r--r--lib/net/ssh/errors.rb4
-rw-r--r--lib/net/ssh/key_factory.rb14
-rw-r--r--lib/net/ssh/known_hosts.rb8
-rw-r--r--lib/net/ssh/prompt.rb2
-rw-r--r--lib/net/ssh/proxy/http.rb2
-rw-r--r--lib/net/ssh/proxy/https.rb4
-rw-r--r--lib/net/ssh/proxy/socks4.rb2
-rw-r--r--lib/net/ssh/proxy/socks5.rb2
-rw-r--r--lib/net/ssh/service/forward.rb8
-rw-r--r--lib/net/ssh/test.rb6
-rw-r--r--lib/net/ssh/test/channel.rb6
-rw-r--r--lib/net/ssh/test/extensions.rb12
-rw-r--r--lib/net/ssh/test/packet.rb2
-rw-r--r--lib/net/ssh/test/script.rb6
-rw-r--r--lib/net/ssh/test/socket.rb2
-rw-r--r--lib/net/ssh/transport/algorithms.rb24
-rw-r--r--lib/net/ssh/transport/cipher_factory.rb30
-rw-r--r--lib/net/ssh/transport/ctr.rb6
-rw-r--r--lib/net/ssh/transport/hmac.rb24
-rw-r--r--lib/net/ssh/transport/hmac/abstract.rb8
-rw-r--r--lib/net/ssh/transport/identity_cipher.rb2
-rw-r--r--lib/net/ssh/transport/kex.rb14
-rw-r--r--lib/net/ssh/transport/kex/abstract.rb6
-rw-r--r--lib/net/ssh/transport/kex/abstract5656.rb2
-rw-r--r--lib/net/ssh/transport/kex/curve25519_sha256.rb2
-rw-r--r--lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb8
-rw-r--r--lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb2
-rw-r--r--lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb2
-rw-r--r--lib/net/ssh/transport/key_expander.rb2
-rw-r--r--lib/net/ssh/transport/openssl.rb6
-rw-r--r--lib/net/ssh/transport/packet_stream.rb2
-rw-r--r--lib/net/ssh/transport/session.rb12
-rw-r--r--lib/net/ssh/transport/state.rb2
-rw-r--r--test/authentication/methods/common.rb6
-rw-r--r--test/authentication/methods/test_abstract.rb2
-rw-r--r--test/authentication/methods/test_hostbased.rb10
-rw-r--r--test/authentication/methods/test_keyboard_interactive.rb24
-rw-r--r--test/authentication/methods/test_none.rb6
-rw-r--r--test/authentication/methods/test_password.rb12
-rw-r--r--test/authentication/methods/test_publickey.rb12
-rw-r--r--test/authentication/test_agent.rb34
-rw-r--r--test/authentication/test_ed25519.rb10
-rw-r--r--test/authentication/test_key_manager.rb2
-rw-r--r--test/authentication/test_session.rb4
-rw-r--r--test/common.rb8
-rw-r--r--test/connection/test_channel.rb60
-rw-r--r--test/connection/test_session.rb52
-rw-r--r--test/integration/common.rb6
-rw-r--r--test/integration/mitm_server.rb2
-rw-r--r--test/integration/test_cert_user_auth.rb8
-rw-r--r--test/integration/test_channel.rb2
-rw-r--r--test/integration/test_ed25519_pkeys.rb8
-rw-r--r--test/integration/test_forward.rb8
-rw-r--r--test/integration/test_hmac_etm.rb2
-rw-r--r--test/integration/test_http_proxy.rb2
-rw-r--r--test/integration/test_id_rsa_keys.rb14
-rw-r--r--test/integration/test_proxy.rb10
-rw-r--r--test/manual/test_pageant.rb2
-rw-r--r--test/test_buffer.rb2
-rw-r--r--test/test_config.rb2
-rw-r--r--test/test_key_factory.rb2
-rw-r--r--test/test_known_hosts.rb40
-rw-r--r--test/transport/kex/test_diffie_hellman_group1_sha1.rb24
-rw-r--r--test/transport/kex/test_diffie_hellman_group_exchange_sha1.rb30
-rw-r--r--test/transport/test_algorithms.rb62
-rw-r--r--test/transport/test_cipher_factory.rb34
-rw-r--r--test/transport/test_hmac.rb2
-rw-r--r--test/transport/test_packet_stream.rb10
-rw-r--r--test/transport/test_server_version.rb2
-rw-r--r--test/transport/test_session.rb2
-rw-r--r--test/transport/test_state.rb2
-rw-r--r--test/verifiers/test_always.rb6
-rw-r--r--test/win_integration/test_pageant.rb2
94 files changed, 475 insertions, 545 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index f0c63ba..0cec116 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -6,52 +6,6 @@
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
-# Offense count: 75
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle, IndentationWidth.
-# SupportedStyles: with_first_argument, with_fixed_indentation
-Layout/ArgumentAlignment:
- Enabled: false
-
-# Offense count: 1
-# Cop supports --auto-correct.
-Layout/CommentIndentation:
- Exclude:
- - 'test/common.rb'
-
-# Offense count: 35
-# Cop supports --auto-correct.
-# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
-# SupportedHashRocketStyles: key, separator, table
-# SupportedColonStyles: key, separator, table
-# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
-Layout/HashAlignment:
- Exclude:
- - 'lib/net/ssh/key_factory.rb'
- - 'lib/net/ssh/transport/cipher_factory.rb'
- - 'lib/net/ssh/transport/hmac.rb'
- - 'lib/net/ssh/transport/kex.rb'
-
-# Offense count: 33
-# Cop supports --auto-correct.
-# Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment.
-Layout/LeadingCommentSpace:
- Exclude:
- - 'lib/net/ssh/buffered_io.rb'
- - 'lib/net/ssh/connection/channel.rb'
- - 'lib/net/ssh/connection/session.rb'
- - 'lib/net/ssh/errors.rb'
- - 'lib/net/ssh/proxy/https.rb'
- - 'lib/net/ssh/service/forward.rb'
- - 'lib/net/ssh/test/extensions.rb'
- - 'lib/net/ssh/transport/ctr.rb'
- - 'lib/net/ssh/transport/kex/abstract.rb'
- - 'lib/net/ssh/transport/kex/abstract5656.rb'
- - 'lib/net/ssh/transport/kex/curve25519_sha256.rb'
- - 'lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb'
- - 'lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb'
- - 'lib/net/ssh/transport/session.rb'
-
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, IndentationWidth.
@@ -71,30 +25,6 @@ Layout/MultilineOperationIndentation:
- 'lib/net/ssh/transport/algorithms.rb'
- 'lib/net/ssh/transport/state.rb'
-# Offense count: 294
-# Cop supports --auto-correct.
-Layout/SpaceAfterComma:
- Enabled: false
-
-# Offense count: 136
-# Cop supports --auto-correct.
-# Configuration parameters: EnforcedStyle.
-# SupportedStyles: space, no_space
-Layout/SpaceAroundEqualsInParameterDefault:
- Enabled: false
-
-# Offense count: 5
-# Cop supports --auto-correct.
-# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
-# SupportedStylesForExponentOperator: space, no_space
-Layout/SpaceAroundOperators:
- Exclude:
- - 'lib/net/ssh/key_factory.rb'
- - 'lib/net/ssh/known_hosts.rb'
- - 'lib/net/ssh/test/extensions.rb'
- - 'lib/net/ssh/transport/hmac/abstract.rb'
- - 'lib/net/ssh/transport/identity_cipher.rb'
-
# Offense count: 5
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
diff --git a/lib/net/ssh.rb b/lib/net/ssh.rb
index bbae909..b72ab7f 100644
--- a/lib/net/ssh.rb
+++ b/lib/net/ssh.rb
@@ -214,7 +214,7 @@ module Net
# * :fingerprint_hash => 'MD5' or 'SHA256', defaults to 'SHA256'
# If +user+ parameter is nil it defaults to USER from ssh_config, or
# local username
- def self.start(host, user=nil, options={}, &block)
+ def self.start(host, user = nil, options = {}, &block)
invalid_options = options.keys - VALID_OPTIONS
if invalid_options.any?
raise ArgumentError, "invalid option(s): #{invalid_options.join(', ')}"
@@ -301,9 +301,9 @@ module Net
end
def self._sanitize_options(options)
- invalid_option_values = [nil,[nil]]
+ invalid_option_values = [nil, [nil]]
unless (options.values & invalid_option_values).empty?
- nil_options = options.select { |_k,v| invalid_option_values.include?(v) }.map(&:first)
+ nil_options = options.select { |_k, v| invalid_option_values.include?(v) }.map(&:first)
Kernel.warn "#{caller_locations(2, 1)[0]}: Passing nil, or [nil] to Net::SSH.start is deprecated for keys: #{nil_options.join(', ')}"
end
end
diff --git a/lib/net/ssh/authentication/agent.rb b/lib/net/ssh/authentication/agent.rb
index f521e55..ab6dce9 100644
--- a/lib/net/ssh/authentication/agent.rb
+++ b/lib/net/ssh/authentication/agent.rb
@@ -65,7 +65,7 @@ module Net
# Instantiates a new agent object, connects to a running SSH agent,
# negotiates the agent protocol version, and returns the agent object.
- def self.connect(logger=nil, agent_socket_factory = nil, identity_agent = nil)
+ def self.connect(logger = nil, agent_socket_factory = nil, identity_agent = nil)
agent = new(logger)
agent.connect!(agent_socket_factory, identity_agent)
agent.negotiate!
@@ -74,7 +74,7 @@ module Net
# Creates a new Agent object, using the optional logger instance to
# report status.
- def initialize(logger=nil)
+ def initialize(logger = nil)
self.logger = logger
end
@@ -177,7 +177,7 @@ module Net
req_type = constraints.empty? ? SSH2_AGENT_ADD_IDENTITY : SSH2_AGENT_ADD_ID_CONSTRAINED
type, = send_and_wait(req_type, :string, priv_key.ssh_type, :raw, blob_for_add(priv_key),
- :string, comment, :raw, constraints)
+ :string, comment, :raw, constraints)
raise AgentError, "could not add identity to agent" if type != SSH_AGENT_SUCCESS
end
@@ -251,31 +251,31 @@ module Net
case priv_key.ssh_type
when /^ssh-dss$/
Net::SSH::Buffer.from(:bignum, priv_key.p, :bignum, priv_key.q, :bignum, priv_key.g,
- :bignum, priv_key.pub_key, :bignum, priv_key.priv_key).to_s
+ :bignum, priv_key.pub_key, :bignum, priv_key.priv_key).to_s
when /^ssh-dss-cert-v01@openssh\.com$/
Net::SSH::Buffer.from(:string, priv_key.to_blob, :bignum, priv_key.key.priv_key).to_s
when /^ecdsa\-sha2\-(\w*)$/
curve_name = OpenSSL::PKey::EC::CurveNameAliasInv[priv_key.group.curve_name]
Net::SSH::Buffer.from(:string, curve_name, :mstring, priv_key.public_key.to_bn.to_s(2),
- :bignum, priv_key.private_key).to_s
+ :bignum, priv_key.private_key).to_s
when /^ecdsa\-sha2\-(\w*)-cert-v01@openssh\.com$/
Net::SSH::Buffer.from(:string, priv_key.to_blob, :bignum, priv_key.key.private_key).to_s
when /^ssh-ed25519$/
Net::SSH::Buffer.from(:string, priv_key.public_key.verify_key.to_bytes,
- :string, priv_key.sign_key.keypair).to_s
+ :string, priv_key.sign_key.keypair).to_s
when /^ssh-ed25519-cert-v01@openssh\.com$/
# Unlike the other certificate types, the public key is included after the certifiate.
Net::SSH::Buffer.from(:string, priv_key.to_blob,
- :string, priv_key.key.public_key.verify_key.to_bytes,
- :string, priv_key.key.sign_key.keypair).to_s
+ :string, priv_key.key.public_key.verify_key.to_bytes,
+ :string, priv_key.key.sign_key.keypair).to_s
when /^ssh-rsa$/
# `n` and `e` are reversed compared to the ordering in `OpenSSL::PKey::RSA#to_blob`.
Net::SSH::Buffer.from(:bignum, priv_key.n, :bignum, priv_key.e, :bignum, priv_key.d,
- :bignum, priv_key.iqmp, :bignum, priv_key.p, :bignum, priv_key.q).to_s
+ :bignum, priv_key.iqmp, :bignum, priv_key.p, :bignum, priv_key.q).to_s
when /^ssh-rsa-cert-v01@openssh\.com$/
Net::SSH::Buffer.from(:string, priv_key.to_blob, :bignum, priv_key.key.d,
- :bignum, priv_key.key.iqmp, :bignum, priv_key.key.p,
- :bignum, priv_key.key.q).to_s
+ :bignum, priv_key.key.iqmp, :bignum, priv_key.key.p,
+ :bignum, priv_key.key.q).to_s
end
end
end
diff --git a/lib/net/ssh/authentication/certificate.rb b/lib/net/ssh/authentication/certificate.rb
index deeb71d..c9619fa 100644
--- a/lib/net/ssh/authentication/certificate.rb
+++ b/lib/net/ssh/authentication/certificate.rb
@@ -83,7 +83,7 @@ module Net
end
# Signs the certificate with key.
- def sign!(key, sign_nonce=nil)
+ def sign!(key, sign_nonce = nil)
# ssh-keygen uses 32 bytes of nonce.
self.nonce = sign_nonce || SecureRandom.random_bytes(32)
self.signature_key = key
@@ -94,7 +94,7 @@ module Net
self
end
- def sign(key, sign_nonce=nil)
+ def sign(key, sign_nonce = nil)
cert = clone
cert.sign!(key, sign_nonce)
end
diff --git a/lib/net/ssh/authentication/ed25519.rb b/lib/net/ssh/authentication/ed25519.rb
index 0c5bdf2..c2a117a 100644
--- a/lib/net/ssh/authentication/ed25519.rb
+++ b/lib/net/ssh/authentication/ed25519.rb
@@ -14,7 +14,7 @@ module Net
module Authentication
module ED25519
class SigningKeyFromFile < SimpleDelegator
- def initialize(pk,sk)
+ def initialize(pk, sk)
key = ::Ed25519::SigningKey.from_keypair(sk)
raise ArgumentError, "pk does not match sk" unless pk == key.verify_key.to_bytes
@@ -116,7 +116,7 @@ module Net
end
def to_blob
- Net::SSH::Buffer.from(:mstring,"ssh-ed25519".dup,:string,@verify_key.to_bytes).to_s
+ Net::SSH::Buffer.from(:mstring, "ssh-ed25519".dup, :string, @verify_key.to_bytes).to_s
end
def ssh_type
@@ -128,7 +128,7 @@ module Net
end
def ssh_do_verify(sig, data, options = {})
- @verify_key.verify(sig,data)
+ @verify_key.verify(sig, data)
end
def to_pem
@@ -152,7 +152,7 @@ module Net
_comment = buffer.read_string
@pk = pk
- @sign_key = SigningKeyFromFile.new(pk,sk)
+ @sign_key = SigningKeyFromFile.new(pk, sk)
end
def to_blob
diff --git a/lib/net/ssh/authentication/key_manager.rb b/lib/net/ssh/authentication/key_manager.rb
index d41eed8..ac86cc8 100644
--- a/lib/net/ssh/authentication/key_manager.rb
+++ b/lib/net/ssh/authentication/key_manager.rb
@@ -41,7 +41,7 @@ module Net
# Create a new KeyManager. By default, the manager will
# use the ssh-agent if it is running and the `:use_agent` option
# is not false.
- def initialize(logger, options={})
+ def initialize(logger, options = {})
self.logger = logger
@key_files = []
@key_data = []
@@ -171,7 +171,7 @@ module Net
if info[:key]
return Net::SSH::Buffer.from(:string, identity.ssh_signature_type,
- :mstring, info[:key].ssh_do_sign(data.to_s)).to_s
+ :mstring, info[:key].ssh_do_sign(data.to_s)).to_s
end
if info[:from] == :agent
diff --git a/lib/net/ssh/authentication/methods/abstract.rb b/lib/net/ssh/authentication/methods/abstract.rb
index ec35043..07aa5f3 100644
--- a/lib/net/ssh/authentication/methods/abstract.rb
+++ b/lib/net/ssh/authentication/methods/abstract.rb
@@ -21,7 +21,7 @@ module Net
attr_reader :key_manager
# Instantiates a new authentication method.
- def initialize(session, options={})
+ def initialize(session, options = {})
@session = session
@key_manager = options[:key_manager]
@options = options
@@ -46,7 +46,7 @@ module Net
# of the packet. The new packet is returned, ready for sending.
def userauth_request(username, next_service, auth_method, *others)
buffer = Net::SSH::Buffer.from(:byte, USERAUTH_REQUEST,
- :string, username, :string, next_service, :string, auth_method)
+ :string, username, :string, next_service, :string, auth_method)
others.each do |value|
case value
diff --git a/lib/net/ssh/authentication/methods/hostbased.rb b/lib/net/ssh/authentication/methods/hostbased.rb
index c4cd4cb..6c92ef4 100644
--- a/lib/net/ssh/authentication/methods/hostbased.rb
+++ b/lib/net/ssh/authentication/methods/hostbased.rb
@@ -10,12 +10,12 @@ module Net
# Attempts to perform host-based authorization of the user by trying
# all known keys.
- def authenticate(next_service, username, password=nil)
+ def authenticate(next_service, username, password = nil)
return false unless key_manager
key_manager.each_identity do |identity|
return true if authenticate_with(identity, next_service,
- username, key_manager)
+ username, key_manager)
end
return false
@@ -63,7 +63,7 @@ module Net
# Build the "core" hostbased request string.
def build_request(identity, next_service, username, hostname, client_username)
userauth_request(username, next_service, "hostbased", identity.ssh_type,
- Buffer.from(:key, identity).to_s, hostname, client_username).to_s
+ Buffer.from(:key, identity).to_s, hostname, client_username).to_s
end
end
end
diff --git a/lib/net/ssh/authentication/methods/keyboard_interactive.rb b/lib/net/ssh/authentication/methods/keyboard_interactive.rb
index c241eda..db195d9 100644
--- a/lib/net/ssh/authentication/methods/keyboard_interactive.rb
+++ b/lib/net/ssh/authentication/methods/keyboard_interactive.rb
@@ -11,7 +11,7 @@ module Net
USERAUTH_INFO_RESPONSE = 61
# Attempt to authenticate the given user for the given service.
- def authenticate(next_service, username, password=nil)
+ def authenticate(next_service, username, password = nil)
debug { "trying keyboard-interactive" }
send_message(userauth_request(username, next_service, "keyboard-interactive", "", ""))
diff --git a/lib/net/ssh/authentication/methods/none.rb b/lib/net/ssh/authentication/methods/none.rb
index 09fdac8..d38e877 100644
--- a/lib/net/ssh/authentication/methods/none.rb
+++ b/lib/net/ssh/authentication/methods/none.rb
@@ -8,7 +8,7 @@ module Net
# Implements the "none" SSH authentication method.
class None < Abstract
# Attempt to authenticate as "none"
- def authenticate(next_service, user="", password="")
+ def authenticate(next_service, user = "", password = "")
send_message(userauth_request(user, next_service, "none"))
message = session.next_message
diff --git a/lib/net/ssh/authentication/methods/password.rb b/lib/net/ssh/authentication/methods/password.rb
index 9cb1828..ffb881c 100644
--- a/lib/net/ssh/authentication/methods/password.rb
+++ b/lib/net/ssh/authentication/methods/password.rb
@@ -10,7 +10,7 @@ module Net
class Password < Abstract
# Attempt to authenticate the given user for the given service. If
# the password parameter is nil, this will ask for password
- def authenticate(next_service, username, password=nil)
+ def authenticate(next_service, username, password = nil)
clear_prompter!
retries = 0
max_retries = get_max_retries
diff --git a/lib/net/ssh/authentication/methods/publickey.rb b/lib/net/ssh/authentication/methods/publickey.rb
index 65e5dca..eb4d740 100644
--- a/lib/net/ssh/authentication/methods/publickey.rb
+++ b/lib/net/ssh/authentication/methods/publickey.rb
@@ -12,7 +12,7 @@ module Net
# username, trying each identity known to the key manager. If any of
# them succeed, returns +true+, otherwise returns +false+. This
# requires the presence of a key manager.
- def authenticate(next_service, username, password=nil)
+ def authenticate(next_service, username, password = nil)
return false unless key_manager
key_manager.each_identity do |identity|
@@ -31,12 +31,12 @@ module Net
blob.write_key pub_key
userauth_request(username, next_service, "publickey", has_sig,
- pub_key.ssh_type, blob.to_s)
+ pub_key.ssh_type, blob.to_s)
end
# Builds and sends a request formatted for a public-key
# authentication request.
- def send_request(pub_key, username, next_service, signature=nil)
+ def send_request(pub_key, username, next_service, signature = nil)
msg = build_request(pub_key, username, next_service, !signature.nil?)
msg.write_string(signature) if signature
send_message(msg)
@@ -76,7 +76,7 @@ module Net
return false
else
raise Net::SSH::Exception,
- "unexpected server response to USERAUTH_REQUEST: #{message.type} (#{message.inspect})"
+ "unexpected server response to USERAUTH_REQUEST: #{message.type} (#{message.inspect})"
end
when USERAUTH_FAILURE
diff --git a/lib/net/ssh/authentication/pageant.rb b/lib/net/ssh/authentication/pageant.rb
index 9c44c19..a186c17 100644
--- a/lib/net/ssh/authentication/pageant.rb
+++ b/lib/net/ssh/authentication/pageant.rb
@@ -50,13 +50,13 @@ module Net
SIZEOF_DWORD = DL.sizeof('L')
elsif RUBY_VERSION < "2.1"
extend DL::Importer
- dlload 'user32.dll','kernel32.dll', 'advapi32.dll'
+ dlload 'user32.dll', 'kernel32.dll', 'advapi32.dll'
include DL::Win32Types
SIZEOF_DWORD = DL::SIZEOF_LONG
else
extend Fiddle::Importer
- dlload 'user32.dll','kernel32.dll', 'advapi32.dll'
+ dlload 'user32.dll', 'kernel32.dll', 'advapi32.dll'
include Fiddle::Win32Types
SIZEOF_DWORD = Fiddle::SIZEOF_LONG
end
@@ -240,7 +240,7 @@ module Net
end
def self.set_ptr_data(ptr, data)
- DL::CPtr.new(ptr)[0,data.size] = data
+ DL::CPtr.new(ptr)[0, data.size] = data
end
end
@@ -281,7 +281,7 @@ module Net
def self.ptr_to_dword(ptr)
first = ptr.ptr.to_i
- second = ptr_to_s(ptr,Win::SIZEOF_DWORD).unpack('L')[0]
+ second = ptr_to_s(ptr, Win::SIZEOF_DWORD).unpack('L')[0]
raise "Error" unless first == second
first
@@ -296,7 +296,7 @@ module Net
end
def self.get_sid(user)
- ptr_to_s(user.to_ptr.ptr,Win::SIZEOF_DWORD).unpack('L')[0]
+ ptr_to_s(user.to_ptr.ptr, Win::SIZEOF_DWORD).unpack('L')[0]
end
def self.get_sid_ptr(user)
@@ -332,7 +332,7 @@ module Net
token_handle = open_process_token(Win.GetCurrentProcess,
Win::TOKEN_QUERY)
token_user = get_token_information(token_handle,
- Win::TOKEN_USER_INFORMATION_CLASS)
+ Win::TOKEN_USER_INFORMATION_CLASS)
return token_user
end
@@ -404,7 +404,7 @@ module Net
if @win.to_i == 0
raise Net::SSH::Exception,
- "pageant process not running"
+ "pageant process not running"
end
@input_buffer = Net::SSH::Buffer.new
@@ -458,7 +458,7 @@ module Net
if filemap == 0 || filemap == Win::INVALID_HANDLE_VALUE
raise Net::SSH::Exception,
- "Creation of file mapping failed with error: #{Win.GetLastError}"
+ "Creation of file mapping failed with error: #{Win.GetLastError}"
end
ptr = Win.MapViewOfFile(filemap, Win::FILE_MAP_WRITE, 0, 0,
diff --git a/lib/net/ssh/authentication/pub_key_fingerprint.rb b/lib/net/ssh/authentication/pub_key_fingerprint.rb
index a776006..42f2f16 100644
--- a/lib/net/ssh/authentication/pub_key_fingerprint.rb
+++ b/lib/net/ssh/authentication/pub_key_fingerprint.rb
@@ -22,12 +22,12 @@ module Net
# returned by OpenSSH's <tt>`ssh-add -l -E SHA256`</tt>, i.e.,
# trailing base64 padding '=' characters are stripped and the
# literal string +SHA256:+ is prepended.
- def fingerprint(algorithm='MD5')
+ def fingerprint(algorithm = 'MD5')
@fingerprint ||= {}
@fingerprint[algorithm] ||= PubKeyFingerprint.fingerprint(to_blob, algorithm)
end
- def self.fingerprint(blob, algorithm='MD5')
+ def self.fingerprint(blob, algorithm = 'MD5')
case algorithm.to_s.upcase
when 'MD5'
OpenSSL::Digest.hexdigest(algorithm, blob).scan(/../).join(":")
diff --git a/lib/net/ssh/authentication/session.rb b/lib/net/ssh/authentication/session.rb
index 4451cde..e4fc648 100644
--- a/lib/net/ssh/authentication/session.rb
+++ b/lib/net/ssh/authentication/session.rb
@@ -41,7 +41,7 @@ module Net
# Instantiates a new Authentication::Session object over the given
# transport layer abstraction.
- def initialize(transport, options={})
+ def initialize(transport, options = {})
self.logger = transport.logger
@transport = transport
@@ -54,7 +54,7 @@ module Net
# Attempts to authenticate the given user, in preparation for the next
# service request. Returns true if an authentication method succeeds in
# authenticating the user, and false otherwise.
- def authenticate(next_service, username, password=nil)
+ def authenticate(next_service, username, password = nil)
debug { "beginning authentication of `#{username}'" }
transport.send_message(transport.service_request("ssh-userauth"))
diff --git a/lib/net/ssh/buffer.rb b/lib/net/ssh/buffer.rb
index 3934ae7..b68d656 100644
--- a/lib/net/ssh/buffer.rb
+++ b/lib/net/ssh/buffer.rb
@@ -70,7 +70,7 @@ module Net
# Creates a new buffer, initialized to the given content. The position
# is initialized to the beginning of the buffer.
- def initialize(content=String.new)
+ def initialize(content = String.new)
@content = content.to_s
@position = 0
end
@@ -128,7 +128,7 @@ module Net
# would otherwise tend to grow without bound.
#
# Returns the buffer object itself.
- def consume!(n=position)
+ def consume!(n = position)
if n >= length
# optimize for a fairly common case
clear!
@@ -171,7 +171,7 @@ module Net
# Reads and returns the next +count+ bytes from the buffer, starting from
# the read position. If +count+ is +nil+, this will return all remaining
# text in the buffer. This method will increment the pointer.
- def read(count=nil)
+ def read(count = nil)
count ||= length
count = length - @position if @position + count > length
@position += count
@@ -180,7 +180,7 @@ module Net
# Reads (as #read) and returns the given number of bytes from the buffer,
# and then consumes (as #consume!) all data up to the new read position.
- def read!(count=nil)
+ def read!(count = nil)
data = read(count)
consume!
data
diff --git a/lib/net/ssh/buffered_io.rb b/lib/net/ssh/buffered_io.rb
index 464ba4c..c2d34e2 100644
--- a/lib/net/ssh/buffered_io.rb
+++ b/lib/net/ssh/buffered_io.rb
@@ -51,7 +51,7 @@ module Net
# Called when the #extend is called on an object, with this module as the
# argument. It ensures that the modules instance variables are all properly
# initialized.
- def self.extended(object) #:nodoc:
+ def self.extended(object) # :nodoc:
# need to use __send__ because #send is overridden in Socket
object.__send__(:initialize_buffered_io)
end
@@ -59,7 +59,7 @@ module Net
# Tries to read up to +n+ bytes of data from the remote end, and appends
# the data to the input buffer. It returns the number of bytes read, or 0
# if no data was available to be read.
- def fill(n=8192)
+ def fill(n = 8192)
input.consume!
data = recv(n)
debug { "read #{data.length} bytes" }
@@ -72,7 +72,7 @@ module Net
# Read up to +length+ bytes from the input buffer. If +length+ is nil,
# all available data is read from the buffer. (See #available.)
- def read_available(length=nil)
+ def read_available(length = nil)
input.read(length || available)
end
@@ -121,11 +121,11 @@ module Net
public # these methods are primarily for use in tests
- def write_buffer #:nodoc:
+ def write_buffer # :nodoc:
output.to_s
end
- def read_buffer #:nodoc:
+ def read_buffer # :nodoc:
input.to_s
end
@@ -166,7 +166,7 @@ module Net
# http://github.com/net-ssh/net-ssh/tree/portfwfix
#
module ForwardedBufferedIo
- def fill(n=8192)
+ def fill(n = 8192)
begin
super(n)
rescue Errno::ECONNRESET => e
diff --git a/lib/net/ssh/config.rb b/lib/net/ssh/config.rb
index 6f0f4da..86c75f5 100644
--- a/lib/net/ssh/config.rb
+++ b/lib/net/ssh/config.rb
@@ -65,7 +65,7 @@ module Net
# given +files+ (defaulting to the list of files returned by
# #default_files), translates the resulting hash into the options
# recognized by Net::SSH, and returns them.
- def for(host, files=expandable_default_files)
+ def for(host, files = expandable_default_files)
translate(files.inject({}) { |settings, file|
load(file, host, settings)
})
@@ -77,7 +77,7 @@ module Net
# ones. Returns a hash containing the OpenSSH options. (See
# #translate for how to convert the OpenSSH options into Net::SSH
# options.)
- def load(path, host, settings={}, base_dir = nil)
+ def load(path, host, settings = {}, base_dir = nil)
file = File.expand_path(path)
base_dir ||= File.dirname(file)
return settings unless File.readable?(file)
@@ -317,7 +317,7 @@ module Net
tail = pattern
prefix = String.new
while !tail.empty? do
- head,sep,tail = tail.partition(/[\*\?]/)
+ head, sep, tail = tail.partition(/[\*\?]/)
prefix = prefix + Regexp.quote(head)
case sep
when '*'
@@ -371,7 +371,7 @@ module Net
conditions = conditions.each_slice(2)
condition_matches = []
- conditions.each do |(kind,exprs)|
+ conditions.each do |(kind, exprs)|
exprs = unquote(exprs)
case kind.downcase
diff --git a/lib/net/ssh/connection/channel.rb b/lib/net/ssh/connection/channel.rb
index b169679..6fcf790 100644
--- a/lib/net/ssh/connection/channel.rb
+++ b/lib/net/ssh/connection/channel.rb
@@ -96,12 +96,12 @@ module Net
# The output buffer for this channel. Data written to the channel is
# enqueued here, to be written as CHANNEL_DATA packets during each pass of
# the event loop. See Connection::Session#process and #enqueue_pending_output.
- attr_reader :output #:nodoc:
+ attr_reader :output # :nodoc:
# The list of pending requests. Each time a request is sent which requires
# a reply, the corresponding callback is pushed onto this queue. As responses
# arrive, they are shifted off the front and handled.
- attr_reader :pending_requests #:nodoc:
+ attr_reader :pending_requests # :nodoc:
# Instantiates a new channel on the given connection, of the given type,
# and with the given id. If a block is given, it will be remembered until
@@ -217,7 +217,7 @@ module Net
# puts "could not obtain pty"
# end
# end
- def request_pty(opts={}, &block)
+ def request_pty(opts = {}, &block)
extra = opts.keys - VALID_PTY_OPTIONS.keys
raise ArgumentError, "invalid option(s) to request_pty: #{extra.inspect}" if extra.any?
@@ -230,9 +230,9 @@ module Net
modes.write_byte(0)
send_channel_request("pty-req", :string, opts[:term],
- :long, opts[:chars_wide], :long, opts[:chars_high],
- :long, opts[:pixels_wide], :long, opts[:pixels_high],
- :string, modes.to_s, &block)
+ :long, opts[:chars_wide], :long, opts[:chars_high],
+ :long, opts[:pixels_wide], :long, opts[:pixels_high],
+ :string, modes.to_s, &block)
end
# Sends data to the channel's remote endpoint. This usually has the
@@ -490,8 +490,8 @@ module Net
fail "Channel open not yet confirmed, please call send_channel_request(or exec) from block of open_channel" unless remote_id
msg = Buffer.from(:byte, CHANNEL_REQUEST,
- :long, remote_id, :string, request_name,
- :bool, !callback.nil?, *data)
+ :long, remote_id, :string, request_name,
+ :bool, !callback.nil?, *data)
connection.send_message(msg)
pending_requests << callback if callback
end
@@ -503,7 +503,7 @@ module Net
# #do_open_confirmation). This is called automatically by #process, which
# is called from the event loop (Connection::Session#process). You will
# generally not need to invoke it directly.
- def enqueue_pending_output #:nodoc:
+ def enqueue_pending_output # :nodoc:
return unless remote_id
while output.length > 0
@@ -527,7 +527,7 @@ module Net
# packet sizes, respectively. If an open-confirmation callback was
# given when the channel was created, it is invoked at this time with
# the channel itself as the sole argument.
- def do_open_confirmation(remote_id, max_window, max_packet) #:nodoc:
+ def do_open_confirmation(remote_id, max_window, max_packet) # :nodoc:
@remote_id = remote_id
@remote_window_size = @remote_maximum_window_size = max_window
@remote_maximum_packet_size = max_packet
@@ -553,7 +553,7 @@ module Net
# causes the remote window size to be adjusted upwards by the given
# number of bytes. This has the effect of allowing more data to be sent
# from the local end to the remote end of the channel.
- def do_window_adjust(bytes) #:nodoc:
+ def do_window_adjust(bytes) # :nodoc:
@remote_maximum_window_size += bytes
@remote_window_size += bytes
end
@@ -566,7 +566,7 @@ module Net
# CHANNEL_SUCCESS, unless the callback raised ChannelRequestFailed. The
# callback should accept the channel as the first argument, and the
# request-specific data as the second.
- def do_request(request, want_reply, data) #:nodoc:
+ def do_request(request, want_reply, data) # :nodoc:
result = true
begin
@@ -587,7 +587,7 @@ module Net
# but does not actually throttle requests that come in illegally when
# the window size is too small. The callback is invoked with the channel
# as the first argument, and the data as the second.
- def do_data(data) #:nodoc:
+ def do_data(data) # :nodoc:
update_local_window_size(data.length)
@on_data.call(self, data) if @on_data
end
diff --git a/lib/net/ssh/connection/event_loop.rb b/lib/net/ssh/connection/event_loop.rb
index 869e38f..5aac78c 100644
--- a/lib/net/ssh/connection/event_loop.rb
+++ b/lib/net/ssh/connection/event_loop.rb
@@ -12,7 +12,7 @@ module Net
class EventLoop
include Loggable
- def initialize(logger=nil)
+ def initialize(logger = nil)
self.logger = logger
@sessions = []
end
@@ -60,7 +60,7 @@ module Net
w = []
minwait = nil
@sessions.each do |session|
- sr,sw,actwait = session.ev_do_calculate_rw_wait(wait)
+ sr, sw, actwait = session.ev_do_calculate_rw_wait(wait)
minwait = actwait if actwait && (minwait.nil? || actwait < minwait)
r.push(*sr)
w.push(*sw)
@@ -75,18 +75,18 @@ module Net
if readers
readers.each do |reader|
session = owners[reader]
- (fired_sessions[session] ||= { r: [],w: [] })[:r] << reader
+ (fired_sessions[session] ||= { r: [], w: [] })[:r] << reader
end
end
if writers
writers.each do |writer|
session = owners[writer]
- (fired_sessions[session] ||= { r: [],w: [] })[:w] << writer
+ (fired_sessions[session] ||= { r: [], w: [] })[:w] << writer
end
end
- fired_sessions.each do |s,rw|
- s.ev_do_handle_events(rw[:r],rw[:w])
+ fired_sessions.each do |s, rw|
+ s.ev_do_handle_events(rw[:r], rw[:w])
end
@sessions.each { |s| s.ev_do_postprocess(fired_sessions.key?(s)) }
@@ -111,10 +111,10 @@ module Net
raise "Only one session expected" unless @sessions.count == 1
session = @sessions.first
- sr,sw,actwait = session.ev_do_calculate_rw_wait(wait)
+ sr, sw, actwait = session.ev_do_calculate_rw_wait(wait)
readers, writers, = IO.select(sr, sw, nil, actwait)
- session.ev_do_handle_events(readers,writers)
+ session.ev_do_handle_events(readers, writers)
session.ev_do_postprocess(!((readers.nil? || readers.empty?) && (writers.nil? || writers.empty?)))
end
end
diff --git a/lib/net/ssh/connection/session.rb b/lib/net/ssh/connection/session.rb
index 4f09fc8..fbfc017 100644
--- a/lib/net/ssh/connection/session.rb
+++ b/lib/net/ssh/connection/session.rb
@@ -41,17 +41,17 @@ module Net
attr_reader :properties
# The map of channels, each key being the local-id for the channel.
- attr_reader :channels #:nodoc:
+ attr_reader :channels # :nodoc:
# The map of listeners that the event loop knows about. See #listen_to.
- attr_reader :listeners #:nodoc:
+ attr_reader :listeners # :nodoc:
# The map of specialized handlers for opening specific channel types. See
# #on_open_channel.
- attr_reader :channel_open_handlers #:nodoc:
+ attr_reader :channel_open_handlers # :nodoc:
# The list of callbacks for pending requests. See #send_global_request.
- attr_reader :pending_requests #:nodoc:
+ attr_reader :pending_requests # :nodoc:
class NilChannel
def initialize(session)
@@ -65,7 +65,7 @@ module Net
# Create a new connection service instance atop the given transport
# layer. Initializes the listeners to be only the underlying socket object.
- def initialize(transport, options={})
+ def initialize(transport, options = {})
self.logger = transport.logger
@transport = transport
@@ -149,7 +149,7 @@ module Net
# to be run.
#
# ssh.loop { ssh.busy? }
- def busy?(include_invisible=false)
+ def busy?(include_invisible = false)
if include_invisible
channels.any?
else
@@ -174,7 +174,7 @@ module Net
# int_pressed = false
# trap("INT") { int_pressed = true }
# ssh.loop(0.1) { not int_pressed }
- def loop(wait=nil, &block)
+ def loop(wait = nil, &block)
running = block || Proc.new { busy? }
loop_forever { break unless process(wait, &running) }
begin
@@ -222,7 +222,7 @@ module Net
# connections.delete_if { |ssh| !ssh.process(0.1, &condition) }
# break if connections.empty?
# end
- def process(wait=nil, &block)
+ def process(wait = nil, &block)
@event_loop.process(wait, &block)
rescue StandardError
force_channel_cleanup_on_close if closed?
@@ -255,7 +255,7 @@ module Net
def ev_do_calculate_rw_wait(wait)
r = listeners.keys
w = r.select { |w2| w2.respond_to?(:pending_write?) && w2.pending_write? }
- [r,w,io_select_wait(wait)]
+ [r, w, io_select_wait(wait)]
end
# This is called internally as part of #process.
@@ -335,13 +335,13 @@ module Net
# end
#
# channel.wait
- def open_channel(type="session", *extra, &on_confirm)
+ def open_channel(type = "session", *extra, &on_confirm)
local_id = get_next_channel_id
channel = Channel.new(self, type, local_id, @max_pkt_size, @max_win_size, &on_confirm)
msg = Buffer.from(:byte, CHANNEL_OPEN, :string, type, :long, local_id,
- :long, channel.local_maximum_window_size,
- :long, channel.local_maximum_packet_size, *extra)
+ :long, channel.local_maximum_window_size,
+ :long, channel.local_maximum_packet_size, *extra)
send_message(msg)
channels[local_id] = channel
@@ -382,7 +382,7 @@ module Net
raise "could not execute command: #{command.inspect}" unless success
if status
- channel.on_request("exit-status") do |ch2,data|
+ channel.on_request("exit-status") do |ch2, data|
status[:exit_code] = data.read_long
end
diff --git a/lib/net/ssh/errors.rb b/lib/net/ssh/errors.rb
index c445459..7455fed 100644
--- a/lib/net/ssh/errors.rb
+++ b/lib/net/ssh/errors.rb
@@ -45,10 +45,10 @@ module Net
# the remember_host! method on the exception, and then retry.
class HostKeyError < Net::SSH::Exception
# the callback to use when #remember_host! is called
- attr_writer :callback #:nodoc:
+ attr_writer :callback # :nodoc:
# situation-specific data describing the host (see #host, #port, etc.)
- attr_writer :data #:nodoc:
+ attr_writer :data # :nodoc:
# An accessor for getting at the data that was used to look up the host
# (see also #fingerprint, #host, #port, #ip, and #key).
diff --git a/lib/net/ssh/key_factory.rb b/lib/net/ssh/key_factory.rb
index c8df306..5d5cfbf 100644
--- a/lib/net/ssh/key_factory.rb
+++ b/lib/net/ssh/key_factory.rb
@@ -17,14 +17,14 @@ module Net
class KeyFactory
# Specifies the mapping of SSH names to OpenSSL key classes.
MAP = {
- 'dh' => OpenSSL::PKey::DH,
- 'rsa' => OpenSSL::PKey::RSA,
- 'dsa' => OpenSSL::PKey::DSA,
+ 'dh' => OpenSSL::PKey::DH,
+ 'rsa' => OpenSSL::PKey::RSA,
+ 'dsa' => OpenSSL::PKey::DSA,
'ecdsa' => OpenSSL::PKey::EC
}
MAP["ed25519"] = Net::SSH::Authentication::ED25519::PrivKey if defined? Net::SSH::Authentication::ED25519
- class <<self
+ class << self
# Fetch an OpenSSL key instance by its SSH name. It will be a new,
# empty key of the given type.
def get(name)
@@ -36,7 +36,7 @@ module Net
# appropriately. The new key is returned. If the key itself is
# encrypted (requiring a passphrase to use), the user will be
# prompted to enter their password unless passphrase works.
- def load_private_key(filename, passphrase=nil, ask_passphrase=true, prompt=Prompt.default)
+ def load_private_key(filename, passphrase = nil, ask_passphrase = true, prompt = Prompt.default)
data = File.read(File.expand_path(filename))
load_data_private_key(data, passphrase, ask_passphrase, filename, prompt)
end
@@ -46,7 +46,7 @@ module Net
# appropriately. The new key is returned. If the key itself is
# encrypted (requiring a passphrase to use), the user will be
# prompted to enter their password unless passphrase works.
- def load_data_private_key(data, passphrase=nil, ask_passphrase=true, filename="", prompt=Prompt.default)
+ def load_data_private_key(data, passphrase = nil, ask_passphrase = true, filename = "", prompt = Prompt.default)
key_type = classify_key(data, filename)
encrypted_key = nil
@@ -86,7 +86,7 @@ module Net
# Loads a public key. It will correctly determine whether
# the file describes an RSA or DSA key, and will load it
# appropriately. The new public key is returned.
- def load_data_public_key(data, filename="")
+ def load_data_public_key(data, filename = "")
fields = data.split(/ /)
blob = nil
diff --git a/lib/net/ssh/known_hosts.rb b/lib/net/ssh/known_hosts.rb
index eb7d7a7..eeb8635 100644
--- a/lib/net/ssh/known_hosts.rb
+++ b/lib/net/ssh/known_hosts.rb
@@ -105,10 +105,10 @@ module Net
SUPPORTED_TYPE.push('ssh-ed25519') if Net::SSH::Authentication::ED25519Loader::LOADED
- class <<self
+ class << self
# Searches all known host files (see KnownHosts.hostfiles) for all keys
# of the given host. Returns an enumerable of keys found.
- def search_for(host, options={})
+ def search_for(host, options = {})
HostKeys.new(search_in(hostfiles(options), host, options), host, self, options)
end
@@ -127,7 +127,7 @@ module Net
#
# If you only want the user known host files, you can pass :user as
# the second option.
- def hostfiles(options, which=:all)
+ def hostfiles(options, which = :all)
files = []
files += Array(options[:user_known_hosts_file] || %w[~/.ssh/known_hosts ~/.ssh/known_hosts2]) if which == :all || which == :user
@@ -142,7 +142,7 @@ module Net
# Looks in all user known host files (see KnownHosts.hostfiles) and tries to
# add an entry for the given host and key to the first file it is able
# to.
- def add(host, key, options={})
+ def add(host, key, options = {})
hostfiles(options, :user).each do |file|
KnownHosts.new(file).add(host, key)
return
diff --git a/lib/net/ssh/prompt.rb b/lib/net/ssh/prompt.rb
index e47d71e..a52463f 100644
--- a/lib/net/ssh/prompt.rb
+++ b/lib/net/ssh/prompt.rb
@@ -38,7 +38,7 @@ module Net
# ask input from user, a prompter might ask for multiple inputs
# (like user and password) in a single session.
- def ask(prompt, echo=true)
+ def ask(prompt, echo = true)
$stdout.print(prompt)
$stdout.flush
ret = $stdin.noecho(&:gets).chomp
diff --git a/lib/net/ssh/proxy/http.rb b/lib/net/ssh/proxy/http.rb
index e7dc3d0..fd9958e 100644
--- a/lib/net/ssh/proxy/http.rb
+++ b/lib/net/ssh/proxy/http.rb
@@ -40,7 +40,7 @@ module Net
#
# * :user => the user name to use when authenticating to the proxy
# * :password => the password to use when authenticating
- def initialize(proxy_host, proxy_port=80, options={})
+ def initialize(proxy_host, proxy_port = 80, options = {})
@proxy_host = proxy_host
@proxy_port = proxy_port
@options = options
diff --git a/lib/net/ssh/proxy/https.rb b/lib/net/ssh/proxy/https.rb
index 4f4fdb2..2e12017 100644
--- a/lib/net/ssh/proxy/https.rb
+++ b/lib/net/ssh/proxy/https.rb
@@ -16,7 +16,7 @@ module Net
# taken by Net::SSH::Proxy::HTTP it supports:
#
# * :ssl_context => the SSL configuration to use for the connection
- def initialize(proxy_host, proxy_port=80, options={})
+ def initialize(proxy_host, proxy_port = 80, options = {})
@ssl_context = options.delete(:ssl_context) ||
OpenSSL::SSL::SSLContext.new
super(proxy_host, proxy_port, options)
@@ -27,7 +27,7 @@ module Net
# Shim to make OpenSSL::SSL::SSLSocket behave like a regular TCPSocket
# for all intents and purposes of Net::SSH::BufferedIo
module SSLSocketCompatibility
- def self.extended(object) #:nodoc:
+ def self.extended(object) # :nodoc:
object.define_singleton_method(:recv, object.method(:sysread))
object.sync_close = true
end
diff --git a/lib/net/ssh/proxy/socks4.rb b/lib/net/ssh/proxy/socks4.rb
index a964d1e..9f4476a 100644
--- a/lib/net/ssh/proxy/socks4.rb
+++ b/lib/net/ssh/proxy/socks4.rb
@@ -37,7 +37,7 @@ module Net
# Create a new proxy connection to the given proxy host and port.
# Optionally, a :user key may be given to identify the username
# with which to authenticate.
- def initialize(proxy_host, proxy_port=1080, options={})
+ def initialize(proxy_host, proxy_port = 1080, options = {})
@proxy_host = proxy_host
@proxy_port = proxy_port
@options = options
diff --git a/lib/net/ssh/proxy/socks5.rb b/lib/net/ssh/proxy/socks5.rb
index 8a0ae91..1e66318 100644
--- a/lib/net/ssh/proxy/socks5.rb
+++ b/lib/net/ssh/proxy/socks5.rb
@@ -52,7 +52,7 @@ module Net
# Create a new proxy connection to the given proxy host and port.
# Optionally, :user and :password options may be given to
# identify the username and password with which to authenticate.
- def initialize(proxy_host, proxy_port=1080, options={})
+ def initialize(proxy_host, proxy_port = 1080, options = {})
@proxy_host = proxy_host
@proxy_port = proxy_port
@options = options
diff --git a/lib/net/ssh/service/forward.rb b/lib/net/ssh/service/forward.rb
index 0edfaa7..8b2f0f9 100644
--- a/lib/net/ssh/service/forward.rb
+++ b/lib/net/ssh/service/forward.rb
@@ -17,7 +17,7 @@ module Net
attr_reader :session
# A simple class for representing a requested remote forwarded port.
- Remote = Struct.new(:host, :port) #:nodoc:
+ Remote = Struct.new(:host, :port) # :nodoc:
# Instantiates a new Forward service instance atop the given connection
# service session. This will register new channel open handlers to handle
@@ -105,7 +105,7 @@ module Net
#
# ssh.forward.cancel_local(1234)
# ssh.forward.cancel_local(1234, "0.0.0.0")
- def cancel_local(port, bind_address="127.0.0.1")
+ def cancel_local(port, bind_address = "127.0.0.1")
socket = @local_forwarded_ports.delete([port, bind_address])
socket.shutdown rescue nil
socket.close rescue nil
@@ -214,7 +214,7 @@ module Net
# raise Net::SSH::Exception, "remote forwarding request failed"
# end
#
- def remote(port, host, remote_port, remote_host="127.0.0.1")
+ def remote(port, host, remote_port, remote_host = "127.0.0.1")
session.send_global_request("tcpip-forward", :string, remote_host, :long, remote_port) do |success, response|
if success
remote_port = response.read_long if remote_port == 0
@@ -248,7 +248,7 @@ module Net
#
# ssh.forward.cancel_remote(1234, "0.0.0.0")
# ssh.loop { ssh.forward.active_remotes.include?([1234, "0.0.0.0"]) }
- def cancel_remote(port, host="127.0.0.1")
+ def cancel_remote(port, host = "127.0.0.1")
session.send_global_request("cancel-tcpip-forward", :string, host, :long, port) do |success, response|
if success
@remote_forwarded_ports.delete([port, host])
diff --git a/lib/net/ssh/test.rb b/lib/net/ssh/test.rb
index d97eebf..cb727ba 100644
--- a/lib/net/ssh/test.rb
+++ b/lib/net/ssh/test.rb
@@ -56,21 +56,21 @@ module Net
# Returns the test socket instance to use for these tests (see
# Net::SSH::Test::Socket).
- def socket(options={})
+ def socket(options = {})
@socket ||= Net::SSH::Test::Socket.new
end
# Returns the connection session (Net::SSH::Connection::Session) for use
# in these tests. It is a fully functional SSH session, operating over
# a mock socket (#socket).
- def connection(options={})
+ def connection(options = {})
@connection ||= Net::SSH::Connection::Session.new(transport(options), options)
end
# Returns the transport session (Net::SSH::Transport::Session) for use
# in these tests. It is a fully functional SSH transport session, operating
# over a mock socket (#socket).
- def transport(options={})
+ def transport(options = {})
@transport ||= Net::SSH::Transport::Session.new(
options[:host] || "localhost",
options.merge(kex: "test", host_key: "ssh-rsa", append_all_supported_algorithms: true, verify_host_key: :never, proxy: socket(options))
diff --git a/lib/net/ssh/test/channel.rb b/lib/net/ssh/test/channel.rb
index 3ee56e2..c3baa90 100644
--- a/lib/net/ssh/test/channel.rb
+++ b/lib/net/ssh/test/channel.rb
@@ -65,7 +65,7 @@ module Net
# be scripted.
#
# channel.sends_exec "ls -l"
- def sends_exec(command, reply=true, success=true)
+ def sends_exec(command, reply = true, success = true)
script.sends_channel_request(self, "exec", reply, command, success)
end
@@ -74,7 +74,7 @@ module Net
# and +success+ arguments.
#
# channel.sends_subsystem "sftp"
- def sends_subsystem(subsystem, reply=true, success=true)
+ def sends_subsystem(subsystem, reply = true, success = true)
script.sends_channel_request(self, "subsystem", reply, subsystem, success)
end
@@ -124,7 +124,7 @@ module Net
# Scripts the reception of an "exit-status" channel request packet.
#
# channel.gets_exit_status(127)
- def gets_exit_status(status=0)
+ def gets_exit_status(status = 0)
script.gets_channel_request(self, "exit-status", false, status)
end
diff --git a/lib/net/ssh/test/extensions.rb b/lib/net/ssh/test/extensions.rb
index 527c88b..733a531 100644
--- a/lib/net/ssh/test/extensions.rb
+++ b/lib/net/ssh/test/extensions.rb
@@ -38,7 +38,7 @@ module Net
module PacketStream
include BufferedIo # make sure we get the extensions here, too
- def self.included(base) #:nodoc:
+ def self.included(base) # :nodoc:
base.send :alias_method, :real_available_for_read?, :available_for_read?
base.send :alias_method, :available_for_read?, :test_available_for_read?
@@ -93,7 +93,7 @@ module Net
# An extension to Net::SSH::Connection::Channel. Facilitates unit testing.
module Channel
- def self.included(base) #:nodoc:
+ def self.included(base) # :nodoc:
base.send :alias_method, :send_data_for_real, :send_data
base.send :alias_method, :send_data, :send_data_for_test
end
@@ -111,7 +111,7 @@ module Net
# An extension to the built-in ::IO class. Simply redefines IO.select
# so that it can be scripted in Net::SSH unit tests.
module IO
- def self.included(base) #:nodoc:
+ def self.included(base) # :nodoc:
base.extend(ClassMethods)
end
@@ -132,8 +132,8 @@ module Net
end
module ClassMethods
- def self.extended(obj) #:nodoc:
- class <<obj
+ def self.extended(obj) # :nodoc:
+ class << obj
alias_method :select_for_real, :select
alias_method :select, :select_for_test
end
@@ -142,7 +142,7 @@ module Net
# The testing version of ::IO.select. Assumes that all readers,
# writers, and errors arrays are either nil, or contain only objects
# that mix in Net::SSH::Test::Extensions::BufferedIo.
- def select_for_test(readers=nil, writers=nil, errors=nil, wait=nil)
+ def select_for_test(readers = nil, writers = nil, errors = nil, wait = nil)
return select_for_real(readers, writers, errors, wait) unless Net::SSH::Test::Extensions::IO.extension_enabled?
ready_readers = Array(readers).select { |r| r.select_for_read? }
diff --git a/lib/net/ssh/test/packet.rb b/lib/net/ssh/test/packet.rb
index e604b98..da5a986 100644
--- a/lib/net/ssh/test/packet.rb
+++ b/lib/net/ssh/test/packet.rb
@@ -82,7 +82,7 @@ module Net
when CHANNEL_REQUEST
parts = %i[long string bool]
case @data[1]
- when "exec", "subsystem","shell" then parts << :string
+ when "exec", "subsystem", "shell" then parts << :string
when "exit-status" then parts << :long
when "pty-req" then parts.concat(%i[string long long long long string])
when "env" then parts.contact(%i[string string])
diff --git a/lib/net/ssh/test/script.rb b/lib/net/ssh/test/script.rb
index 7879ad7..7eee90a 100644
--- a/lib/net/ssh/test/script.rb
+++ b/lib/net/ssh/test/script.rb
@@ -33,7 +33,7 @@ module Net
#
# A new Net::SSH::Test::Channel instance is returned, which can be used
# to script additional channel operations.
- def opens_channel(confirm=true)
+ def opens_channel(confirm = true)
channel = Channel.new(self)
channel.remote_id = 5555
@@ -70,7 +70,7 @@ module Net
#
# This will typically be called via Net::SSH::Test::Channel#sends_exec or
# Net::SSH::Test::Channel#sends_subsystem.
- def sends_channel_request(channel, request, reply, data, success=true)
+ def sends_channel_request(channel, request, reply, data, success = true)
if data.is_a? Array
events << LocalPacket.new(:channel_request, channel.remote_id, request, reply, *data)
else
@@ -163,7 +163,7 @@ module Net
#
# # peek at the next event
# event = script.next(:first)
- def next(mode=:shift)
+ def next(mode = :shift)
events.send(mode)
end
diff --git a/lib/net/ssh/test/socket.rb b/lib/net/ssh/test/socket.rb
index 42ece27..543a536 100644
--- a/lib/net/ssh/test/socket.rb
+++ b/lib/net/ssh/test/socket.rb
@@ -40,7 +40,7 @@ module Net
# Allows the socket to also mimic a socket factory, simply returning
# +self+.
- def open(host, port, options={})
+ def open(host, port, options = {})
@host, @port = host, port
self
end
diff --git a/lib/net/ssh/transport/algorithms.rb b/lib/net/ssh/transport/algorithms.rb
index f0d8d15..cc12d95 100644
--- a/lib/net/ssh/transport/algorithms.rb
+++ b/lib/net/ssh/transport/algorithms.rb
@@ -146,7 +146,7 @@ module Net
# Instantiates a new Algorithms object, and prepares the hash of preferred
# algorithms based on the options parameter and the ALGORITHMS constant.
- def initialize(session, options={})
+ def initialize(session, options = {})
@session = session
@logger = session.logger
@options = options
@@ -369,10 +369,10 @@ module Net
language = algorithms[:language].join(",")
Net::SSH::Buffer.from(:byte, KEXINIT,
- :long, [rand(0xFFFFFFFF), rand(0xFFFFFFFF), rand(0xFFFFFFFF), rand(0xFFFFFFFF)],
- :mstring, [kex, host_key, encryption, encryption, hmac, hmac],
- :mstring, [compression, compression, language, language],
- :bool, false, :long, 0)
+ :long, [rand(0xFFFFFFFF), rand(0xFFFFFFFF), rand(0xFFFFFFFF), rand(0xFFFFFFFF)],
+ :mstring, [kex, host_key, encryption, encryption, hmac, hmac],
+ :mstring, [compression, compression, language, language],
+ :bool, false, :long, 0)
end
# Given the parsed server KEX packet, and the client's preferred algorithm
@@ -438,13 +438,13 @@ module Net
debug { "exchanging keys" }
algorithm = Kex::MAP[kex].new(self, session,
- client_version_string: Net::SSH::Transport::ServerVersion::PROTO_VERSION,
- server_version_string: session.server_version.version,
- server_algorithm_packet: @server_packet,
- client_algorithm_packet: @client_packet,
- need_bytes: kex_byte_requirement,
- minimum_dh_bits: options[:minimum_dh_bits],
- logger: logger)
+ client_version_string: Net::SSH::Transport::ServerVersion::PROTO_VERSION,
+ server_version_string: session.server_version.version,
+ server_algorithm_packet: @server_packet,
+ client_algorithm_packet: @client_packet,
+ need_bytes: kex_byte_requirement,
+ minimum_dh_bits: options[:minimum_dh_bits],
+ logger: logger)
result = algorithm.exchange_keys
secret = result[:shared_secret].to_ssh
diff --git a/lib/net/ssh/transport/cipher_factory.rb b/lib/net/ssh/transport/cipher_factory.rb
index bedf1ea..4dde239 100644
--- a/lib/net/ssh/transport/cipher_factory.rb
+++ b/lib/net/ssh/transport/cipher_factory.rb
@@ -10,23 +10,23 @@ module Net
class CipherFactory
# Maps the SSH name of a cipher to it's corresponding OpenSSL name
SSH_TO_OSSL = {
- "3des-cbc" => "des-ede3-cbc",
- "blowfish-cbc" => "bf-cbc",
- "aes256-cbc" => "aes-256-cbc",
- "aes192-cbc" => "aes-192-cbc",
- "aes128-cbc" => "aes-128-cbc",
- "idea-cbc" => "idea-cbc",
- "cast128-cbc" => "cast-cbc",
+ "3des-cbc" => "des-ede3-cbc",
+ "blowfish-cbc" => "bf-cbc",
+ "aes256-cbc" => "aes-256-cbc",
+ "aes192-cbc" => "aes-192-cbc",
+ "aes128-cbc" => "aes-128-cbc",
+ "idea-cbc" => "idea-cbc",
+ "cast128-cbc" => "cast-cbc",
"rijndael-cbc@lysator.liu.se" => "aes-256-cbc",
- "3des-ctr" => "des-ede3",
- "blowfish-ctr" => "bf-ecb",
+ "3des-ctr" => "des-ede3",
+ "blowfish-ctr" => "bf-ecb",
- "aes256-ctr" => ::OpenSSL::Cipher.ciphers.include?("aes-256-ctr") ? "aes-256-ctr" : "aes-256-ecb",
- "aes192-ctr" => ::OpenSSL::Cipher.ciphers.include?("aes-192-ctr") ? "aes-192-ctr" : "aes-192-ecb",
- "aes128-ctr" => ::OpenSSL::Cipher.ciphers.include?("aes-128-ctr") ? "aes-128-ctr" : "aes-128-ecb",
- 'cast128-ctr' => 'cast5-ecb',
+ "aes256-ctr" => ::OpenSSL::Cipher.ciphers.include?("aes-256-ctr") ? "aes-256-ctr" : "aes-256-ecb",
+ "aes192-ctr" => ::OpenSSL::Cipher.ciphers.include?("aes-192-ctr") ? "aes-192-ctr" : "aes-192-ecb",
+ "aes128-ctr" => ::OpenSSL::Cipher.ciphers.include?("aes-128-ctr") ? "aes-128-ctr" : "aes-128-ecb",
+ 'cast128-ctr' => 'cast5-ecb',
- 'none' => 'none'
+ 'none' => 'none'
}
# Returns true if the underlying OpenSSL library supports the given cipher,
@@ -43,7 +43,7 @@ module Net
# iv, key, shared, hash and digester values. Additionally, the
# cipher will be put into encryption or decryption mode, based on the
# value of the +encrypt+ parameter.
- def self.get(name, options={})
+ def self.get(name, options = {})
ossl_name = SSH_TO_OSSL[name] or raise NotImplementedError, "unimplemented cipher `#{name}'"
return IdentityCipher if ossl_name == "none"
diff --git a/lib/net/ssh/transport/ctr.rb b/lib/net/ssh/transport/ctr.rb
index 9c67aff..a1397f4 100644
--- a/lib/net/ssh/transport/ctr.rb
+++ b/lib/net/ssh/transport/ctr.rb
@@ -2,7 +2,7 @@ require 'openssl'
require 'delegate'
module Net::SSH::Transport
- #:nodoc:
+ # :nodoc:
class OpenSSLAESCTR < SimpleDelegator
def initialize(original)
super
@@ -26,7 +26,7 @@ module Net::SSH::Transport
end
end
- #:nodoc:
+ # :nodoc:
# Pure-Ruby implementation of Stateful Decryption Counter(SDCTR) Mode
# for Block Ciphers. See RFC4344 for detail.
module CTR
@@ -95,7 +95,7 @@ module Net::SSH::Transport
def xor!(s1, s2)
s = []
- s1.unpack('Q*').zip(s2.unpack('Q*')) {|a,b| s.push(a ^ b) }
+ s1.unpack('Q*').zip(s2.unpack('Q*')) {|a, b| s.push(a ^ b) }
s.pack('Q*')
end
singleton_class.send(:private, :xor!)
diff --git a/lib/net/ssh/transport/hmac.rb b/lib/net/ssh/transport/hmac.rb
index 0905050..0742236 100644
--- a/lib/net/ssh/transport/hmac.rb
+++ b/lib/net/ssh/transport/hmac.rb
@@ -17,24 +17,24 @@ require 'net/ssh/transport/hmac/none'
module Net::SSH::Transport::HMAC
# The mapping of SSH hmac algorithms to their implementations
MAP = {
- 'hmac-md5' => MD5,
- 'hmac-md5-96' => MD5_96,
- 'hmac-sha1' => SHA1,
- 'hmac-sha1-96' => SHA1_96,
- 'hmac-sha2-256' => SHA2_256,
- 'hmac-sha2-256-96' => SHA2_256_96,
- 'hmac-sha2-512' => SHA2_512,
- 'hmac-sha2-512-96' => SHA2_512_96,
+ 'hmac-md5' => MD5,
+ 'hmac-md5-96' => MD5_96,
+ 'hmac-sha1' => SHA1,
+ 'hmac-sha1-96' => SHA1_96,
+ 'hmac-sha2-256' => SHA2_256,
+ 'hmac-sha2-256-96' => SHA2_256_96,
+ 'hmac-sha2-512' => SHA2_512,
+ 'hmac-sha2-512-96' => SHA2_512_96,
'hmac-sha2-256-etm@openssh.com' => SHA2_256_Etm,
'hmac-sha2-512-etm@openssh.com' => SHA2_512_Etm,
- 'hmac-ripemd160' => RIPEMD160,
- 'hmac-ripemd160@openssh.com' => RIPEMD160,
- 'none' => None
+ 'hmac-ripemd160' => RIPEMD160,
+ 'hmac-ripemd160@openssh.com' => RIPEMD160,
+ 'none' => None
}
# Retrieves a new hmac instance of the given SSH type (+name+). If +key+ is
# given, the new instance will be initialized with that key.
- def self.get(name, key="", parameters = {})
+ def self.get(name, key = "", parameters = {})
impl = MAP[name] or raise ArgumentError, "hmac not found: #{name.inspect}"
impl.new(Net::SSH::Transport::KeyExpander.expand_key(impl.key_length, key, parameters))
end
diff --git a/lib/net/ssh/transport/hmac/abstract.rb b/lib/net/ssh/transport/hmac/abstract.rb
index 575b03b..8bc2a56 100644
--- a/lib/net/ssh/transport/hmac/abstract.rb
+++ b/lib/net/ssh/transport/hmac/abstract.rb
@@ -7,7 +7,7 @@ module Net
module HMAC
# The base class of all OpenSSL-based HMAC algorithm wrappers.
class Abstract
- class <<self
+ class << self
def etm(*v)
@etm = false if !defined?(@etm)
if v.empty?
@@ -76,19 +76,19 @@ module Net
# The key in use for this instance.
attr_reader :key
- def initialize(key=nil)
+ def initialize(key = nil)
self.key = key
end
# Sets the key to the given value, truncating it so that it is the correct
# length.
def key=(value)
- @key = value ? value.to_s[0,key_length] : nil
+ @key = value ? value.to_s[0, key_length] : nil
end
# Compute the HMAC digest for the given data string.
def digest(data)
- OpenSSL::HMAC.digest(digest_class.new, key, data)[0,mac_length]
+ OpenSSL::HMAC.digest(digest_class.new, key, data)[0, mac_length]
end
end
end
diff --git a/lib/net/ssh/transport/identity_cipher.rb b/lib/net/ssh/transport/identity_cipher.rb
index b8a90bc..ad1a764 100644
--- a/lib/net/ssh/transport/identity_cipher.rb
+++ b/lib/net/ssh/transport/identity_cipher.rb
@@ -5,7 +5,7 @@ module Net
# keeps things in the code nice and clean when a cipher has not yet been
# determined (i.e., during key exchange).
class IdentityCipher
- class <<self
+ class << self
# A default block size of 8 is required by the SSH2 protocol.
def block_size
8
diff --git a/lib/net/ssh/transport/kex.rb b/lib/net/ssh/transport/kex.rb
index a43d713..cf21107 100644
--- a/lib/net/ssh/transport/kex.rb
+++ b/lib/net/ssh/transport/kex.rb
@@ -13,14 +13,14 @@ module Net::SSH::Transport
# Maps the supported key-exchange algorithms as named by the SSH protocol
# to their corresponding implementors.
MAP = {
- 'diffie-hellman-group1-sha1' => DiffieHellmanGroup1SHA1,
- 'diffie-hellman-group14-sha1' => DiffieHellmanGroup14SHA1,
- 'diffie-hellman-group14-sha256' => DiffieHellmanGroup14SHA256,
- 'diffie-hellman-group-exchange-sha1' => DiffieHellmanGroupExchangeSHA1,
+ 'diffie-hellman-group1-sha1' => DiffieHellmanGroup1SHA1,
+ 'diffie-hellman-group14-sha1' => DiffieHellmanGroup14SHA1,
+ 'diffie-hellman-group14-sha256' => DiffieHellmanGroup14SHA256,
+ 'diffie-hellman-group-exchange-sha1' => DiffieHellmanGroupExchangeSHA1,
'diffie-hellman-group-exchange-sha256' => DiffieHellmanGroupExchangeSHA256,
- 'ecdh-sha2-nistp256' => EcdhSHA2NistP256,
- 'ecdh-sha2-nistp384' => EcdhSHA2NistP384,
- 'ecdh-sha2-nistp521' => EcdhSHA2NistP521
+ 'ecdh-sha2-nistp256' => EcdhSHA2NistP256,
+ 'ecdh-sha2-nistp384' => EcdhSHA2NistP384,
+ 'ecdh-sha2-nistp521' => EcdhSHA2NistP521
}
if Net::SSH::Transport::Kex::Curve25519Sha256Loader::LOADED
diff --git a/lib/net/ssh/transport/kex/abstract.rb b/lib/net/ssh/transport/kex/abstract.rb
index 3fd8c3c..27d2613 100644
--- a/lib/net/ssh/transport/kex/abstract.rb
+++ b/lib/net/ssh/transport/kex/abstract.rb
@@ -72,7 +72,7 @@ module Net
# Verify that the given key is of the expected type, and that it
# really is the key for the session's host. Raise Net::SSH::Exception
# if it is not.
- def verify_server_key(key) #:nodoc:
+ def verify_server_key(key) # :nodoc:
unless matching?(key.ssh_type, algorithms.host_key)
raise Net::SSH::Exception, "host key algorithm mismatch '#{key.ssh_type}' != '#{algorithms.host_key}'"
end
@@ -97,7 +97,7 @@ module Net
# Verify the signature that was received. Raise Net::SSH::Exception
# if the signature could not be verified. Otherwise, return the new
# session-id.
- def verify_signature(result) #:nodoc:
+ def verify_signature(result) # :nodoc:
response = build_signature_buffer(result)
hash = digester.digest(response.to_s)
@@ -113,7 +113,7 @@ module Net
# Send the NEWKEYS message, and expect the NEWKEYS message in
# reply.
- def confirm_newkeys #:nodoc:
+ def confirm_newkeys # :nodoc:
# send own NEWKEYS message first (the wodSSHServer won't send first)
response = Net::SSH::Buffer.new
response.write_byte(NEWKEYS)
diff --git a/lib/net/ssh/transport/kex/abstract5656.rb b/lib/net/ssh/transport/kex/abstract5656.rb
index 06c874d..5f8d133 100644
--- a/lib/net/ssh/transport/kex/abstract5656.rb
+++ b/lib/net/ssh/transport/kex/abstract5656.rb
@@ -32,7 +32,7 @@ module Net
response
end
- def send_kexinit #:nodoc:
+ def send_kexinit # :nodoc:
init, reply = get_message_types
# send the KEXECDH_INIT message
diff --git a/lib/net/ssh/transport/kex/curve25519_sha256.rb b/lib/net/ssh/transport/kex/curve25519_sha256.rb
index a9ce16c..e942846 100644
--- a/lib/net/ssh/transport/kex/curve25519_sha256.rb
+++ b/lib/net/ssh/transport/kex/curve25519_sha256.rb
@@ -18,7 +18,7 @@ module Net
private
- def generate_key #:nodoc:
+ def generate_key # :nodoc:
::X25519::Scalar.generate
end
diff --git a/lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb b/lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb
index 34af18b..9abab2c 100644
--- a/lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb
+++ b/lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb
@@ -59,7 +59,7 @@ module Net
# Generate a DH key with a private key consisting of the given
# number of bytes.
- def generate_key #:nodoc:
+ def generate_key # :nodoc:
dh = OpenSSL::PKey::DH.new
if dh.respond_to?(:set_pqg)
@@ -86,7 +86,7 @@ module Net
#
# Parse the buffer from a KEXDH_REPLY message, returning a hash of
# the extracted values.
- def send_kexinit #:nodoc:
+ def send_kexinit # :nodoc:
init, reply = get_message_types
# send the KEXDH_INIT message
@@ -108,8 +108,8 @@ module Net
sig_type = sig_buffer.read_string
if sig_type != algorithms.host_key_format
raise Net::SSH::Exception,
- "host key algorithm mismatch for signature " +
- "'#{sig_type}' != '#{algorithms.host_key_format}'"
+ "host key algorithm mismatch for signature " +
+ "'#{sig_type}' != '#{algorithms.host_key_format}'"
end
result[:server_sig] = sig_buffer.read_string
diff --git a/lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb b/lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb
index e081669..22178e2 100644
--- a/lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb
+++ b/lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb
@@ -34,7 +34,7 @@ module Net::SSH::Transport::Kex
# request the DH key parameters for the given number of bits.
buffer = Net::SSH::Buffer.from(:byte, KEXDH_GEX_REQUEST, :long, data[:minimum_dh_bits],
- :long, data[:need_bits], :long, MAXIMUM_BITS)
+ :long, data[:need_bits], :long, MAXIMUM_BITS)
connection.send_message(buffer)
buffer = connection.next_message
diff --git a/lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb b/lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb
index 84d0e4a..a0c911d 100644
--- a/lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb
+++ b/lib/net/ssh/transport/kex/ecdh_sha2_nistp256.rb
@@ -17,7 +17,7 @@ module Net
private
- def generate_key #:nodoc:
+ def generate_key # :nodoc:
OpenSSL::PKey::EC.new(curve_name).generate_key
end
diff --git a/lib/net/ssh/transport/key_expander.rb b/lib/net/ssh/transport/key_expander.rb
index 93fbaf1..8cff7e9 100644
--- a/lib/net/ssh/transport/key_expander.rb
+++ b/lib/net/ssh/transport/key_expander.rb
@@ -4,7 +4,7 @@ module Net
module KeyExpander
# Generate a key value in accordance with the SSH2 specification.
# (RFC4253 7.2. "Output from Key Exchange")
- def self.expand_key(bytes, start, options={})
+ def self.expand_key(bytes, start, options = {})
if bytes == 0
return ""
end
diff --git a/lib/net/ssh/transport/openssl.rb b/lib/net/ssh/transport/openssl.rb
index af0a0cc..4ff58cf 100644
--- a/lib/net/ssh/transport/openssl.rb
+++ b/lib/net/ssh/transport/openssl.rb
@@ -94,13 +94,13 @@ module OpenSSL
# Converts the key to a blob, according to the SSH2 protocol.
def to_blob
@blob ||= Net::SSH::Buffer.from(:string, ssh_type,
- :bignum, p, :bignum, q, :bignum, g, :bignum, pub_key).to_s
+ :bignum, p, :bignum, q, :bignum, g, :bignum, pub_key).to_s
end
# Verifies the given signature matches the given data.
def ssh_do_verify(sig, data, options = {})
- sig_r = sig[0,20].unpack("H*")[0].to_i(16)
- sig_s = sig[20,20].unpack("H*")[0].to_i(16)
+ sig_r = sig[0, 20].unpack("H*")[0].to_i(16)
+ sig_s = sig[20, 20].unpack("H*")[0].to_i(16)
a1sig = OpenSSL::ASN1::Sequence([
OpenSSL::ASN1::Integer(sig_r),
OpenSSL::ASN1::Integer(sig_s)
diff --git a/lib/net/ssh/transport/packet_stream.rb b/lib/net/ssh/transport/packet_stream.rb
index fc07ea1..a4120d4 100644
--- a/lib/net/ssh/transport/packet_stream.rb
+++ b/lib/net/ssh/transport/packet_stream.rb
@@ -80,7 +80,7 @@ module Net
# available or not, and will return nil if there is no packet ready to be
# returned. If the mode parameter is :block, then this method will block
# until a packet is available or timeout seconds have passed.
- def next_packet(mode=:nonblock, timeout=nil)
+ def next_packet(mode = :nonblock, timeout = nil)
case mode
when :nonblock then
packet = poll_next_packet
diff --git a/lib/net/ssh/transport/session.rb b/lib/net/ssh/transport/session.rb
index 261e5c2..fb41c16 100644
--- a/lib/net/ssh/transport/session.rb
+++ b/lib/net/ssh/transport/session.rb
@@ -55,7 +55,7 @@ module Net
# Instantiates a new transport layer abstraction. This will block until
# the initial key exchange completes, leaving you with a ready-to-use
# transport session.
- def initialize(host, options={})
+ def initialize(host, options = {})
self.logger = options[:logger]
@host = host
@@ -186,7 +186,7 @@ module Net
# received, it will be enqueued and otherwise ignored. When a key-exchange
# is not in process, and consume_queue is true, packets will be first
# read from the queue before the socket is queried.
- def poll_message(mode=:nonblock, consume_queue=true)
+ def poll_message(mode = :nonblock, consume_queue = true)
loop do
return @queue.shift if consume_queue && @queue.any? && algorithms.allow?(@queue.first)
@@ -252,27 +252,27 @@ module Net
# Configure's the packet stream's client state with the given set of
# options. This is typically used to define the cipher, compression, and
# hmac algorithms to use when sending packets to the server.
- def configure_client(options={})
+ def configure_client(options = {})
socket.client.set(options)
end
# Configure's the packet stream's server state with the given set of
# options. This is typically used to define the cipher, compression, and
# hmac algorithms to use when reading packets from the server.
- def configure_server(options={})
+ def configure_server(options = {})
socket.server.set(options)
end
# Sets a new hint for the packet stream, which the packet stream may use
# to change its behavior. (See PacketStream#hints).
- def hint(which, value=true)
+ def hint(which, value = true)
socket.hints[which] = value
end
public
# this method is primarily for use in tests
- attr_reader :queue #:nodoc:
+ attr_reader :queue # :nodoc:
private
diff --git a/lib/net/ssh/transport/state.rb b/lib/net/ssh/transport/state.rb
index b472191..1af6b86 100644
--- a/lib/net/ssh/transport/state.rb
+++ b/lib/net/ssh/transport/state.rb
@@ -191,7 +191,7 @@ module Net
private
- def update_next_iv(data, reset=false)
+ def update_next_iv(data, reset = false)
@next_iv << data
@next_iv = @next_iv[@next_iv.size - cipher.iv_len..-1]
diff --git a/test/authentication/methods/common.rb b/test/authentication/methods/common.rb
index be9c11a..1162e8e 100644
--- a/test/authentication/methods/common.rb
+++ b/test/authentication/methods/common.rb
@@ -5,15 +5,15 @@ module Authentication
private
- def socket(options={})
+ def socket(options = {})
@socket ||= stub("socket", client_name: "me.ssh.test")
end
- def transport(options={})
+ def transport(options = {})
@transport ||= MockTransport.new(options.merge(socket: socket))
end
- def session(options={})
+ def session(options = {})
@session ||= begin
sess = stub("auth-session", logger: nil, transport: transport(options))
def sess.next_message
diff --git a/test/authentication/methods/test_abstract.rb b/test/authentication/methods/test_abstract.rb
index 4f930a9..c7944f0 100644
--- a/test/authentication/methods/test_abstract.rb
+++ b/test/authentication/methods/test_abstract.rb
@@ -42,7 +42,7 @@ module Authentication
private
- def subject(options={})
+ def subject(options = {})
@subject ||= Net::SSH::Authentication::Methods::Abstract.new(session(options), options)
end
end
diff --git a/test/authentication/methods/test_hostbased.rb b/test/authentication/methods/test_hostbased.rb
index f93a5a5..99e42fe 100644
--- a/test/authentication/methods/test_hostbased.rb
+++ b/test/authentication/methods/test_hostbased.rb
@@ -79,7 +79,7 @@ module Authentication
@@keys ||= [OpenSSL::PKey::RSA.new(512), OpenSSL::PKey::DSA.new(512)]
end
- def key_manager(options={})
+ def key_manager(options = {})
@key_manager ||= begin
manager = stub("key_manager")
manager.stubs(:each_identity).multiple_yields(*(options[:keys] || keys))
@@ -87,20 +87,20 @@ module Authentication
end
end
- def subject(options={})
+ def subject(options = {})
options[:key_manager] = key_manager(options) unless options.key?(:key_manager)
@subject ||= Net::SSH::Authentication::Methods::Hostbased.new(session(options), options)
end
- def socket(options={})
+ def socket(options = {})
@socket ||= stub("socket", client_name: "me.ssh.test")
end
- def transport(options={})
+ def transport(options = {})
@transport ||= MockTransport.new(options.merge(socket: socket))
end
- def session(options={})
+ def session(options = {})
@session ||= begin
sess = stub("auth-session", logger: nil, transport: transport(options))
def sess.next_message
diff --git a/test/authentication/methods/test_keyboard_interactive.rb b/test/authentication/methods/test_keyboard_interactive.rb
index 76d5272..ebe9c16 100644
--- a/test/authentication/methods/test_keyboard_interactive.rb
+++ b/test/authentication/methods/test_keyboard_interactive.rb
@@ -15,7 +15,7 @@ module Authentication
end
def test_authenticate_should_raise_if_keyboard_interactive_disallowed
- transport.expect do |t,packet|
+ transport.expect do |t, packet|
assert_equal USERAUTH_REQUEST, packet.type
assert_equal "jamis", packet.read_string
assert_equal "ssh-connection", packet.read_string
@@ -34,10 +34,10 @@ module Authentication
def test_authenticate_should_be_false_if_given_password_is_not_accepted
reset_subject(non_interactive: true)
- transport.expect do |t,packet|
+ transport.expect do |t, packet|
assert_equal USERAUTH_REQUEST, packet.type
t.return(USERAUTH_INFO_REQUEST, :string, "", :string, "", :string, "", :long, 1, :string, "Password:", :bool, false)
- t.expect do |t2,packet2|
+ t.expect do |t2, packet2|
assert_equal USERAUTH_INFO_RESPONSE, packet2.type
assert_equal 1, packet2.read_long
assert_equal "the-password", packet2.read_string
@@ -49,10 +49,10 @@ module Authentication
end
def test_authenticate_should_be_true_if_given_password_is_accepted
- transport.expect do |t,packet|
+ transport.expect do |t, packet|
assert_equal USERAUTH_REQUEST, packet.type
t.return(USERAUTH_INFO_REQUEST, :string, "", :string, "", :string, "", :long, 1, :string, "Password:", :bool, false)
- t.expect do |t2,packet2|
+ t.expect do |t2, packet2|
assert_equal USERAUTH_INFO_RESPONSE, packet2.type
t2.return(USERAUTH_SUCCESS)
end
@@ -62,10 +62,10 @@ module Authentication
end
def test_authenticate_should_duplicate_password_as_needed_to_fill_request
- transport.expect do |t,packet|
+ transport.expect do |t, packet|
assert_equal USERAUTH_REQUEST, packet.type
t.return(USERAUTH_INFO_REQUEST, :string, "", :string, "", :string, "", :long, 2, :string, "Password:", :bool, false, :string, "Again:", :bool, false)
- t.expect do |t2,packet2|
+ t.expect do |t2, packet2|
assert_equal USERAUTH_INFO_RESPONSE, packet2.type
assert_equal 2, packet2.read_long
assert_equal "the-password", packet2.read_string
@@ -79,10 +79,10 @@ module Authentication
def test_authenticate_should_not_prompt_for_input_when_in_non_interactive_mode
reset_subject(non_interactive: true)
- transport.expect do |t,packet|
+ transport.expect do |t, packet|
assert_equal USERAUTH_REQUEST, packet.type
t.return(USERAUTH_INFO_REQUEST, :string, "", :string, "", :string, "", :long, 2, :string, "Name:", :bool, true, :string, "Password:", :bool, false)
- t.expect do |t2,packet2|
+ t.expect do |t2, packet2|
assert_equal USERAUTH_INFO_RESPONSE, packet2.type
assert_equal 2, packet2.read_long
assert_equal "", packet2.read_string
@@ -100,10 +100,10 @@ module Authentication
prompt.expects(:_ask).with("Password:", anything, false).returns("password")
reset_subject(password_prompt: prompt)
- transport.expect do |t,packet|
+ transport.expect do |t, packet|
assert_equal USERAUTH_REQUEST, packet.type
t.return(USERAUTH_INFO_REQUEST, :string, "", :string, "", :string, "", :long, 2, :string, "Name:", :bool, true, :string, "Password:", :bool, false)
- t.expect do |t2,packet2|
+ t.expect do |t2, packet2|
assert_equal USERAUTH_INFO_RESPONSE, packet2.type
assert_equal 2, packet2.read_long
assert_equal "name", packet2.read_string
@@ -117,7 +117,7 @@ module Authentication
private
- def subject(options={})
+ def subject(options = {})
@subject ||= Net::SSH::Authentication::Methods::KeyboardInteractive.new(session(options), options)
end
diff --git a/test/authentication/methods/test_none.rb b/test/authentication/methods/test_none.rb
index bc71505..f199172 100644
--- a/test/authentication/methods/test_none.rb
+++ b/test/authentication/methods/test_none.rb
@@ -8,7 +8,7 @@ module Authentication
include Common
def test_authenticate_should_raise_if_none_disallowed
- transport.expect do |t,packet|
+ transport.expect do |t, packet|
assert_equal USERAUTH_REQUEST, packet.type
assert_equal "jamis", packet.read_string
assert_equal "ssh-connection", packet.read_string
@@ -23,7 +23,7 @@ module Authentication
end
def test_authenticate_should_return_true
- transport.expect do |t,packet|
+ transport.expect do |t, packet|
assert_equal USERAUTH_REQUEST, packet.type
t.return(USERAUTH_SUCCESS)
end
@@ -33,7 +33,7 @@ module Authentication
private
- def subject(options={})
+ def subject(options = {})
@subject ||= Net::SSH::Authentication::Methods::None.new(session(options), options)
end
end
diff --git a/test/authentication/methods/test_password.rb b/test/authentication/methods/test_password.rb
index db520bd..2205887 100644
--- a/test/authentication/methods/test_password.rb
+++ b/test/authentication/methods/test_password.rb
@@ -9,7 +9,7 @@ module Authentication
include Common
def test_authenticate_should_raise_if_password_disallowed
- transport.expect do |t,packet|
+ transport.expect do |t, packet|
assert_equal USERAUTH_REQUEST, packet.type
assert_equal "jamis", packet.read_string
assert_equal "ssh-connection", packet.read_string
@@ -26,7 +26,7 @@ module Authentication
end
def test_authenticate_ask_for_password_for_second_time_when_password_is_incorrect
- transport.expect do |t,packet|
+ transport.expect do |t, packet|
assert_equal USERAUTH_REQUEST, packet.type
assert_equal "jamis", packet.read_string
assert_equal "ssh-connection", packet.read_string
@@ -52,7 +52,7 @@ module Authentication
end
def test_authenticate_ask_for_password_if_not_given
- transport.expect do |t,packet|
+ transport.expect do |t, packet|
assert_equal USERAUTH_REQUEST, packet.type
assert_equal "bill", packet.read_string
assert_equal "ssh-connection", packet.read_string
@@ -69,7 +69,7 @@ module Authentication
end
def test_authenticate_when_password_is_acceptible_should_return_true
- transport.expect do |t,packet|
+ transport.expect do |t, packet|
assert_equal USERAUTH_REQUEST, packet.type
t.return(USERAUTH_SUCCESS)
end
@@ -78,7 +78,7 @@ module Authentication
end
def test_authenticate_should_return_false_if_password_change_request_is_received
- transport.expect do |t,packet|
+ transport.expect do |t, packet|
assert_equal USERAUTH_REQUEST, packet.type
t.return(USERAUTH_PASSWD_CHANGEREQ, :string, "Change your password:", :string, "")
end
@@ -88,7 +88,7 @@ module Authentication
private
- def subject(options={})
+ def subject(options = {})
@subject ||= Net::SSH::Authentication::Methods::Password.new(session(options), options)
end
end
diff --git a/test/authentication/methods/test_publickey.rb b/test/authentication/methods/test_publickey.rb
index 029338d..db5e62f 100644
--- a/test/authentication/methods/test_publickey.rb
+++ b/test/authentication/methods/test_publickey.rb
@@ -39,7 +39,7 @@ module Authentication
assert verify_userauth_request_packet(packet, keys.first, false)
t.return(USERAUTH_PK_OK, :string, keys.first.ssh_type, :string, Net::SSH::Buffer.from(:key, keys.first))
- t.expect do |t2,packet2|
+ t.expect do |t2, packet2|
assert_equal USERAUTH_REQUEST, packet2.type
assert verify_userauth_request_packet(packet2, keys.first, true)
assert_equal "sig-one", packet2.read_string
@@ -61,7 +61,7 @@ module Authentication
assert verify_userauth_request_packet(packet, keys.first, false)
t.return(USERAUTH_PK_OK, :string, keys.first.ssh_type, :string, Net::SSH::Buffer.from(:key, keys.first))
- t.expect do |t2,packet2|
+ t.expect do |t2, packet2|
assert_equal USERAUTH_REQUEST, packet2.type
assert verify_userauth_request_packet(packet2, keys.first, true)
assert_equal "sig-one", packet2.read_string
@@ -72,7 +72,7 @@ module Authentication
assert verify_userauth_request_packet(packet3, keys.last, false)
t3.return(USERAUTH_PK_OK, :string, keys.last.ssh_type, :string, Net::SSH::Buffer.from(:key, keys.last))
- t3.expect do |t4,packet4|
+ t3.expect do |t4, packet4|
assert_equal USERAUTH_REQUEST, packet4.type
assert verify_userauth_request_packet(packet4, keys.last, true)
assert_equal "sig-two", packet4.read_string
@@ -93,7 +93,7 @@ module Authentication
assert verify_userauth_request_packet(packet, keys.first, false)
t.return(USERAUTH_PK_OK, :string, keys.first.ssh_type, :string, Net::SSH::Buffer.from(:key, keys.first))
- t.expect do |t2,packet2|
+ t.expect do |t2, packet2|
assert_equal USERAUTH_REQUEST, packet2.type
assert verify_userauth_request_packet(packet2, keys.first, true)
assert_equal "sig-one", packet2.read_string
@@ -131,7 +131,7 @@ module Authentication
@@keys ||= [OpenSSL::PKey::RSA.new(512), OpenSSL::PKey::DSA.new(512)]
end
- def key_manager(options={})
+ def key_manager(options = {})
@key_manager ||= begin
manager = stub("key_manager")
manager.stubs(:each_identity).multiple_yields(*(options[:keys] || keys))
@@ -139,7 +139,7 @@ module Authentication
end
end
- def subject(options={})
+ def subject(options = {})
options[:key_manager] = key_manager(options) unless options.key?(:key_manager)
@subject ||= Net::SSH::Authentication::Methods::Publickey.new(session(options), options)
end
diff --git a/test/authentication/test_agent.rb b/test/authentication/test_agent.rb
index a6cb623..65fee73 100644
--- a/test/authentication/test_agent.rb
+++ b/test/authentication/test_agent.rb
@@ -146,7 +146,7 @@ module Authentication
end
result = agent.identities
- assert_equal 2,result.size
+ assert_equal 2, result.size
assert_equal key1.to_blob, result.first.to_blob
assert_equal key3.to_blob, result.last.to_blob
assert_equal "My favorite key", result.first.comment
@@ -164,7 +164,7 @@ module Authentication
end
result = agent.identities
- assert_equal 2,result.size
+ assert_equal 2, result.size
assert_equal key1.to_blob, result.first.to_blob
assert_equal key3.to_blob, result.last.to_blob
assert_equal "My favorite key", result.first.comment
@@ -197,7 +197,7 @@ module Authentication
end
def test_sign_should_return_signed_data_from_agent
- socket.expect do |s,type,buffer|
+ socket.expect do |s, type, buffer|
assert_equal SSH2_AGENT_SIGN_REQUEST, type
assert_equal key.to_blob, Net::SSH::Buffer.new(buffer.read_string).read_key.to_blob
assert_equal "hello world", buffer.read_string
@@ -211,7 +211,7 @@ module Authentication
def test_add_rsa_identity_with_constraints
rsa = OpenSSL::PKey::RSA.new(512)
- socket.expect do |s,type,buffer|
+ socket.expect do |s, type, buffer|
assert_equal SSH2_AGENT_ADD_ID_CONSTRAINED, type
assert_equal buffer.read_string, "ssh-rsa"
assert_equal buffer.read_bignum.to_s, rsa.n.to_s
@@ -234,7 +234,7 @@ module Authentication
def test_add_rsa_cert_identity
cert = make_cert(OpenSSL::PKey::RSA.new(512))
- socket.expect do |s,type,buffer|
+ socket.expect do |s, type, buffer|
assert_equal SSH2_AGENT_ADD_IDENTITY, type
assert_equal buffer.read_string, "ssh-rsa-cert-v01@openssh.com"
assert_equal buffer.read_string, cert.to_blob
@@ -253,7 +253,7 @@ module Authentication
def test_add_dsa_identity
dsa = OpenSSL::PKey::DSA.new(512)
- socket.expect do |s,type,buffer|
+ socket.expect do |s, type, buffer|
assert_equal SSH2_AGENT_ADD_IDENTITY, type
assert_equal buffer.read_string, "ssh-dss"
assert_equal buffer.read_bignum.to_s, dsa.p.to_s
@@ -272,7 +272,7 @@ module Authentication
def test_add_dsa_cert_identity
cert = make_cert(OpenSSL::PKey::DSA.new(512))
- socket.expect do |s,type,buffer|
+ socket.expect do |s, type, buffer|
assert_equal SSH2_AGENT_ADD_IDENTITY, type
assert_equal buffer.read_string, "ssh-dss-cert-v01@openssh.com"
assert_equal buffer.read_string, cert.to_blob
@@ -288,7 +288,7 @@ module Authentication
def test_add_ecdsa_identity
ecdsa = OpenSSL::PKey::EC.new("prime256v1").generate_key
- socket.expect do |s,type,buffer|
+ socket.expect do |s, type, buffer|
assert_equal SSH2_AGENT_ADD_IDENTITY, type
assert_equal buffer.read_string, "ecdsa-sha2-nistp256"
assert_equal buffer.read_string, "nistp256"
@@ -305,7 +305,7 @@ module Authentication
def test_add_ecdsa_cert_identity
cert = make_cert(OpenSSL::PKey::EC.new("prime256v1").generate_key)
- socket.expect do |s,type,buffer|
+ socket.expect do |s, type, buffer|
assert_equal SSH2_AGENT_ADD_IDENTITY, type
assert_equal buffer.read_string, "ecdsa-sha2-nistp256-cert-v01@openssh.com"
assert_equal buffer.read_string, cert.to_blob
@@ -323,7 +323,7 @@ module Authentication
return unless Net::SSH::Authentication::ED25519Loader::LOADED
ed25519 = Net::SSH::Authentication::ED25519::PrivKey.read(ED25519, nil)
- socket.expect do |s,type,buffer|
+ socket.expect do |s, type, buffer|
assert_equal SSH2_AGENT_ADD_IDENTITY, type
assert_equal buffer.read_string, "ssh-ed25519"
assert_equal buffer.read_string, ed25519.public_key.verify_key.to_bytes
@@ -341,7 +341,7 @@ module Authentication
return unless Net::SSH::Authentication::ED25519Loader::LOADED
cert = make_cert(Net::SSH::Authentication::ED25519::PrivKey.read(ED25519, nil))
- socket.expect do |s,type,buffer|
+ socket.expect do |s, type, buffer|
assert_equal SSH2_AGENT_ADD_IDENTITY, type
assert_equal buffer.read_string, "ssh-ed25519-cert-v01@openssh.com"
assert_equal buffer.read_string, cert.to_blob
@@ -357,7 +357,7 @@ module Authentication
end
def test_add_identity_should_raise_error_on_failure
- socket.expect do |s,_type,_buffer|
+ socket.expect do |s, _type, _buffer|
s.return(SSH_AGENT_FAILURE)
end
@@ -367,7 +367,7 @@ module Authentication
end
def test_remove_identity
- socket.expect do |s,type,buffer|
+ socket.expect do |s, type, buffer|
assert_equal SSH2_AGENT_REMOVE_IDENTITY, type
assert_equal buffer.read_string, key.to_blob
assert buffer.eof?
@@ -379,7 +379,7 @@ module Authentication
end
def test_remove_identity_should_raise_error_on_failure
- socket.expect do |s,_type,_buffer|
+ socket.expect do |s, _type, _buffer|
s.return(SSH_AGENT_FAILURE)
end
@@ -389,7 +389,7 @@ module Authentication
end
def test_remove_all_identities
- socket.expect do |s,type,buffer|
+ socket.expect do |s, type, buffer|
assert_equal SSH2_AGENT_REMOVE_ALL_IDENTITIES, type
assert buffer.eof?
@@ -400,7 +400,7 @@ module Authentication
end
def test_remove_all_identities_should_raise_error_on_failure
- socket.expect do |s,_type,_buffer|
+ socket.expect do |s, _type, _buffer|
s.return(SSH_AGENT_FAILURE)
end
@@ -459,7 +459,7 @@ module Authentication
@factory ||= stub("socket factory", open: socket)
end
- def agent(auto=:connect)
+ def agent(auto = :connect)
@agent ||= begin
agent = Net::SSH::Authentication::Agent.new
agent.stubs(:unix_socket_class).returns(factory)
diff --git a/test/authentication/test_ed25519.rb b/test/authentication/test_ed25519.rb
index 279aa85..d0d0e9e 100644
--- a/test/authentication/test_ed25519.rb
+++ b/test/authentication/test_ed25519.rb
@@ -22,7 +22,7 @@ unless ENV['NET_SSH_NO_ED25519']
shared_secret = "Hello"
signed = priv_key.ssh_do_sign(shared_secret)
- self.assert_equal(true,pub_key.ssh_do_verify(signed,shared_secret))
+ self.assert_equal(true, pub_key.ssh_do_verify(signed, shared_secret))
self.assert_equal(priv_key.public_key.fingerprint, pub_key.fingerprint)
self.assert_equal(pub_key.fingerprint, key_fingerprint_md5_no_pwd)
self.assert_equal(pub_key.fingerprint('sha256'), key_fingerprint_sha256_no_pwd)
@@ -39,7 +39,7 @@ unless ENV['NET_SSH_NO_ED25519']
shared_secret = "Hello"
signed = priv_key.ssh_do_sign(shared_secret)
- self.assert_equal(true,pub_key.ssh_do_verify(signed,shared_secret))
+ self.assert_equal(true, pub_key.ssh_do_verify(signed, shared_secret))
self.assert_equal(priv_key.public_key.fingerprint, pub_key.fingerprint)
self.assert_equal(pub_key.fingerprint, key_fingerprint_md5_no_pwd)
self.assert_equal(pub_key.fingerprint('sha256'), key_fingerprint_sha256_no_pwd)
@@ -56,11 +56,11 @@ unless ENV['NET_SSH_NO_ED25519']
priv = private_key_pwd
pub_key = Net::SSH::Authentication::ED25519::PubKey.new(pub_data)
- priv_key = Net::SSH::Authentication::ED25519::PrivKey.read(priv,'pwd')
+ priv_key = Net::SSH::Authentication::ED25519::PrivKey.read(priv, 'pwd')
shared_secret = "Hello"
signed = priv_key.ssh_do_sign(shared_secret)
- self.assert_equal(true,pub_key.ssh_do_verify(signed,shared_secret))
+ self.assert_equal(true, pub_key.ssh_do_verify(signed, shared_secret))
self.assert_equal(priv_key.public_key.fingerprint, pub_key.fingerprint)
self.assert_equal(pub_key.fingerprint, key_fingerprint_md5_pwd)
self.assert_equal(pub_key.fingerprint('sha256'), key_fingerprint_sha256_pwd)
@@ -86,7 +86,7 @@ unless ENV['NET_SSH_NO_ED25519']
shared_secret = "Hello"
signed = priv_key.ssh_do_sign(shared_secret)
- self.assert_equal(true,pub_key.ssh_do_verify(signed,shared_secret))
+ self.assert_equal(true, pub_key.ssh_do_verify(signed, shared_secret))
self.assert_equal(priv_key.public_key.fingerprint, pub_key.fingerprint)
self.assert_equal(pub_key.fingerprint, key_fingerprint_md5_pwd)
self.assert_equal(pub_key.fingerprint('sha256'), key_fingerprint_sha256_pwd)
diff --git a/test/authentication/test_key_manager.rb b/test/authentication/test_key_manager.rb
index 0ae8914..05cb15d 100644
--- a/test/authentication/test_key_manager.rb
+++ b/test/authentication/test_key_manager.rb
@@ -321,7 +321,7 @@ module Authentication
end
end
- def rsa(size=512)
+ def rsa(size = 512)
@rsa ||= OpenSSL::PKey::RSA.new(size)
end
diff --git a/test/authentication/test_session.rb b/test/authentication/test_session.rb
index 3e46def..0f73a97 100644
--- a/test/authentication/test_session.rb
+++ b/test/authentication/test_session.rb
@@ -167,11 +167,11 @@ module Authentication
private
- def session(options={})
+ def session(options = {})
@session ||= Net::SSH::Authentication::Session.new(transport(options), options)
end
- def transport(options={})
+ def transport(options = {})
@transport ||= MockTransport.new(options)
end
diff --git a/test/common.rb b/test/common.rb
index a666f68..e6a69bf 100644
--- a/test/common.rb
+++ b/test/common.rb
@@ -5,8 +5,8 @@ if ENV["CI"]
require 'simplecov'
SimpleCov.start
-# require 'codecov'
-# SimpleCov.formatter = SimpleCov::Formatter::Codecov
+ # require 'codecov'
+ # SimpleCov.formatter = SimpleCov::Formatter::Codecov
end
end
@@ -94,7 +94,7 @@ class MockTransport < Net::SSH::Transport::Session
attr_accessor :mock_enqueue
- def initialize(options={})
+ def initialize(options = {})
@options = options
self.logger = options[:logger]
self.host_as_string = "net.ssh.test,127.0.0.1"
@@ -161,7 +161,7 @@ class MockTransport < Net::SSH::Transport::Session
@server_options = options
end
- def hint(name, value=true)
+ def hint(name, value = true)
@hints[name] = value
end
end
diff --git a/test/connection/test_channel.rb b/test/connection/test_channel.rb
index ef9f952..c1d7c20 100644
--- a/test/connection/test_channel.rb
+++ b/test/connection/test_channel.rb
@@ -42,7 +42,7 @@ module Connection
def test_request_pty_without_options_should_use_defaults
channel.expects(:send_channel_request).with("pty-req", :string, "xterm",
- :long, 80, :long, 24, :long, 640, :long, 480, :string, "\0").yields
+ :long, 80, :long, 24, :long, 640, :long, 480, :string, "\0").yields
found_block = false
channel.request_pty { found_block = true }
assert found_block, "expected block to be passed to send_channel_request"
@@ -50,7 +50,7 @@ module Connection
def test_request_pty_with_options_should_honor_options
channel.expects(:send_channel_request).with("pty-req", :string, "vanilla",
- :long, 60, :long, 15, :long, 400, :long, 200, :string, "\5\0\0\0\1\0")
+ :long, 60, :long, 15, :long, 400, :long, 200, :string, "\5\0\0\0\1\0")
channel.request_pty term: "vanilla", chars_wide: 60, chars_high: 15,
pixels_wide: 400, pixels_high: 200, modes: { 5 => 1 }
end
@@ -72,7 +72,7 @@ module Connection
channel.do_open_confirmation(0, 100, 100)
assert !channel.closing?
- connection.expect { |_t,packet| assert_equal CHANNEL_CLOSE, packet.type }
+ connection.expect { |_t, packet| assert_equal CHANNEL_CLOSE, packet.type }
connection.expects(:cleanup_channel).with(channel)
channel.close
@@ -111,7 +111,7 @@ module Connection
channel.do_open_confirmation(0, 100, 100)
channel.send_data("hello world")
- connection.expect do |_t,packet|
+ connection.expect do |_t, packet|
assert_equal CHANNEL_DATA, packet.type
assert_equal 0, packet[:local_id]
assert_equal 11, packet[:data].length
@@ -124,12 +124,12 @@ module Connection
channel.do_open_confirmation(0, 100, 8)
channel.send_data("hello world")
- connection.expect do |t,packet|
+ connection.expect do |t, packet|
assert_equal CHANNEL_DATA, packet.type
assert_equal 0, packet[:local_id]
assert_equal "hello wo", packet[:data]
- t.expect do |_t2,packet2|
+ t.expect do |_t2, packet2|
assert_equal CHANNEL_DATA, packet2.type
assert_equal 0, packet2[:local_id]
assert_equal "rld", packet2[:data]
@@ -143,7 +143,7 @@ module Connection
channel.do_open_confirmation(0, 8, 100)
channel.send_data("hello world")
- connection.expect do |_t,packet|
+ connection.expect do |_t, packet|
assert_equal CHANNEL_DATA, packet.type
assert_equal 0, packet[:local_id]
assert_equal "hello wo", packet[:data]
@@ -209,7 +209,7 @@ module Connection
def test_do_request_for_unhandled_request_should_send_CHANNEL_FAILURE_if_wants_reply
channel.do_open_confirmation(0, 100, 100)
- connection.expect { |_t,packet| assert_equal CHANNEL_FAILURE, packet.type }
+ connection.expect { |_t, packet| assert_equal CHANNEL_FAILURE, packet.type }
channel.do_request "keepalive@openssh.com", true, nil
end
@@ -233,7 +233,7 @@ module Connection
channel.do_open_confirmation(0, 100, 100)
flag = false
channel.on_request("exit-status") { flag = true; true }
- connection.expect { |_t,p| assert_equal CHANNEL_SUCCESS, p.type }
+ connection.expect { |_t, p| assert_equal CHANNEL_SUCCESS, p.type }
assert_nothing_raised { channel.do_request "exit-status", true, nil }
assert flag, "callback should have been invoked"
end
@@ -242,14 +242,14 @@ module Connection
channel.do_open_confirmation(0, 100, 100)
flag = false
channel.on_request("exit-status") { flag = true; raise Net::SSH::ChannelRequestFailed }
- connection.expect { |_t,p| assert_equal CHANNEL_FAILURE, p.type }
+ connection.expect { |_t, p| assert_equal CHANNEL_FAILURE, p.type }
assert_nothing_raised { channel.do_request "exit-status", true, nil }
assert flag, "callback should have been invoked"
end
def test_send_channel_request_without_callback_should_not_want_reply
channel.do_open_confirmation(0, 100, 100)
- connection.expect do |_t,p|
+ connection.expect do |_t, p|
assert_equal CHANNEL_REQUEST, p.type
assert_equal 0, p[:local_id]
assert_equal "exec", p[:request]
@@ -274,7 +274,7 @@ module Connection
def test_send_channel_request_with_callback_should_want_reply
channel.do_open_confirmation(0, 100, 100)
- connection.expect do |_t,p|
+ connection.expect do |_t, p|
assert_equal CHANNEL_REQUEST, p.type
assert_equal 0, p[:local_id]
assert_equal "exec", p[:request]
@@ -298,7 +298,7 @@ module Connection
flag = false
channel { flag = true }
assert !flag, "callback should not have been invoked yet"
- channel.do_open_confirmation(1,2,3)
+ channel.do_open_confirmation(1, 2, 3)
assert flag, "callback should have been invoked"
end
@@ -307,14 +307,14 @@ module Connection
forward = mock("forward")
forward.expects(:agent).with(channel)
connection.expects(:forward).returns(forward)
- channel.do_open_confirmation(1,2,3)
+ channel.do_open_confirmation(1, 2, 3)
end
def test_do_open_confirmation_with_non_session_channel_should_not_invoke_agent_forwarding_even_if_agent_forwarding_requested
connection forward_agent: true
channel type: "direct-tcpip"
connection.expects(:forward).never
- channel.do_open_confirmation(1,2,3)
+ channel.do_open_confirmation(1, 2, 3)
end
def test_do_window_adjust_should_adjust_remote_window_size_by_the_given_amount
@@ -347,7 +347,7 @@ module Connection
assert_equal 0x20000, channel.local_maximum_window_size
assert_equal 0x20000, channel.local_window_size
- connection.expect do |_t,p|
+ connection.expect do |_t, p|
assert_equal CHANNEL_WINDOW_ADJUST, p.type
assert_equal 0, p[:local_id]
assert_equal 0x20000, p[:extra_bytes]
@@ -384,25 +384,25 @@ module Connection
end
def test_wait_should_block_while_channel_is_active?
- channel.expects(:active?).times(3).returns(true,true,false)
+ channel.expects(:active?).times(3).returns(true, true, false)
channel.wait
end
def test_wait_until_open_confirmed_should_block_while_remote_id_nil
- channel.expects(:remote_id).times(3).returns(nil,nil,3)
+ channel.expects(:remote_id).times(3).returns(nil, nil, 3)
channel.send(:wait_until_open_confirmed)
end
def test_eof_bang_should_send_eof_to_server
channel.do_open_confirmation(0, 1000, 1000)
- connection.expect { |_t,p| assert_equal CHANNEL_EOF, p.type }
+ connection.expect { |_t, p| assert_equal CHANNEL_EOF, p.type }
channel.eof!
channel.process
end
def test_eof_bang_should_not_send_eof_if_eof_was_already_declared
channel.do_open_confirmation(0, 1000, 1000)
- connection.expect { |_t,p| assert_equal CHANNEL_EOF, p.type }
+ connection.expect { |_t, p| assert_equal CHANNEL_EOF, p.type }
channel.eof!
assert_nothing_raised { channel.eof! }
channel.process
@@ -410,7 +410,7 @@ module Connection
def test_eof_q_should_return_true_if_eof_declared
channel.do_open_confirmation(0, 1000, 1000)
- connection.expect { |_t,p| assert_equal CHANNEL_EOF, p.type }
+ connection.expect { |_t, p| assert_equal CHANNEL_EOF, p.type }
assert !channel.eof?
channel.eof!
@@ -420,7 +420,7 @@ module Connection
def test_send_data_should_raise_exception_if_eof_declared
channel.do_open_confirmation(0, 1000, 1000)
- connection.expect { |_t,p| assert_equal CHANNEL_EOF, p.type }
+ connection.expect { |_t, p| assert_equal CHANNEL_EOF, p.type }
channel.eof!
channel.process
assert_raises(EOFError) { channel.send_data("die! die! die!") }
@@ -428,9 +428,9 @@ module Connection
def test_data_should_precede_eof
channel.do_open_confirmation(0, 1000, 1000)
- connection.expect do |_t,p|
+ connection.expect do |_t, p|
assert_equal CHANNEL_DATA, p.type
- connection.expect { |_t,p2| assert_equal CHANNEL_EOF, p2.type }
+ connection.expect { |_t, p2| assert_equal CHANNEL_EOF, p2.type }
end
channel.send_data "foo"
channel.eof!
@@ -444,7 +444,7 @@ module Connection
attr_reader :options
attr_reader :channels
- def initialize(options={})
+ def initialize(options = {})
@expectation = nil
@options = options
@channels = {}
@@ -472,15 +472,15 @@ module Connection
end
end
- def connection(options={})
+ def connection(options = {})
@connection ||= MockConnection.new(options)
end
- def channel(options={}, &block)
+ def channel(options = {}, &block)
@channel ||= Net::SSH::Connection::Channel.new(connection(options),
- options[:type] || "session",
- options[:local_id] || 0,
- &block)
+ options[:type] || "session",
+ options[:local_id] || 0,
+ &block)
end
end
end
diff --git a/test/connection/test_session.rb b/test/connection/test_session.rb
index 6eb1432..5de5fd2 100644
--- a/test/connection/test_session.rb
+++ b/test/connection/test_session.rb
@@ -61,14 +61,14 @@ module Connection
flag = false
channel = session.open_channel { flag = true }
assert !flag, "callback should not be invoked immediately"
- channel.do_open_confirmation(1,2,3)
+ channel.do_open_confirmation(1, 2, 3)
assert flag, "callback should have been invoked"
assert_equal "session", channel.type
assert_equal 0, channel.local_id
assert_equal channel, session.channels[channel.local_id]
packet = P(:byte, CHANNEL_OPEN, :string, "session", :long, channel.local_id,
- :long, channel.local_maximum_window_size, :long, channel.local_maximum_packet_size)
+ :long, channel.local_maximum_window_size, :long, channel.local_maximum_packet_size)
assert_equal packet.to_s, socket.write_buffer
end
@@ -76,15 +76,15 @@ module Connection
channel = session.open_channel("direct-tcpip")
assert_equal "direct-tcpip", channel.type
packet = P(:byte, CHANNEL_OPEN, :string, "direct-tcpip", :long, channel.local_id,
- :long, channel.local_maximum_window_size, :long, channel.local_maximum_packet_size)
+ :long, channel.local_maximum_window_size, :long, channel.local_maximum_packet_size)
assert_equal packet.to_s, socket.write_buffer
end
def test_open_channel_with_extras_should_append_extras_to_packet
channel = session.open_channel("direct-tcpip", :string, "other.host", :long, 1234)
packet = P(:byte, CHANNEL_OPEN, :string, "direct-tcpip", :long, channel.local_id,
- :long, channel.local_maximum_window_size, :long, channel.local_maximum_packet_size,
- :string, "other.host", :long, 1234)
+ :long, channel.local_maximum_window_size, :long, channel.local_maximum_packet_size,
+ :string, "other.host", :long, 1234)
assert_equal packet.to_s, socket.write_buffer
end
@@ -335,19 +335,19 @@ module Connection
end
def test_writers_without_pending_writes_should_not_be_considered_for_select
- IO.expects(:select).with([socket],[],nil,nil).returns([[],[],[]])
+ IO.expects(:select).with([socket], [], nil, nil).returns([[], [], []])
session.process
end
def test_writers_with_pending_writes_should_be_considered_for_select
socket.enqueue("laksdjflasdkf")
- IO.expects(:select).with([socket],[socket],nil,nil).returns([[],[],[]])
+ IO.expects(:select).with([socket], [socket], nil, nil).returns([[], [], []])
session.process
end
def test_ready_readers_should_be_filled
socket.expects(:recv).returns("this is some data")
- IO.expects(:select).with([socket],[],nil,nil).returns([[socket],[],[]])
+ IO.expects(:select).with([socket], [], nil, nil).returns([[socket], [], []])
session.process
assert_equal [socket], session.listeners.keys
end
@@ -355,7 +355,7 @@ module Connection
def test_ready_readers_that_cant_be_filled_should_be_removed
socket.expects(:recv).returns("")
socket.expects(:close)
- IO.expects(:select).with([socket],[],nil,nil).returns([[socket],[],[]])
+ IO.expects(:select).with([socket], [], nil, nil).returns([[socket], [], []])
session.process
assert session.listeners.empty?
end
@@ -365,7 +365,7 @@ module Connection
flag = false
session.stop_listening_to(socket) # so that we only have to test the presence of a single IO object
session.listen_to(io) { flag = true }
- IO.expects(:select).with([io],[],nil,nil).returns([[io],[],[]])
+ IO.expects(:select).with([io], [], nil, nil).returns([[io], [], []])
session.process
assert flag, "callback should have been invoked"
end
@@ -373,13 +373,13 @@ module Connection
def test_ready_writers_should_call_send_pending
socket.enqueue("laksdjflasdkf")
socket.expects(:send).with("laksdjflasdkf", 0).returns(13)
- IO.expects(:select).with([socket],[socket],nil,nil).returns([[],[socket],[]])
+ IO.expects(:select).with([socket], [socket], nil, nil).returns([[], [socket], []])
session.process
end
def test_process_should_call_rekey_as_needed
transport.expects(:rekey_as_needed)
- IO.expects(:select).with([socket],[],nil,nil).returns([[],[],[]])
+ IO.expects(:select).with([socket], [], nil, nil).returns([[], [], []])
session.process
end
@@ -387,7 +387,7 @@ module Connection
timeout = Net::SSH::Connection::Session::DEFAULT_IO_SELECT_TIMEOUT
options = { keepalive: true }
expected_packet = P(:byte, Net::SSH::Packet::GLOBAL_REQUEST, :string, "keepalive@openssh.com", :bool, true)
- IO.stubs(:select).with([socket],[],nil,timeout).returns(nil)
+ IO.stubs(:select).with([socket], [], nil, timeout).returns(nil)
transport.expects(:enqueue_message).with { |msg| msg.content == expected_packet.content }
session(options).process
end
@@ -396,15 +396,15 @@ module Connection
timeout = Net::SSH::Connection::Session::DEFAULT_IO_SELECT_TIMEOUT
options = { keepalive: true, keepalive_interval: 300, keepalive_maxcount: 3 }
expected_packet = P(:byte, Net::SSH::Packet::GLOBAL_REQUEST, :string, "keepalive@openssh.com", :bool, true)
- [1,2,3].each do |i|
+ [1, 2, 3].each do |i|
Time.stubs(:now).returns(Time.at(i * 300))
- IO.stubs(:select).with([socket],[],nil,timeout).returns(nil)
+ IO.stubs(:select).with([socket], [], nil, timeout).returns(nil)
transport.expects(:enqueue_message).with { |msg| msg.content == expected_packet.content }
session(options).process
end
Time.stubs(:now).returns(Time.at(4 * 300))
- IO.stubs(:select).with([socket],[],nil,timeout).returns(nil)
+ IO.stubs(:select).with([socket], [], nil, timeout).returns(nil)
transport.expects(:enqueue_message).with { |msg| msg.content == expected_packet.content }
assert_raises(Net::SSH::Timeout) { session(options).process }
end
@@ -412,7 +412,7 @@ module Connection
def test_process_should_not_call_enqueue_message_unless_io_select_timed_out
timeout = Net::SSH::Connection::Session::DEFAULT_IO_SELECT_TIMEOUT
options = { keepalive: true }
- IO.stubs(:select).with([socket],[],nil,timeout).returns([[socket],[],[]])
+ IO.stubs(:select).with([socket], [], nil, timeout).returns([[socket], [], []])
socket.stubs(:recv).returns("x")
transport.expects(:enqueue_message).never
session(options).process
@@ -422,20 +422,20 @@ module Connection
timeout = 10
options = { keepalive: true, keepalive_interval: timeout }
Time.stubs(:now).returns(Time.at(0), Time.at(9), Time.at(timeout))
- IO.stubs(:select).with([socket],[],nil,timeout).returns(nil)
+ IO.stubs(:select).with([socket], [], nil, timeout).returns(nil)
transport.expects(:enqueue_message).times(2)
3.times { session(options).process }
end
def test_process_should_call_io_select_with_nil_as_last_arg_if_keepalive_disabled
- IO.expects(:select).with([socket],[],nil,nil).returns([[],[],[]])
+ IO.expects(:select).with([socket], [], nil, nil).returns([[], [], []])
session.process
end
def test_process_should_call_io_select_with_interval_as_last_arg_if_keepalive_interval_passed
timeout = 10
options = { keepalive: true, keepalive_interval: timeout }
- IO.expects(:select).with([socket],[],nil,timeout).returns([[],[],[]])
+ IO.expects(:select).with([socket], [], nil, timeout).returns([[], [], []])
session(options).process
end
@@ -443,13 +443,13 @@ module Connection
timeout = 10
wait = 5
options = { keepalive: true, keepalive_interval: timeout }
- IO.expects(:select).with([socket],[],nil,wait).returns([[],[],[]])
+ IO.expects(:select).with([socket], [], nil, wait).returns([[], [], []])
session(options).process(wait)
end
def test_loop_should_call_process_until_process_returns_false
session.expects(:process).with(0)
- session.expects(:process).with(nil).times(4).returns(true,true,true,false).yields
+ session.expects(:process).with(nil).times(4).returns(true, true, true, false).yields
n = 0
session.loop { n += 1 }
assert_equal 4, n
@@ -520,7 +520,7 @@ module Connection
private
def prep_exec(command, *data)
- IO.expects(:select).with([socket],[],nil,0).returns([[],[],[]])
+ IO.expects(:select).with([socket], [], nil, 0).returns([[], [], []])
transport.mock_enqueue = true
transport.expect do |t, p|
assert_equal CHANNEL_OPEN, p.type
@@ -544,7 +544,7 @@ module Connection
end
t2.return(CHANNEL_CLOSE, :long, p[:remote_id])
- t2.expect { |_t3,p3| assert_equal CHANNEL_CLOSE, p3.type }
+ t2.expect { |_t3, p3| assert_equal CHANNEL_CLOSE, p3.type }
end
end
end
@@ -570,11 +570,11 @@ module Connection
session.channels[local_id] = stub("channel", process: true, local_closed?: false)
end
- def transport(options={})
+ def transport(options = {})
@transport ||= MockTransport.new(options.merge(socket: socket))
end
- def session(options={})
+ def session(options = {})
@session ||= Net::SSH::Connection::Session.new(transport, options)
end
diff --git a/test/integration/common.rb b/test/integration/common.rb
index b897ece..9f56fe9 100644
--- a/test/integration/common.rb
+++ b/test/integration/common.rb
@@ -20,14 +20,14 @@ module IntegrationTestHelpers
end
end
- def set_authorized_key(user,pubkey)
+ def set_authorized_key(user, pubkey)
authorized_key = "/home/#{user}/.ssh/authorized_keys"
sh "sudo cp #{pubkey} #{authorized_key}"
sh "sudo chown #{user} #{authorized_key}"
sh "sudo chmod 0744 #{authorized_key}"
end
- def sign_user_key(user,pubkey)
+ def sign_user_key(user, pubkey)
cert = "/etc/ssh/users_ca"
sh "sudo ssh-keygen -s #{cert} -I user_#{user} -n #{user} -V +52w #{pubkey}"
end
@@ -48,7 +48,7 @@ module IntegrationTestHelpers
end
end
- def ssh_add(key,password)
+ def ssh_add(key, password)
command = "ssh-add #{key}"
status = nil
PTY.spawn(command) do |reader, writer, pid|
diff --git a/test/integration/mitm_server.rb b/test/integration/mitm_server.rb
index 365c318..750748c 100644
--- a/test/integration/mitm_server.rb
+++ b/test/integration/mitm_server.rb
@@ -49,7 +49,7 @@ class MitmServer < TCPServer
server = start_server(server) do |local|
remote = TCPSocket.new(remote_host, remote_port)
loop do
- r,_w,_e = IO.select([local, remote],nil,nil)
+ r, _w, _e = IO.select([local, remote], nil, nil)
if r.include? local
begin
data = local.recv local_read_size
diff --git a/test/integration/test_cert_user_auth.rb b/test/integration/test_cert_user_auth.rb
index b975d0a..596d150 100644
--- a/test/integration/test_cert_user_auth.rb
+++ b/test/integration/test_cert_user_auth.rb
@@ -14,7 +14,7 @@ unless ENV['NET_SSH_NO_ED25519']
Dir.mktmpdir do |dir|
sh "rm -rf #{dir}/id_rsa_ed25519 #{dir}/id_rsa_ed25519.pub"
sh "ssh-keygen -q -f #{dir}/id_rsa_ed25519 -t ed25519 -N ''"
- sign_user_key('net_ssh_1',"#{dir}/id_rsa_ed25519.pub")
+ sign_user_key('net_ssh_1', "#{dir}/id_rsa_ed25519.pub")
ret = Net::SSH.start("localhost", "net_ssh_1", keys: "#{dir}/id_rsa_ed25519") do |ssh|
ssh.exec! 'echo "hello from:$USER"'
@@ -27,7 +27,7 @@ unless ENV['NET_SSH_NO_ED25519']
Dir.mktmpdir do |dir|
sh "rm -rf #{dir}/id_rsa_ed25519 #{dir}/id_rsa_ed25519.pub"
sh "ssh-keygen -q -f #{dir}/id_rsa_ed25519 -t ed25519 -N ''"
- sign_user_key('net_ssh_1',"#{dir}/id_rsa_ed25519.pub")
+ sign_user_key('net_ssh_1', "#{dir}/id_rsa_ed25519.pub")
sh "mv #{dir}/id_rsa_ed25519-cert.pub #{dir}/cert"
ret = Net::SSH.start("localhost", "net_ssh_1", keys: "#{dir}/id_rsa_ed25519", keycerts: "#{dir}/cert") do |ssh|
@@ -42,7 +42,7 @@ unless ENV['NET_SSH_NO_ED25519']
with_agent do
sh "rm -rf #{dir}/id_rsa_ed25519 #{dir}/id_rsa_ed25519.pub"
sh "ssh-keygen -q -f #{dir}/id_rsa_ed25519 -t ed25519 -N 'pwd'"
- sign_user_key('net_ssh_1',"#{dir}/id_rsa_ed25519.pub")
+ sign_user_key('net_ssh_1', "#{dir}/id_rsa_ed25519.pub")
ssh_add("#{dir}/id_rsa_ed25519", "pwd")
sh "rm -rf #{dir}/id_rsa_ed25519 #{dir}/id_rsa_ed25519.pub #{dir}/id_rsa_ed25519-cert.pub"
@@ -61,7 +61,7 @@ unless ENV['NET_SSH_NO_ED25519']
sh "ssh-keygen -q -f #{dir}/id_rsa_ed25519 -t ed25519 -N ''"
# add key before signing cert
ssh_add("#{dir}/id_rsa_ed25519", "pwd")
- sign_user_key('net_ssh_1',"#{dir}/id_rsa_ed25519.pub")
+ sign_user_key('net_ssh_1', "#{dir}/id_rsa_ed25519.pub")
sh "rm -rf #{dir}/id_rsa_ed25519 #{dir}/id_rsa_ed25519.pub"
ret = Net::SSH.start("localhost", "net_ssh_1", keycerts: "#{dir}/id_rsa_ed25519-cert.pub") do |ssh|
diff --git a/test/integration/test_channel.rb b/test/integration/test_channel.rb
index 2a24eda..cd23c9e 100644
--- a/test/integration/test_channel.rb
+++ b/test/integration/test_channel.rb
@@ -25,7 +25,7 @@ class TestChannel < NetSSHTest
@key_id_rsa = "#{dir}/id_rsa"
sh "rm -rf #{@key_id_rsa} #{@key_id_rsa}.pub"
sh "ssh-keygen -q -f #{@key_id_rsa} -t rsa -N ''"
- set_authorized_key(user,"#{@key_id_rsa}.pub")
+ set_authorized_key(user, "#{@key_id_rsa}.pub")
yield
end
end
diff --git a/test/integration/test_ed25519_pkeys.rb b/test/integration/test_ed25519_pkeys.rb
index 3358af7..0017801 100644
--- a/test/integration/test_ed25519_pkeys.rb
+++ b/test/integration/test_ed25519_pkeys.rb
@@ -15,7 +15,7 @@ unless ENV['NET_SSH_NO_ED25519']
Dir.mktmpdir do |dir|
sh "rm -rf #{dir}/id_rsa_ed25519 #{dir}/id_rsa_ed25519.pub"
sh "ssh-keygen -q -f #{dir}/id_rsa_ed25519 -t ed25519 -N ''"
- set_authorized_key('net_ssh_1',"#{dir}/id_rsa_ed25519.pub")
+ set_authorized_key('net_ssh_1', "#{dir}/id_rsa_ed25519.pub")
ret = Net::SSH.start("localhost", "net_ssh_1", { keys: "#{dir}/id_rsa_ed25519" }) do |ssh|
ssh.exec! 'echo "hello from:$USER"'
@@ -29,8 +29,8 @@ unless ENV['NET_SSH_NO_ED25519']
with_agent do
sh "rm -rf #{dir}/id_rsa_ed25519 #{dir}/id_rsa_ed25519.pub"
sh "ssh-keygen -q -f #{dir}/id_rsa_ed25519 -t ed25519 -N 'pwd'"
- set_authorized_key('net_ssh_1',"#{dir}/id_rsa_ed25519.pub")
- ssh_add("#{dir}/id_rsa_ed25519","pwd")
+ set_authorized_key('net_ssh_1', "#{dir}/id_rsa_ed25519.pub")
+ ssh_add("#{dir}/id_rsa_ed25519", "pwd")
# TODO: fix bug in net ssh which reads public key even if private key is there
sh "mv #{dir}/id_rsa_ed25519.pub #{dir}/id_rsa_ed25519.pub.hidden"
@@ -47,7 +47,7 @@ unless ENV['NET_SSH_NO_ED25519']
Dir.mktmpdir do |dir|
sh "rm -rf #{dir}/id_rsa_ed25519 #{dir}/id_rsa_ed25519.pub"
sh "ssh-keygen -q -f #{dir}/id_rsa_ed25519 -t ed25519 -N 'pwd'"
- set_authorized_key('net_ssh_1',"#{dir}/id_rsa_ed25519.pub")
+ set_authorized_key('net_ssh_1', "#{dir}/id_rsa_ed25519.pub")
# TODO: fix bug in net ssh which reads public key even if private key is there
sh "mv #{dir}/id_rsa_ed25519.pub #{dir}/id_rsa_ed25519.pub.hidden"
diff --git a/test/integration/test_forward.rb b/test/integration/test_forward.rb
index e7c87da..f006e2d 100644
--- a/test/integration/test_forward.rb
+++ b/test/integration/test_forward.rb
@@ -33,7 +33,7 @@ class ForwardTestBase < NetSSHTest
end
def ssh_start_params(options = {})
- [localhost,user, { keys: @key_id_rsa }.merge(options)]
+ [localhost, user, { keys: @key_id_rsa }.merge(options)]
end
def setup_ssh_env(&block)
@@ -41,7 +41,7 @@ class ForwardTestBase < NetSSHTest
@key_id_rsa = "#{dir}/id_rsa"
sh "rm -rf #{@key_id_rsa} #{@key_id_rsa}.pub"
sh "ssh-keygen -q -f #{@key_id_rsa} -t rsa -N ''"
- set_authorized_key(user,"#{@key_id_rsa}.pub")
+ set_authorized_key(user, "#{@key_id_rsa}.pub")
yield
end
end
@@ -66,7 +66,7 @@ class ForwardTestBase < NetSSHTest
end
class TestForward < ForwardTestBase
- def start_server_closing_soon(exceptions=nil)
+ def start_server_closing_soon(exceptions = nil)
server = TCPServer.open(0)
Thread.start do
loop do
@@ -294,7 +294,7 @@ class TestForward < ForwardTestBase
attr_reader :sockets
def open(host, port, connection_options = nil)
- socket = TCPSocket.new(host,port)
+ socket = TCPSocket.new(host, port)
@sockets << socket
socket
end
diff --git a/test/integration/test_hmac_etm.rb b/test/integration/test_hmac_etm.rb
index 0c7182c..1111a26 100644
--- a/test/integration/test_hmac_etm.rb
+++ b/test/integration/test_hmac_etm.rb
@@ -30,7 +30,7 @@ class TestHMacEtm < NetSSHTest
config_lines.push("MACs #{macs}")
end
- variants.each do |key,variant|
+ variants.each do |key, variant|
define_method "test_with_only_hmac_etm#{key}" do
start_sshd_7_or_later(config: config_with_macs(variant)) do |_pid, port|
Timeout.timeout(4) do
diff --git a/test/integration/test_http_proxy.rb b/test/integration/test_http_proxy.rb
index fa71faf..a59eb60 100644
--- a/test/integration/test_http_proxy.rb
+++ b/test/integration/test_http_proxy.rb
@@ -31,7 +31,7 @@ class TestHTTPProxy < NetSSHTest
@key_id_rsa = "#{dir}/id_rsa"
sh "rm -rf #{@key_id_rsa} #{@key_id_rsa}.pub"
sh "ssh-keygen -q -f #{@key_id_rsa} -t rsa -N ''"
- set_authorized_key(user,"#{@key_id_rsa}.pub")
+ set_authorized_key(user, "#{@key_id_rsa}.pub")
yield
end
end
diff --git a/test/integration/test_id_rsa_keys.rb b/test/integration/test_id_rsa_keys.rb
index 84d6728..44894cc 100644
--- a/test/integration/test_id_rsa_keys.rb
+++ b/test/integration/test_id_rsa_keys.rb
@@ -14,7 +14,7 @@ class TestIDRSAPKeys < NetSSHTest
tmpdir do |dir|
sh "rm -rf #{dir}/id_rsa #{dir}/id_rsa.pub"
sh "ssh-keygen -q -f #{dir}/id_rsa -t rsa -N ''"
- set_authorized_key('net_ssh_1',"#{dir}/id_rsa.pub")
+ set_authorized_key('net_ssh_1', "#{dir}/id_rsa.pub")
ret = Net::SSH.start("localhost", "net_ssh_1", { keys: "#{dir}/id_rsa" }) do |ssh|
ssh.exec! 'echo "hello from:$USER"'
@@ -29,8 +29,8 @@ class TestIDRSAPKeys < NetSSHTest
with_agent do
sh "rm -rf #{dir}/id_rsa #{dir}/id_rsa.pub"
sh "ssh-keygen -q -f #{dir}/id_rsa -t rsa -N 'pwd123'"
- set_authorized_key('net_ssh_1',"#{dir}/id_rsa.pub")
- ssh_add("#{dir}/id_rsa","pwd123")
+ set_authorized_key('net_ssh_1', "#{dir}/id_rsa.pub")
+ ssh_add("#{dir}/id_rsa", "pwd123")
ret = Net::SSH.start("localhost", "net_ssh_1") do |ssh|
ssh.exec! 'echo "hello from:$USER"'
@@ -45,8 +45,8 @@ class TestIDRSAPKeys < NetSSHTest
with_agent do
sh "rm -rf #{dir}/id_rsa #{dir}/id_rsa.pub"
sh "ssh-keygen -q -f #{dir}/id_rsa -t rsa -N 'pwd123'"
- set_authorized_key('net_ssh_1',"#{dir}/id_rsa.pub")
- ssh_add("#{dir}/id_rsa","pwd123")
+ set_authorized_key('net_ssh_1', "#{dir}/id_rsa.pub")
+ ssh_add("#{dir}/id_rsa", "pwd123")
ret = Net::SSH.start("localhost", "net_ssh_1", keys: ["#{dir}/id_rsa"]) do |ssh|
ssh.exec! 'echo "hello from:$USER"'
@@ -60,7 +60,7 @@ class TestIDRSAPKeys < NetSSHTest
tmpdir do |dir|
sh "rm -rf #{dir}/id_rsa #{dir}/id_rsa.pub"
sh "ssh-keygen -q -f #{dir}/id_rsa -t rsa -N 'pwd12'"
- set_authorized_key('net_ssh_1',"#{dir}/id_rsa.pub")
+ set_authorized_key('net_ssh_1', "#{dir}/id_rsa.pub")
ret = Net::SSH.start("localhost", "net_ssh_1", { keys: "#{dir}/id_rsa", passphrase: 'pwd12' }) do |ssh|
ssh.exec! 'echo "hello from:$USER"'
@@ -74,7 +74,7 @@ class TestIDRSAPKeys < NetSSHTest
tmpdir do |dir|
sh "rm -rf #{dir}/id_rsa #{dir}/id_rsa.pub"
sh "ssh-keygen -q -f #{dir}/id_rsa -t rsa -N 'pwd12'"
- set_authorized_key('net_ssh_1',"#{dir}/id_rsa.pub")
+ set_authorized_key('net_ssh_1', "#{dir}/id_rsa.pub")
private_key = File.read("#{dir}/id_rsa")
options = { keys: [], key_data: [private_key] }
diff --git a/test/integration/test_proxy.rb b/test/integration/test_proxy.rb
index f1419f8..6572c42 100644
--- a/test/integration/test_proxy.rb
+++ b/test/integration/test_proxy.rb
@@ -19,7 +19,7 @@ class TestProxy < NetSSHTest
end
def ssh_start_params(options)
- [localhost,user, { keys: @key_id_rsa }.merge(options)]
+ [localhost, user, { keys: @key_id_rsa }.merge(options)]
end
def setup_ssh_env(&block)
@@ -27,7 +27,7 @@ class TestProxy < NetSSHTest
@key_id_rsa = "#{dir}/id_rsa"
sh "rm -rf #{@key_id_rsa} #{@key_id_rsa}.pub"
sh "ssh-keygen -q -f #{@key_id_rsa} -t rsa -N ''"
- set_authorized_key(user,"#{@key_id_rsa}.pub")
+ set_authorized_key(user, "#{@key_id_rsa}.pub")
yield
end
end
@@ -39,7 +39,7 @@ class TestProxy < NetSSHTest
@gwkey_id_rsa = "#{dir}/id_rsa"
sh "rm -rf #{@gwkey_id_rsa} #{@gwkey_id_rsa}.pub"
sh "ssh-keygen -q -f #{@gwkey_id_rsa} -t rsa -N ''"
- set_authorized_key(gwuser,"#{@gwkey_id_rsa}.pub")
+ set_authorized_key(gwuser, "#{@gwkey_id_rsa}.pub")
config = "Host #{gwhost}
IdentityFile #{@gwkey_id_rsa}
StrictHostKeyChecking no
@@ -67,7 +67,7 @@ class TestProxy < NetSSHTest
end
end
- def with_spurious_write_wakeup_emulate(rate=99,&block)
+ def with_spurious_write_wakeup_emulate(rate = 99, &block)
orig_io_select = IO.method(:select)
count = 0
@@ -75,7 +75,7 @@ class TestProxy < NetSSHTest
count += 1
if (count % rate != 0)
if params && params[1] && !params[1].empty?
- return [[],params[1],[]]
+ return [[], params[1], []]
end
end
orig_io_select.call(*params)
diff --git a/test/manual/test_pageant.rb b/test/manual/test_pageant.rb
index e9a72da..b07e82c 100644
--- a/test/manual/test_pageant.rb
+++ b/test/manual/test_pageant.rb
@@ -28,7 +28,7 @@ module Authentication
private
- def agent(auto=:connect)
+ def agent(auto = :connect)
@agent ||= begin
agent = Net::SSH::Authentication::Agent.new
agent.connect! if auto == :connect
diff --git a/test/test_buffer.rb b/test/test_buffer.rb
index 1275896..c4fc9f2 100644
--- a/test/test_buffer.rb
+++ b/test/test_buffer.rb
@@ -56,7 +56,7 @@ class TestBuffer < NetSSHTest
end
def test_from_with_array_argument_should_write_multiple_of_the_given_type
- buffer = Net::SSH::Buffer.from(:byte, [1,2,3,4,5])
+ buffer = Net::SSH::Buffer.from(:byte, [1, 2, 3, 4, 5])
assert_equal "\1\2\3\4\5", buffer.to_s
end
diff --git a/test/test_config.rb b/test/test_config.rb
index e315c86..82c2377 100644
--- a/test/test_config.rb
+++ b/test/test_config.rb
@@ -543,7 +543,7 @@ class TestConfig < NetSSHTest
private
- def with_home_env(value,&block)
+ def with_home_env(value, &block)
env_home_before = ENV['HOME']
begin
ENV['HOME'] = value
diff --git a/test/test_key_factory.rb b/test/test_key_factory.rb
index f0a5116..c6f7705 100644
--- a/test/test_key_factory.rb
+++ b/test/test_key_factory.rb
@@ -65,7 +65,7 @@ class TestKeyFactory < NetSSHTest
def test_load_encrypted_private_key_should_give_three_tries_for_the_password_and_then_raise_exception
prompt = MockPrompt.new
File.expects(:read).with(@key_file).returns(encrypted(rsa_key, "password"))
- prompt.expects(:_ask).times(3).with("Enter passphrase for #{@key_file}:", has_entries(type: 'private_key', filename: @key_file), false).returns("passwod","passphrase","passwd")
+ prompt.expects(:_ask).times(3).with("Enter passphrase for #{@key_file}:", has_entries(type: 'private_key', filename: @key_file), false).returns("passwod", "passphrase", "passwd")
if OpenSSL::PKey.respond_to?(:read)
error_class = [ArgumentError, OpenSSL::PKey::PKeyError]
else
diff --git a/test/test_known_hosts.rb b/test/test_known_hosts.rb
index 5bd7668..f960351 100644
--- a/test/test_known_hosts.rb
+++ b/test/test_known_hosts.rb
@@ -28,7 +28,7 @@ class TestKnownHosts < NetSSHTest
assert_equal(0, keys.count)
assert_equal([], keys.to_a)
- kh.add('github2.com',rsa_key)
+ kh.add('github2.com', rsa_key)
keys2 = kh.keys_for("github2.com")
assert_equal([rsa_key.to_blob], keys2.to_a.map(&:to_blob))
end
@@ -36,89 +36,89 @@ class TestKnownHosts < NetSSHTest
def test_search_for
options = { user_known_hosts_file: path("known_hosts/github"), global_known_hosts_file: [] }
- keys = Net::SSH::KnownHosts.search_for('github.com',options)
+ keys = Net::SSH::KnownHosts.search_for('github.com', options)
assert_equal(["ssh-rsa"], keys.map(&:ssh_type))
end
def test_search_for_with_hostname_and_right_ip_with_check_host_ip
options = { user_known_hosts_file: path("known_hosts/gitlab"), check_host_ip: true }
- keys = Net::SSH::KnownHosts.search_for('gitlab.com,35.231.145.151',options)
+ keys = Net::SSH::KnownHosts.search_for('gitlab.com,35.231.145.151', options)
assert_equal(1, keys.count)
end
def test_search_for_with_hostname_and_right_ip_without_check_host_ip
options = { user_known_hosts_file: path("known_hosts/gitlab"), check_host_ip: false }
- keys = Net::SSH::KnownHosts.search_for('gitlab.com,35.231.145.151',options)
+ keys = Net::SSH::KnownHosts.search_for('gitlab.com,35.231.145.151', options)
assert_equal(1, keys.count)
end
def test_search_for_with_hostname_and_wrong_ip_with_check_host_ip
options = { user_known_hosts_file: path("known_hosts/gitlab"), check_host_ip: true }
- keys = Net::SSH::KnownHosts.search_for('gitlab.com,192.0.2.1',options)
+ keys = Net::SSH::KnownHosts.search_for('gitlab.com,192.0.2.1', options)
assert_equal(0, keys.count)
end
def test_search_for_with_hostname_and_wrong_ip_without_check_host_ip
options = { user_known_hosts_file: path("known_hosts/gitlab"), check_host_ip: false }
- keys = Net::SSH::KnownHosts.search_for('gitlab.com,192.0.2.2',options)
+ keys = Net::SSH::KnownHosts.search_for('gitlab.com,192.0.2.2', options)
assert_equal(1, keys.count)
end
def test_search_for_with_hostname_only_with_check_host_ip
options = { user_known_hosts_file: path("known_hosts/gitlab"), check_host_ip: true }
- keys = Net::SSH::KnownHosts.search_for('gitlab.com',options)
+ keys = Net::SSH::KnownHosts.search_for('gitlab.com', options)
assert_equal(1, keys.count)
end
def test_search_for_with_hostname_only_without_check_host_ip
options = { user_known_hosts_file: path("known_hosts/gitlab"), check_host_ip: false }
- keys = Net::SSH::KnownHosts.search_for('gitlab.com',options)
+ keys = Net::SSH::KnownHosts.search_for('gitlab.com', options)
assert_equal(1, keys.count)
end
def test_search_for_with_ip_only_with_check_host_ip
options = { user_known_hosts_file: path("known_hosts/gitlab"), check_host_ip: true }
- keys = Net::SSH::KnownHosts.search_for('35.231.145.151',options)
+ keys = Net::SSH::KnownHosts.search_for('35.231.145.151', options)
assert_equal(1, keys.count)
end
def test_search_for_with_ip_only_without_check_host_ip
options = { user_known_hosts_file: path("known_hosts/gitlab"), check_host_ip: false }
- keys = Net::SSH::KnownHosts.search_for('35.231.145.151',options)
+ keys = Net::SSH::KnownHosts.search_for('35.231.145.151', options)
assert_equal(1, keys.count)
end
def test_search_for_with_hostname_matching_pattern
options = { user_known_hosts_file: path("known_hosts/misc") }
- keys = Net::SSH::KnownHosts.search_for('subdomain.gitfoo.com',options)
+ keys = Net::SSH::KnownHosts.search_for('subdomain.gitfoo.com', options)
assert_equal(1, keys.count)
end
def test_search_for_with_hostname_not_matching_pattern_1
options = { user_known_hosts_file: path("known_hosts/misc") }
- keys = Net::SSH::KnownHosts.search_for('gitfoo.com',options)
+ keys = Net::SSH::KnownHosts.search_for('gitfoo.com', options)
assert_equal(0, keys.count)
end
def test_search_for_with_hostname_not_matching_pattern_2
options = { user_known_hosts_file: path("known_hosts/misc") }
- keys = Net::SSH::KnownHosts.search_for('subdomain.gitmisc.com',options)
+ keys = Net::SSH::KnownHosts.search_for('subdomain.gitmisc.com', options)
assert_equal(0, keys.count)
end
def test_search_for_with_hostname_not_matching_pattern_3
options = { user_known_hosts_file: path("known_hosts/misc") }
- keys = Net::SSH::KnownHosts.search_for('subsubdomain.subdomain.gitfoo.com',options)
+ keys = Net::SSH::KnownHosts.search_for('subsubdomain.subdomain.gitfoo.com', options)
assert_equal(1, keys.count)
end
def test_asterisk_matches_multiple_dots
with_config_file(lines: ["*.git???.com #{sample_key}"]) do |path|
options = { user_known_hosts_file: path }
- keys = Net::SSH::KnownHosts.search_for('subsubdomain.subdomain.gitfoo.com',options)
+ keys = Net::SSH::KnownHosts.search_for('subsubdomain.subdomain.gitfoo.com', options)
assert_equal(1, keys.count)
- keys = Net::SSH::KnownHosts.search_for('subsubdomain.subdomain.gitfoo2.com',options)
+ keys = Net::SSH::KnownHosts.search_for('subsubdomain.subdomain.gitfoo2.com', options)
assert_equal(0, keys.count)
end
end
@@ -126,10 +126,10 @@ class TestKnownHosts < NetSSHTest
def test_asterisk_matches_everything
with_config_file(lines: ["* #{sample_key}"]) do |path|
options = { user_known_hosts_file: path }
- keys = Net::SSH::KnownHosts.search_for('subsubdomain.subdomain.gitfoo.com',options)
+ keys = Net::SSH::KnownHosts.search_for('subsubdomain.subdomain.gitfoo.com', options)
assert_equal(1, keys.count)
- keys = Net::SSH::KnownHosts.search_for('subsubdomain.subdomain.gitfoo2.com',options)
+ keys = Net::SSH::KnownHosts.search_for('subsubdomain.subdomain.gitfoo2.com', options)
assert_equal(1, keys.count)
end
end
@@ -138,13 +138,13 @@ class TestKnownHosts < NetSSHTest
Tempfile.open('github') do |f|
f.write(File.read(path("known_hosts/github")))
options = { user_known_hosts_file: f.path }
- keys = Net::SSH::KnownHosts.search_for('github2.com',options)
+ keys = Net::SSH::KnownHosts.search_for('github2.com', options)
assert_equal(0, keys.count)
keys.add_host_key(rsa_key)
assert_equal([rsa_key.to_blob], keys.map(&:to_blob))
- keys = Net::SSH::KnownHosts.search_for('github2.com',options)
+ keys = Net::SSH::KnownHosts.search_for('github2.com', options)
assert_equal([rsa_key.to_blob], keys.map(&:to_blob))
end
end
diff --git a/test/transport/kex/test_diffie_hellman_group1_sha1.rb b/test/transport/kex/test_diffie_hellman_group1_sha1.rb
index 5d6df93..a3b846c 100644
--- a/test/transport/kex/test_diffie_hellman_group1_sha1.rb
+++ b/test/transport/kex/test_diffie_hellman_group1_sha1.rb
@@ -85,7 +85,7 @@ module Transport
private
- def exchange!(options={})
+ def exchange!(options = {})
connection.expect do |t, buffer|
assert_equal KEXDH_INIT, buffer.type
assert_equal dh.dh.pub_key, buffer.read_bignum
@@ -99,7 +99,7 @@ module Transport
dh.exchange_keys
end
- def dh_options(options={})
+ def dh_options(options = {})
@dh_options = options
end
@@ -107,7 +107,7 @@ module Transport
@dh ||= subject.new(algorithms, connection, packet_data.merge(need_bytes: 20).merge(@dh_options || {}))
end
- def algorithms(options={})
+ def algorithms(options = {})
@algorithms ||= OpenStruct.new(host_key: options[:host_key] || "ssh-rsa", host_key_format: options[:host_key] || "ssh-rsa")
end
@@ -121,7 +121,7 @@ module Transport
# 512 bits is the smallest possible key that will work with this, so
# we use it for speed reasons
- def server_key(bits=512)
+ def server_key(bits = 512)
@server_key ||= OpenSSL::PKey::RSA.new(bits)
end
@@ -143,13 +143,13 @@ module Transport
def session_id
@session_id ||= begin
buffer = Net::SSH::Buffer.from(:string, packet_data[:client_version_string],
- :string, packet_data[:server_version_string],
- :string, packet_data[:client_algorithm_packet],
- :string, packet_data[:server_algorithm_packet],
- :string, Net::SSH::Buffer.from(:key, server_key),
- :bignum, dh.dh.pub_key,
- :bignum, server_dh_pubkey,
- :bignum, shared_secret)
+ :string, packet_data[:server_version_string],
+ :string, packet_data[:client_algorithm_packet],
+ :string, packet_data[:server_algorithm_packet],
+ :string, Net::SSH::Buffer.from(:key, server_key),
+ :bignum, dh.dh.pub_key,
+ :bignum, server_dh_pubkey,
+ :bignum, shared_secret)
digest_type.digest(buffer.to_s)
end
end
@@ -158,7 +158,7 @@ module Transport
@signature ||= server_key.ssh_do_sign(session_id)
end
- def bn(number, base=10)
+ def bn(number, base = 10)
OpenSSL::BN.new(number.to_s, base)
end
diff --git a/test/transport/kex/test_diffie_hellman_group_exchange_sha1.rb b/test/transport/kex/test_diffie_hellman_group_exchange_sha1.rb
index 29a7d36..d0df04b 100644
--- a/test/transport/kex/test_diffie_hellman_group_exchange_sha1.rb
+++ b/test/transport/kex/test_diffie_hellman_group_exchange_sha1.rb
@@ -42,11 +42,11 @@ module Transport
private
- def need_bits(bits=1024)
+ def need_bits(bits = 1024)
@need_bits ||= need_minimum(bits)
end
- def need_minimum(bits=1024)
+ def need_minimum(bits = 1024)
return @dh_options[:minimum_dh_bits] if @dh_options && @dh_options[:minimum_dh_bits]
bits
@@ -56,7 +56,7 @@ module Transport
142326151570335518660743995281621698377057354949884468943021767573608899048361360422513557553514790045512299468953431585300812548859419857171094366358158903433167915517332113861059747425408670144201099811846875730766487278261498262568348338476437200556998366087779709990807518291581860338635288400119315130179
end
- def exchange!(options={})
+ def exchange!(options = {})
connection.expect do |t, buffer|
assert_equal KEXDH_GEX_REQUEST, buffer.type
assert_equal need_minimum, buffer.read_long
@@ -88,18 +88,18 @@ module Transport
def session_id
@session_id ||= begin
buffer = Net::SSH::Buffer.from(:string, packet_data[:client_version_string],
- :string, packet_data[:server_version_string],
- :string, packet_data[:client_algorithm_packet],
- :string, packet_data[:server_algorithm_packet],
- :string, Net::SSH::Buffer.from(:key, server_key),
- :long, 1024,
- :long, need_bits, # need bits, figure this part out,
- :long, 8192,
- :bignum, dh.dh.p,
- :bignum, dh.dh.g,
- :bignum, dh.dh.pub_key,
- :bignum, server_dh_pubkey,
- :bignum, shared_secret)
+ :string, packet_data[:server_version_string],
+ :string, packet_data[:client_algorithm_packet],
+ :string, packet_data[:server_algorithm_packet],
+ :string, Net::SSH::Buffer.from(:key, server_key),
+ :long, 1024,
+ :long, need_bits, # need bits, figure this part out,
+ :long, 8192,
+ :bignum, dh.dh.p,
+ :bignum, dh.dh.g,
+ :bignum, dh.dh.pub_key,
+ :bignum, server_dh_pubkey,
+ :bignum, shared_secret)
digest_type.digest(buffer.to_s)
end
end
diff --git a/test/transport/test_algorithms.rb b/test/transport/test_algorithms.rb
index d4f9737..e52782c 100644
--- a/test/transport/test_algorithms.rb
+++ b/test/transport/test_algorithms.rb
@@ -146,7 +146,7 @@ module Transport
def test_constructor_with_unrecognized_hmac_should_ignore_those
assert_equal %w[hmac-sha2-512-etm@openssh.com hmac-sha2-256-etm@openssh.com hmac-sha2-512 hmac-sha2-256 hmac-sha1 hmac-sha2-512-96 hmac-sha2-256-96 hmac-sha1-96 hmac-ripemd160 hmac-ripemd160@openssh.com hmac-md5 hmac-md5-96 none],
- algorithms(hmac: "unknown hmac-md5-96", append_all_supported_algorithms: true)[:hmac]
+ algorithms(hmac: "unknown hmac-md5-96", append_all_supported_algorithms: true)[:hmac]
end
def test_constructor_with_preferred_hmac_supports_additions
@@ -224,7 +224,7 @@ module Transport
def test_key_exchange_when_server_does_not_support_preferred_kex_should_fallback_to_secondary
kexinit kex: "diffie-hellman-group14-sha1"
- transport.expect do |_t,buffer|
+ transport.expect do |_t, buffer|
assert_kexinit(buffer)
install_mock_key_exchange(buffer, kex: Net::SSH::Transport::Kex::DiffieHellmanGroup1SHA1)
end
@@ -233,7 +233,7 @@ module Transport
def test_key_exchange_when_server_does_not_support_any_preferred_kex_should_raise_error
kexinit kex: "something-obscure"
- transport.expect { |_t,buffer| assert_kexinit(buffer) }
+ transport.expect { |_t, buffer| assert_kexinit(buffer) }
assert_raises(Net::SSH::Exception) { algorithms.accept_kexinit(kexinit) }
end
@@ -335,7 +335,7 @@ module Transport
private
- def install_mock_key_exchange(buffer, options={})
+ def install_mock_key_exchange(buffer, options = {})
kex = options[:kex] || Net::SSH::Transport::Kex::DiffieHellmanGroupExchangeSHA256
Net::SSH::Transport::Kex::MAP.each do |_name, klass|
@@ -346,17 +346,17 @@ module Transport
kex.expects(:new)
.with(algorithms, transport,
- client_version_string: Net::SSH::Transport::ServerVersion::PROTO_VERSION,
- server_version_string: transport.server_version.version,
- server_algorithm_packet: kexinit.to_s,
- client_algorithm_packet: buffer.to_s,
- need_bytes: 32,
- minimum_dh_bits: nil,
- logger: nil)
+ client_version_string: Net::SSH::Transport::ServerVersion::PROTO_VERSION,
+ server_version_string: transport.server_version.version,
+ server_algorithm_packet: kexinit.to_s,
+ client_algorithm_packet: buffer.to_s,
+ need_bytes: 32,
+ minimum_dh_bits: nil,
+ logger: nil)
.returns(stub("kex", exchange_keys: { shared_secret: shared_secret, session_id: session_id, hashing_algorithm: hashing_algorithm }))
end
- def install_mock_algorithm_lookups(options={})
+ def install_mock_algorithm_lookups(options = {})
params = { shared: shared_secret.to_ssh, hash: session_id, digester: hashing_algorithm }
Net::SSH::Transport::CipherFactory.expects(:get)
.with(options[:client_cipher] || "aes256-ctr", params.merge(iv: key("A"), key: key("C"), encrypt: true))
@@ -386,27 +386,27 @@ module Transport
hashing_algorithm.digest(shared_secret.to_ssh + session_id + salt + session_id)
end
- def cipher(type, options={})
+ def cipher(type, options = {})
Net::SSH::Transport::CipherFactory.get(type, options)
end
- def kexinit(options={})
+ def kexinit(options = {})
@kexinit ||= P(:byte, KEXINIT,
- :long, rand(0xFFFFFFFF), :long, rand(0xFFFFFFFF), :long, rand(0xFFFFFFFF), :long, rand(0xFFFFFFFF),
- :string, options[:kex] || "diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1",
- :string, options[:host_key] || "ssh-rsa,ssh-dss",
- :string, options[:encryption_client] || "aes256-ctr,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,idea-cbc",
- :string, options[:encryption_server] || "aes256-ctr,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,idea-cbc",
- :string, options[:hmac_client] || "hmac-sha2-256,hmac-sha1,hmac-md5,hmac-sha1-96,hmac-md5-96",
- :string, options[:hmac_server] || "hmac-sha2-256,hmac-sha1,hmac-md5,hmac-sha1-96,hmac-md5-96",
- :string, options[:compression_client] || "none,zlib@openssh.com,zlib",
- :string, options[:compression_server] || "none,zlib@openssh.com,zlib",
- :string, options[:language_client] || "",
- :string, options[:language_server] || "",
- :bool, options[:first_kex_follows])
- end
-
- def assert_kexinit(buffer, options={})
+ :long, rand(0xFFFFFFFF), :long, rand(0xFFFFFFFF), :long, rand(0xFFFFFFFF), :long, rand(0xFFFFFFFF),
+ :string, options[:kex] || "diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1",
+ :string, options[:host_key] || "ssh-rsa,ssh-dss",
+ :string, options[:encryption_client] || "aes256-ctr,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,idea-cbc",
+ :string, options[:encryption_server] || "aes256-ctr,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,idea-cbc",
+ :string, options[:hmac_client] || "hmac-sha2-256,hmac-sha1,hmac-md5,hmac-sha1-96,hmac-md5-96",
+ :string, options[:hmac_server] || "hmac-sha2-256,hmac-sha1,hmac-md5,hmac-sha1-96,hmac-md5-96",
+ :string, options[:compression_client] || "none,zlib@openssh.com,zlib",
+ :string, options[:compression_server] || "none,zlib@openssh.com,zlib",
+ :string, options[:language_client] || "",
+ :string, options[:language_server] || "",
+ :bool, options[:first_kex_follows])
+ end
+
+ def assert_kexinit(buffer, options = {})
assert_equal KEXINIT, buffer.type
assert_equal 16, buffer.read(16).length
assert_equal options[:kex] || (x25519_kex + ec_kex + %w[diffie-hellman-group-exchange-sha256 diffie-hellman-group14-sha256 diffie-hellman-group14-sha1]).join(','), buffer.read_string
@@ -433,14 +433,14 @@ module Transport
assert_equal :server_hmac, transport.server_options[:hmac]
end
- def algorithms(algorithms_options={}, transport_options={})
+ def algorithms(algorithms_options = {}, transport_options = {})
@algorithms ||= Net::SSH::Transport::Algorithms.new(
transport(transport_options),
algorithms_options
)
end
- def transport(transport_options={})
+ def transport(transport_options = {})
@transport ||= MockTransport.new(
{
user_known_hosts_file: '/dev/null',
diff --git a/test/transport/test_cipher_factory.rb b/test/transport/test_cipher_factory.rb
index 768fbf8..0d651aa 100644
--- a/test/transport/test_cipher_factory.rb
+++ b/test/transport/test_cipher_factory.rb
@@ -10,66 +10,66 @@ module Transport
end
def test_lengths_for_none
- assert_equal [0,0], factory.get_lengths("none")
- assert_equal [0,0], factory.get_lengths("bogus")
+ assert_equal [0, 0], factory.get_lengths("none")
+ assert_equal [0, 0], factory.get_lengths("bogus")
end
def test_lengths_for_blowfish_cbc
- assert_equal [16,8], factory.get_lengths("blowfish-cbc")
+ assert_equal [16, 8], factory.get_lengths("blowfish-cbc")
end
if_supported?("idea-cbc") do
def test_lengths_for_idea_cbc
- assert_equal [16,8], factory.get_lengths("idea-cbc")
+ assert_equal [16, 8], factory.get_lengths("idea-cbc")
end
end
def test_lengths_for_rijndael_cbc
- assert_equal [32,16], factory.get_lengths("rijndael-cbc@lysator.liu.se")
+ assert_equal [32, 16], factory.get_lengths("rijndael-cbc@lysator.liu.se")
end
def test_lengths_for_cast128_cbc
- assert_equal [16,8], factory.get_lengths("cast128-cbc")
+ assert_equal [16, 8], factory.get_lengths("cast128-cbc")
end
def test_lengths_for_3des_cbc
- assert_equal [24,8], factory.get_lengths("3des-cbc")
+ assert_equal [24, 8], factory.get_lengths("3des-cbc")
end
def test_lengths_for_aes128_cbc
- assert_equal [16,16], factory.get_lengths("aes128-cbc")
+ assert_equal [16, 16], factory.get_lengths("aes128-cbc")
end
def test_lengths_for_aes192_cbc
- assert_equal [24,16], factory.get_lengths("aes192-cbc")
+ assert_equal [24, 16], factory.get_lengths("aes192-cbc")
end
def test_lengths_for_aes256_cbc
- assert_equal [32,16], factory.get_lengths("aes256-cbc")
+ assert_equal [32, 16], factory.get_lengths("aes256-cbc")
end
def test_lengths_for_3des_ctr
- assert_equal [24,8], factory.get_lengths("3des-ctr")
+ assert_equal [24, 8], factory.get_lengths("3des-ctr")
end
def test_lengths_for_aes128_ctr
- assert_equal [16,16], factory.get_lengths("aes128-ctr")
+ assert_equal [16, 16], factory.get_lengths("aes128-ctr")
end
def test_lengths_for_aes192_ctr
- assert_equal [24,16], factory.get_lengths("aes192-ctr")
+ assert_equal [24, 16], factory.get_lengths("aes192-ctr")
end
def test_lengths_for_aes256_ctr
- assert_equal [32,16], factory.get_lengths("aes256-ctr")
+ assert_equal [32, 16], factory.get_lengths("aes256-ctr")
end
def test_lengths_for_blowfish_ctr
- assert_equal [16,8], factory.get_lengths("blowfish-ctr")
+ assert_equal [16, 8], factory.get_lengths("blowfish-ctr")
end
def test_lengths_for_cast128_ctr
- assert_equal [16,8], factory.get_lengths("cast128-ctr")
+ assert_equal [16, 8], factory.get_lengths("cast128-ctr")
end
BLOWFISH_CBC = "\210\021\200\315\240_\026$\352\204g\233\244\242x\332e\370\001\327\224Nv@9_\323\037\252kb\037\036\237\375]\343/y\037\237\312Q\f7]\347Y\005\275%\377\0010$G\272\250B\265Nd\375\342\372\025r6}+Y\213y\n\237\267\\\374^\346BdJ$\353\220Ik\023<\236&H\277=\225"
@@ -231,7 +231,7 @@ module Transport
end
def test_aes256_ctr_for_encryption2
- assert_equal [AES256_CTR,AES256_CTR2], encrypt2("aes256-ctr")
+ assert_equal [AES256_CTR, AES256_CTR2], encrypt2("aes256-ctr")
end
def test_aes256_ctr_for_decryption
diff --git a/test/transport/test_hmac.rb b/test/transport/test_hmac.rb
index 009c900..4317b1a 100644
--- a/test/transport/test_hmac.rb
+++ b/test/transport/test_hmac.rb
@@ -6,7 +6,7 @@ module Transport
Net::SSH::Transport::HMAC::MAP.each do |name, _value|
method = name.tr("-", "_")
define_method("test_get_with_#{method}_returns_new_hmac_instance") do
- key = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!&$%"[0,Net::SSH::Transport::HMAC::MAP[name].key_length]
+ key = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!&$%"[0, Net::SSH::Transport::HMAC::MAP[name].key_length]
hmac = Net::SSH::Transport::HMAC.get(name, key, { shared: "123", hash: "^&*", digester: OpenSSL::Digest::SHA1 })
assert_instance_of Net::SSH::Transport::HMAC::MAP[name], hmac
assert_equal key, hmac.key
diff --git a/test/transport/test_packet_stream.rb b/test/transport/test_packet_stream.rb
index b79f640..2921765 100644
--- a/test/transport/test_packet_stream.rb
+++ b/test/transport/test_packet_stream.rb
@@ -57,12 +57,12 @@ module Transport
end
def test_available_for_read_should_return_nontrue_when_self_is_not_ready
- IO.expects(:select).with([stream], nil, nil, 0).returns([[],[],[]])
+ IO.expects(:select).with([stream], nil, nil, 0).returns([[], [], []])
assert !stream.available_for_read?
end
def test_available_for_read_should_return_true_when_self_is_ready
- IO.expects(:select).with([stream], nil, nil, 0).returns([[self],[],[]])
+ IO.expects(:select).with([stream], nil, nil, 0).returns([[self], [], []])
assert stream.available_for_read?
end
@@ -134,7 +134,7 @@ module Transport
def test_next_packet_should_eventually_return_packet_when_non_blocking_and_partial_read
IO.stubs(:select).returns([[stream]])
- stream.stubs(:recv).returns(packet[0,10], packet[10..-1])
+ stream.stubs(:recv).returns(packet[0, 10], packet[10..-1])
assert_nil stream.next_packet(:nonblock)
packet = stream.next_packet(:nonblock)
assert_not_nil packet
@@ -159,7 +159,7 @@ module Transport
def test_next_packet_should_block_when_requested_until_entire_packet_is_available
IO.stubs(:select).returns([[stream]])
- stream.stubs(:recv).returns(packet[0,10], packet[10,20], packet[20..-1])
+ stream.stubs(:recv).returns(packet[0, 10], packet[10, 20], packet[20..-1])
packet = stream.next_packet(:block)
assert_not_nil packet
assert_equal DEBUG, packet.type
@@ -181,7 +181,7 @@ module Transport
end
def test_send_packet_should_enqueue_and_send_data_immediately
- stream.expects(:send).times(3).with { |a,b| a == stream.write_buffer && b == 0 }.returns(15)
+ stream.expects(:send).times(3).with { |a, b| a == stream.write_buffer && b == 0 }.returns(15)
IO.expects(:select).times(2).returns([[], [stream]])
stream.send_packet(ssh_packet)
assert !stream.pending_write?
diff --git a/test/transport/test_server_version.rb b/test/transport/test_server_version.rb
index ae443cc..c4b92a3 100644
--- a/test/transport/test_server_version.rb
+++ b/test/transport/test_server_version.rb
@@ -42,7 +42,7 @@ module Transport
private
- def socket(good, version_header, raise_eot=false)
+ def socket(good, version_header, raise_eot = false)
socket = mock("socket")
socket.expects(:write).with("#{Net::SSH::Transport::ServerVersion::PROTO_VERSION}\r\n")
diff --git a/test/transport/test_session.rb b/test/transport/test_session.rb
index 117fb89..7a26dfc 100644
--- a/test/transport/test_session.rb
+++ b/test/transport/test_session.rb
@@ -402,7 +402,7 @@ module Transport
@algorithms ||= stub("algorithms", initialized?: true, allow?: true, start: true)
end
- def session(options={})
+ def session(options = {})
@session ||= begin
host = options.delete(:host) || TEST_HOST
if (proxy = options[:proxy])
diff --git a/test/transport/test_state.rb b/test/transport/test_state.rb
index 389f012..bc9b00d 100644
--- a/test/transport/test_state.rb
+++ b/test/transport/test_state.rb
@@ -161,7 +161,7 @@ module Transport
private
- def deflater(level=Zlib::DEFAULT_COMPRESSION)
+ def deflater(level = Zlib::DEFAULT_COMPRESSION)
@deflater ||= Zlib::Deflate.new(level)
end
diff --git a/test/verifiers/test_always.rb b/test/verifiers/test_always.rb
index 9d93d9a..c387d7f 100644
--- a/test/verifiers/test_always.rb
+++ b/test/verifiers/test_always.rb
@@ -16,7 +16,7 @@ class TestAlways < NetSSHTest
def test_passess_if_sam
secure_verifier = Net::SSH::Verifiers::Always.new
- key = OpenStruct.new(ssh_type: 'key_type',to_blob: 'keyblob')
+ key = OpenStruct.new(ssh_type: 'key_type', to_blob: 'keyblob')
host_keys = [key]
def host_keys.host
'foo'
@@ -26,8 +26,8 @@ class TestAlways < NetSSHTest
def test_raises_mismatch_error_if_not_the_same
secure_verifier = Net::SSH::Verifiers::Always.new
- key_in_known_hosts = OpenStruct.new(ssh_type: 'key_type',to_blob: 'keyblob')
- key_actual = OpenStruct.new(ssh_type: 'key_type',to_blob: 'not keyblob')
+ key_in_known_hosts = OpenStruct.new(ssh_type: 'key_type', to_blob: 'keyblob')
+ key_actual = OpenStruct.new(ssh_type: 'key_type', to_blob: 'not keyblob')
host_keys = [key_in_known_hosts]
def host_keys.host
diff --git a/test/win_integration/test_pageant.rb b/test/win_integration/test_pageant.rb
index b7e89fa..0a909a7 100644
--- a/test/win_integration/test_pageant.rb
+++ b/test/win_integration/test_pageant.rb
@@ -30,7 +30,7 @@ module Authentication
private
- def agent(auto=:connect)
+ def agent(auto = :connect)
@agent ||= begin
agent = Net::SSH::Authentication::Agent.new
agent.connect! if auto == :connect