Sha256: 017aa680a012bb4096303706b205e7540fc353feeefee1a638ac512289234aff

Contents?: true

Size: 592 Bytes

Versions: 11

Compression:

Stored size: 592 Bytes

Contents

require_relative 'command_handler'

module Ftpd

  class CmdPasv < CommandHandler

    def cmd_pasv(argument)
      ensure_logged_in
      ensure_not_epsv_all
      if data_server
        reply "200 Already in passive mode"
      else
        interface = socket.addr[3]
        self.data_server = TCPServer.new(interface, 0)
        ip = data_server.addr[3]
        port = data_server.addr[1]
        quads = [
          ip.scan(/\d+/),
          port >> 8,
          port & 0xff,
        ].flatten.join(',')
        reply "227 Entering passive mode (#{quads})"
      end
    end

  end

end

Version data entries

11 entries across 11 versions & 2 rubygems

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