Sha256: 5de451c743724b0a1f16a993cd2595a8f45c553e7a95137cffb81049ab52d07e

Contents?: true

Size: 742 Bytes

Versions: 5

Compression:

Stored size: 742 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 "503 PROT must be preceded by PBSZ"
      end
      level = DATA_CHANNEL_PROTECTION_LEVELS[level_code]
      unless level
        error "504 Unknown protection level"
      end
      unless level == :private
        error "536 Unsupported protection level #{level}"
      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

5 entries across 5 versions & 1 rubygems

Version Path
ftpd-0.16.0 lib/ftpd/cmd_prot.rb
ftpd-0.15.0 lib/ftpd/cmd_prot.rb
ftpd-0.14.0 lib/ftpd/cmd_prot.rb
ftpd-0.13.0 lib/ftpd/cmd_prot.rb
ftpd-0.12.0 lib/ftpd/cmd_prot.rb