Class: RubySMB::Server::Share::Provider::Disk::Processor

Inherits:
Processor::Base show all
Includes:
Close, Create, Query, Read
Defined in:
lib/ruby_smb/server/share/provider/disk/processor.rb,
lib/ruby_smb/server/share/provider/disk/processor/read.rb,
lib/ruby_smb/server/share/provider/disk/processor/close.rb,
lib/ruby_smb/server/share/provider/disk/processor/query.rb,
lib/ruby_smb/server/share/provider/disk/processor/create.rb

Defined Under Namespace

Modules: Close, Create, Query, Read Classes: Handle

Instance Attribute Summary

Attributes inherited from Processor::Base

#provider

Instance Method Summary collapse

Methods included from Read

#do_read_andx_smb1, #do_read_smb2

Methods included from Query

#do_query_directory_smb2, #do_query_info_smb2, #do_transactions2_smb1

Methods included from Create

#do_create_smb2, #do_nt_create_andx_smb1

Methods included from Close

#do_close_smb1, #do_close_smb2

Methods inherited from Processor::Base

#disconnect!, #do_close_smb1, #do_close_smb2, #do_create_smb2, #do_ioctl_smb2, #do_nt_create_andx_smb1, #do_query_directory_smb2, #do_query_info_smb2, #do_read_andx_smb1, #do_read_smb2, #do_transactions2_smb1, #logger, #server, #share_io

Constructor Details

#initialize(provider, server_client, session) ⇒ Processor

Returns a new instance of Processor.



21
22
23
24
25
# File 'lib/ruby_smb/server/share/provider/disk/processor.rb', line 21

def initialize(provider, server_client, session)
  super
  @handles = {}
  @query_directory_context = {}
end

Instance Method Details

#maximal_access(path = nil) ⇒ Object



27
28
29
30
31
32
# File 'lib/ruby_smb/server/share/provider/disk/processor.rb', line 27

def maximal_access(path=nil)
  RubySMB::SMB2::BitField::FileAccessMask.new(
    read_attr: 1,
    read_data: 1
  )
end

#smb2_access_mask(path) ⇒ DirectoryAccessMask, FileAccessMask

Build an access mask bit field for the specified path. The return type is a DirectoryAccessMask if path is a directory, otherwise it's a FileAccessMask.

Parameters:

  • Pathname

    path the path to build an access mask for

Returns:

  • (DirectoryAccessMask, FileAccessMask)

    the access mask



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/ruby_smb/server/share/provider/disk/processor.rb', line 39

def smb2_access_mask(path)
  # see: https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-smb2/b3af3aaf-9271-4419-b326-eba0341df7d2
  if path.directory?
    am = SMB2::BitField::DirectoryAccessMask.new
    am.traverse = true
    am.list = true
  else
    am = SMB2::BitField::FileAccessMask.new
    am.read_data = true
  end
  am.read_attr = true
  am
end