Class: RubySMB::SMB2::Packet::TreeConnectResponse

Inherits:
GenericPacket
  • Object
show all
Defined in:
lib/ruby_smb/smb2/packet/tree_connect_response.rb

Overview

An SMB2 TreeConnectResponse Packet as defined in 2.2.10 SMB2 TREE_CONNECT Response

Constant Summary collapse

COMMAND =
RubySMB::SMB2::Commands::TREE_CONNECT

Instance Method Summary collapse

Methods inherited from GenericPacket

describe, #display, fields_hashed, format_field, #packet_smb_version, read, #status_code, #valid?, walk_fields

Instance Method Details

#access_rightsRubySMB::SMB2::BitField::DirectoryAccessMask, RubySMB::SMB2::BitField::FileAccessMask

Returns the ACCESS_MASK for the Maximal Share Access Rights. The packet defaults this to a BitField::DirectoryAccessMask. If it is anything other than a directory that has been connected to, it will re-cast it as a BitField::FileAccessMask

Returns:

Raises:



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/ruby_smb/smb2/packet/tree_connect_response.rb', line 30

def access_rights
  if is_directory?
    maximal_access
  else
    mask = maximal_access.to_binary_s
    begin
      RubySMB::SMB2::BitField::FileAccessMask.read(mask)
    rescue IOError
      raise RubySMB::Error::InvalidBitField, 'Invalid ACCESS_MASK for the Maximal Share Access Rights'
    end
  end
end

#initialize_instanceObject



18
19
20
21
# File 'lib/ruby_smb/smb2/packet/tree_connect_response.rb', line 18

def initialize_instance
  super
  smb2_header.flags.reply = 1
end

#is_directory?Boolean

Checks if the remote Tree is a directory

Returns:

  • (Boolean)


46
47
48
# File 'lib/ruby_smb/smb2/packet/tree_connect_response.rb', line 46

def is_directory?
  share_type == 0x01
end