Sha256: 362f3c6c75445cada223c214142cb9394b2c224c7fa8c5c3a1ec34eeadf08d4b

Contents?: true

Size: 745 Bytes

Versions: 6

Compression:

Stored size: 745 Bytes

Contents

require_relative 'command_handler'

module Ftpd

  class CmdProt < CommandHandler

    def cmd_prot(level_arg)
      level_code = level_arg.upcase
      unless protection_buffer_size_set
        error "PROT must be preceded by PBSZ", 503
      end
      level = DATA_CHANNEL_PROTECTION_LEVELS[level_code]
      unless level
        error "Unknown protection level", 504
      end
      unless level == :private
        error "Unsupported protection level #{level}", 536
      end
      self.data_channel_protection_level = level
      reply "200 Data protection level #{level_code}"
    end

    private

    DATA_CHANNEL_PROTECTION_LEVELS = {
      'C'=>:clear,
      'S'=>:safe,
      'E'=>:confidential,
      'P'=>:private
    }

  end

end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
ftpd-1.1.1 lib/ftpd/cmd_prot.rb
ftpd-1.1.0 lib/ftpd/cmd_prot.rb
investtools-ftpd-1.0.1 lib/ftpd/cmd_prot.rb
ftpd-1.0.1 lib/ftpd/cmd_prot.rb
ftpd-1.0.0 lib/ftpd/cmd_prot.rb
ftpd-0.17.0 lib/ftpd/cmd_prot.rb