Class: Ftpd::CmdLogin

Inherits:
CommandHandler show all
Defined in:
lib/ftpd/cmd_login.rb

Overview

The login commands

Constant Summary

Constants inherited from CommandHandler

Ftpd::CommandHandler::COMMAND_FILENAME_PREFIX, Ftpd::CommandHandler::COMMAND_KLASS_PREFIX, Ftpd::CommandHandler::COMMAND_METHOD_PREFIX

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from CommandHandler

commands

Methods included from FileSystemHelper

#ensure_accessible, #ensure_directory, #ensure_does_not_exist, #ensure_exists, #ensure_file_system_supports, #path_list, #unique_path

Methods included from Error

#error, #sequence_error, #syntax_error, #unimplemented_error

Methods included from DataConnectionHelper

#close_data_server_socket_when_done, #data_connection_description, #encrypt_data?, #handle_data_disconnect, #make_tls_connection, #open_active_data_connection, #open_active_tls_data_connection, #open_data_connection, #open_passive_data_connection, #open_passive_tls_data_connection, #receive_file, #send_start_of_data_connection_reply, #transmit_file

Constructor Details

#initializeCmdLogin

Returns a new instance of CmdLogin.



19
20
21
22
23
# File 'lib/ftpd/cmd_login.rb', line 19

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

Instance Attribute Details

#passwordString

Returns The password for the current login sequence.

Returns:

  • (String)

    The password for the current login sequence



17
18
19
# File 'lib/ftpd/cmd_login.rb', line 17

def password
  @password
end

#userString

Returns The user for the current login sequence.

Returns:

  • (String)

    The user for the current login sequence



13
14
15
# File 'lib/ftpd/cmd_login.rb', line 13

def user
  @user
end

Instance Method Details

#cmd_acct(argument) ⇒ Object

The Account (ACCT) command



54
55
56
57
58
# File 'lib/ftpd/cmd_login.rb', line 54

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

#cmd_pass(argument) ⇒ Object

The Password (PASS) command



41
42
43
44
45
46
47
48
49
50
# File 'lib/ftpd/cmd_login.rb', line 41

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

#cmd_user(argument) ⇒ Object

  • User Name (USER) command.



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/ftpd/cmd_login.rb', line 27

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
     @user
  end
end