Class: BinData::NdrPointerArgProcessor

Inherits:
BaseArgProcessor
  • Object
show all
Defined in:
lib/ruby_smb/dcerpc/ndr.rb

Instance Method Summary collapse

Instance Method Details

#extract_args(obj_class, obj_args) ⇒ Object



1191
1192
1193
1194
# File 'lib/ruby_smb/dcerpc/ndr.rb', line 1191

def extract_args(obj_class, obj_args)
  obj_class = obj_class.superclass if obj_class.superclass.arg_processor == self
  obj_class.superclass.arg_processor.extract_args(obj_class, obj_args)
end

#sanitize_parameters!(obj_class, params) ⇒ Object

Raises:

  • (ArgumentError)


1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
# File 'lib/ruby_smb/dcerpc/ndr.rb', line 1175

def sanitize_parameters!(obj_class, params)
  obj_klass = obj_class
  obj_klass = obj_class.superclass if obj_class.superclass.arg_processor == self
  res = obj_class.superclass.arg_processor.sanitize_parameters!(obj_klass, params)

  return res if obj_class.superclass.default_parameters[:byte_align]
  return res if params[:referent_byte_align]

  raise ArgumentError.new(
    "NDR Pointers referent must have `:byte_align` parameter set. This "\
    "makes sure the whole structure is correctly aligned. Use a predefined "\
    "NDR element instead, or provide the `:referent_byte_align` parameter "\
    "when defining the structure (Faulty pointer class: #{obj_class})"
  )
end