Sha256: 0c6f96bbee34acfc74895fec98100ccfb31727c41671737a69424301ebcd7b31

Contents?: true

Size: 1.02 KB

Versions: 20

Compression:

Stored size: 1.02 KB

Contents

require 'net/ssh/errors'
require 'net/ssh/authentication/methods/abstract'

module Net
  module SSH
    module Authentication
      module Methods
        # Implements the "none" SSH authentication method.
        class None < Abstract
          # Attempt to authenticate as "none"
          def authenticate(next_service, user = "", password = "")
            send_message(userauth_request(user, next_service, "none"))
            message = session.next_message

            case message.type
            when USERAUTH_SUCCESS
              debug { "none succeeded" }
              return true
            when USERAUTH_FAILURE
              debug { "none failed" }

              raise Net::SSH::Authentication::DisallowedMethod unless
                message[:authentications].split(/,/).include? 'none'

              return false
            else
              raise Net::SSH::Exception, "unexpected reply to USERAUTH_REQUEST: #{message.type} (#{message.inspect})"
            end
          end
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 5 rubygems

Version Path
net-ssh-7.3.0 lib/net/ssh/authentication/methods/none.rb
net-ssh-7.3.0.rc1 lib/net/ssh/authentication/methods/none.rb
harbr-2.8.1 vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.1/lib/net/ssh/authentication/methods/none.rb
net-ssh-7.2.3 lib/net/ssh/authentication/methods/none.rb
net-ssh-7.2.2.rc1 lib/net/ssh/authentication/methods/none.rb
net-ssh-7.2.1 lib/net/ssh/authentication/methods/none.rb
net-ssh-7.2.1.rc1 lib/net/ssh/authentication/methods/none.rb
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.0/lib/net/ssh/authentication/methods/none.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/net-ssh-7.2.0/lib/net/ssh/authentication/methods/none.rb
net-ssh-7.2.0 lib/net/ssh/authentication/methods/none.rb
net-ssh-7.2.0.rc1 lib/net/ssh/authentication/methods/none.rb
net-ssh-7.2.0.beta1 lib/net/ssh/authentication/methods/none.rb
net-ssh-7.1.0 lib/net/ssh/authentication/methods/none.rb
net-ssh-7.1.0.beta2 lib/net/ssh/authentication/methods/none.rb
net-ssh-7.1.0.beta1 lib/net/ssh/authentication/methods/none.rb
net-ssh-clone-7.0.1 lib/net/ssh/authentication/methods/none.rb
net-ssh-7.0.1 lib/net/ssh/authentication/methods/none.rb
net-ssh-7.0.0 lib/net/ssh/authentication/methods/none.rb
net-ssh-7.0.0.beta1 lib/net/ssh/authentication/methods/none.rb
eximius-net-ssh-6.3.1 lib/net/ssh/authentication/methods/none.rb