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



1201
1202
1203
1204
# File 'lib/ruby_smb/dcerpc/ndr.rb', line 1201

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)


1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
# File 'lib/ruby_smb/dcerpc/ndr.rb', line 1185

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