Sha256: 03fa01876a983f7240482fe432742e0c7a460df0786ca25bd42dfc0e1a1f42dc
Contents?: true
Size: 1.46 KB
Versions: 34
Compression:
Stored size: 1.46 KB
Contents
module RubySMB module SMB1 module Packet module Trans2 # Extends the {RubySMB::SMB1::DataBlock} to include padding methods # that all Trans2 DataBlocks will need to handle proper byte alignment. class DataBlock < RubySMB::SMB1::DataBlock # Controls whether the padding fields will be used # @!attribute [rw] enable_padding # @return [Boolean] attr_accessor :enable_padding def initialize_instance super @enable_padding = true end private # Determines the correct length for the padding in front of # #trans2_parameters. It should always force a 4-byte alignment. def pad1_length if enable_padding offset = if respond_to?(:name) (name.abs_offset + 1) % 4 else (byte_count.abs_offset + 2) % 4 end (4 - offset) % 4 else 0 end end # Determines the correct length for the padding in front of # #trans2_data. It should always force a 4-byte alignment. def pad2_length if enable_padding offset = (trans2_parameters.abs_offset + trans2_parameters.length) % 4 (4 - offset) % 4 else 0 end end end end end end end
Version data entries
34 entries across 34 versions & 1 rubygems