Class: RubySMB::Dcerpc::Drsr::DrsExtensions

Inherits:
Ndr::NdrStruct
  • Object
show all
Defined in:
lib/ruby_smb/dcerpc/drsr/drs_extensions.rb

Overview

Direct Known Subclasses

DrsExtensionsPtr

Instance Method Summary collapse

Methods inherited from Ndr::NdrStruct

#initialize_shared_instance, method_missing, validate_conformant_array

Instance Method Details

#assign(val) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/ruby_smb/dcerpc/drsr/drs_extensions.rb', line 28

def assign(val)
  case val
  when String
    self.rgb.assign(val.bytes)
  when Array
    self.rgb.assign(val.to_ary)
  when DrsExtensionsInt
    self.rgb.assign(val.to_binary_s[4..-1].bytes)
  when Hash
    if (field_names & val.keys).empty?
      # Cannot assign this hash to the structrue, it is likely
      # DrsExtensionsInt hash values we need to transform in byte array.
      drs_ext = DrsExtensionsInt.new(val).to_binary_s
      self.rgb.assign(drs_ext[4..-1].bytes)
    end
  else
    super
  end
end