Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dont assume everyone ace exists #11

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions fs/smbfs/smbfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ def _make_access_from_sd(cls, sd):
# * `everyone` (used for UNIX `others` mode)
# * `owner` (used for UNIX `user` mode, falls back to `everyone`)
# * `group` (used for UNIX `group` mode, falls back to `everyone`)
other_ace = next(ace for ace in sd.dacl.aces
if str(ace.sid).startswith(smb.security_descriptors.SID_EVERYONE))
other_ace = next((ace for ace in sd.dacl.aces
if str(ace.sid).startswith(smb.security_descriptors.SID_EVERYONE)), None)
owner_ace = next((ace for ace in sd.dacl.aces
if str(ace.sid).startswith(str(sd.owner))), other_ace)
group_ace = next((ace for ace in sd.dacl.aces
Expand All @@ -170,10 +170,11 @@ def _make_access_from_sd(cls, sd):
}

# Defines the mask used for each mode
other_mask = other_ace.mask if other_ace is not None else 0x0
modes = {
'u': owner_ace.mask,
'g': group_ace.mask,
'o': other_ace.mask,
'u': (owner_ace.mask if owner_ace is not None else 0x0) | other_mask,
'g': (group_ace.mask if group_ace is not None else 0x0) | other_mask,
'o': other_mask,
}

# Create the permissions from a permission list
Expand Down