class RubySMB::SMB1::Packet::TreeConnectResponse

A SMB1 TreeConnect Response Packet as defined in [2.2.4.7.2 Server Response Extensions](msdn.microsoft.com/en-us/library/cc246331.aspx)

Constants

COMMAND

Public Instance Methods

access_rights() click to toggle source

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

@return [RubySMB::SMB1::BitField::DirectoryAccessMask] if a directory was connected to @return [RubySMB::SMB1::BitField::FileAccessMask] if anything else was connected to @raise [RubySMB::Error::InvalidBitField] if ACCESS_MASK bit field is not valid

# File lib/ruby_smb/smb1/packet/tree_connect_response.rb, line 39
def access_rights
  if is_directory?
    parameter_block.access_rights
  else
    mask = parameter_block.access_rights.to_binary_s
    begin
      RubySMB::SMB1::BitField::FileAccessMask.read(mask)
    rescue IOError
      raise RubySMB::Error::InvalidBitField, 'Invalid ACCESS_MASK for the Maximal Share Access Rights'
    end
  end
end
guest_access_rights() click to toggle source

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

@return [RubySMB::SMB1::BitField::DirectoryAccessMask] if a directory was connected to @return [RubySMB::SMB1::BitField::FileAccessMask] if anything else was connected to

# File lib/ruby_smb/smb1/packet/tree_connect_response.rb, line 58
def guest_access_rights
  if is_directory?
    parameter_block.guest_access_rights
  else
    mask = parameter_block.guest_access_rights.to_binary_s
    begin
      RubySMB::SMB1::BitField::FileAccessMask.read(mask)
    rescue IOError
      raise RubySMB::Error::InvalidBitField, 'Invalid ACCESS_MASK for the Guest Share Access Rights'
    end
  end
end
initialize_instance() click to toggle source
# File lib/ruby_smb/smb1/packet/tree_connect_response.rb, line 27
def initialize_instance
  super
  smb_header.flags.reply = 1
end
is_directory?() click to toggle source

Checks whether the response is for a Directory This alters the type of access mask that is used.

@return [TrueClass] if service is 'A:' @return [FalseClass] if service is NOT 'A:'

# File lib/ruby_smb/smb1/packet/tree_connect_response.rb, line 76
def is_directory?
  data_block.service == 'A:'
end