Class: RubySMB::SMB1::Packet::TreeConnectResponse
- Inherits:
-
GenericPacket
- Object
- BinData::Record
- GenericPacket
- RubySMB::SMB1::Packet::TreeConnectResponse
- Defined in:
- lib/ruby_smb/smb1/packet/tree_connect_response.rb
Overview
A SMB1 TreeConnect Response Packet as defined in 2.2.4.7.2 Server Response Extensions
Defined Under Namespace
Classes: DataBlock, ParameterBlock
Constant Summary collapse
- COMMAND =
RubySMB::SMB1::Commands::SMB_COM_TREE_CONNECT
Instance Method Summary collapse
-
#access_rights ⇒ RubySMB::SMB1::BitField::DirectoryAccessMask, RubySMB::SMB1::BitField::FileAccessMask
Returns the ACCESS_MASK for the Maximal Share Access Rights.
-
#guest_access_rights ⇒ RubySMB::SMB1::BitField::DirectoryAccessMask, RubySMB::SMB1::BitField::FileAccessMask
Returns the ACCESS_MASK for the Guest Share Access Rights.
- #initialize_instance ⇒ Object
-
#is_directory? ⇒ TrueClass, FalseClass
Checks whether the response is for a Directory This alters the type of access mask that is used.
Methods inherited from GenericPacket
describe, #display, fields_hashed, format_field, from_hex, #packet_smb_version, read, #status_code, #valid?, walk_fields
Instance Method Details
#access_rights ⇒ RubySMB::SMB1::BitField::DirectoryAccessMask, RubySMB::SMB1::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 {}RubySMB::SMB1::BitField::FileAccessMask}
39 40 41 42 43 44 45 46 47 48 49 50 |
# 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 ⇒ RubySMB::SMB1::BitField::DirectoryAccessMask, RubySMB::SMB1::BitField::FileAccessMask
Returns the ACCESS_MASK for the Guest 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
58 59 60 61 62 63 64 65 66 67 68 69 |
# 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 ⇒ Object
27 28 29 30 |
# File 'lib/ruby_smb/smb1/packet/tree_connect_response.rb', line 27 def initialize_instance super smb_header.flags.reply = 1 end |
#is_directory? ⇒ TrueClass, FalseClass
Checks whether the response is for a Directory This alters the type of access mask that is used.
76 77 78 |
# File 'lib/ruby_smb/smb1/packet/tree_connect_response.rb', line 76 def is_directory? data_block.service == 'A:' end |