Skip to content

Commit

Permalink
Use correct permissions for read/write/delete directories
Browse files Browse the repository at this point in the history
  • Loading branch information
dwelch-r7 committed Feb 29, 2024
1 parent e2c42f9 commit dde99be
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions lib/ruby_smb/smb2/tree.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,22 @@ def open_directory_packet(directory: nil, disposition: RubySMB::Dispositions::FI
create_request.create_options.directory_file = 1
create_request.file_attributes.directory = 1
create_request.desired_access.list = 1
create_request.share_access.read_access = 1 if read
create_request.share_access.write_access = 1 if write
create_request.share_access.delete_access = 1 if delete
create_request.create_disposition = disposition

if read
create_request.share_access.read_access = 1
create_request.desired_access.read_attr = 1
end

if write
create_request.share_access.write_access = 1
end

if delete
create_request.share_access.delete_access = 1
create_request.desired_access.delete_access = 1
end

if directory.nil? || directory.empty?
create_request.name = "\x00"
create_request.name_length = 0
Expand Down

0 comments on commit dde99be

Please sign in to comment.