Sha256: ca77ba435e4740e89bec64a5320730e7a9f1da84e7f6c5e59ff6f95a84f513b2

Contents?: true

Size: 1.12 KB

Versions: 11

Compression:

Stored size: 1.12 KB

Contents

require_relative 'command_handler'

module Ftpd

  # The login commands

  class CmdLogin < CommandHandler

    # @return [String] The user for the current login sequence

    attr_accessor :user

    # @return [String] The password for the current login sequence

    attr_accessor :password

    def initialize(*)
      super
      @user = nil
      @password = nil
    end

    #  * User Name (USER) command.

    def cmd_user(argument)
      syntax_error unless argument
      sequence_error if logged_in
      @user = argument
      if config.auth_level > AUTH_USER
        reply "331 Password required"
        expect 'pass'
      else
        login @user
      end
    end

    # The Password (PASS) command

    def cmd_pass(argument)
      syntax_error unless argument
      @password = argument
      if config.auth_level > AUTH_PASSWORD
        reply "332 Account required"
        expect 'acct'
      else
        login @user, @password
      end
    end

    # The Account (ACCT) command

    def cmd_acct(argument)
      syntax_error unless argument
      account = argument
      login @user, @password, account
    end

  end

end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
ftpd-1.1.1 lib/ftpd/cmd_login.rb
ftpd-1.1.0 lib/ftpd/cmd_login.rb
investtools-ftpd-1.0.1 lib/ftpd/cmd_login.rb
ftpd-1.0.1 lib/ftpd/cmd_login.rb
ftpd-1.0.0 lib/ftpd/cmd_login.rb
ftpd-0.17.0 lib/ftpd/cmd_login.rb
ftpd-0.16.0 lib/ftpd/cmd_login.rb
ftpd-0.15.0 lib/ftpd/cmd_login.rb
ftpd-0.14.0 lib/ftpd/cmd_login.rb
ftpd-0.13.0 lib/ftpd/cmd_login.rb
ftpd-0.12.0 lib/ftpd/cmd_login.rb