Skip to content

Commit

Permalink
Merge pull request #16 from YakDriver/nomapping2
Browse files Browse the repository at this point in the history
Handle orphan SID error (< Win16)
  • Loading branch information
YakDriver authored Apr 21, 2020
2 parents 4a38cc9 + e6ae128 commit 6b89b21
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.2.1
current_version = 0.2.2
commit = False
tag = False
tag_name = {new_version}
Expand Down
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
## Changelog

### 0.2.1
### 0.2.2

**Commit Delta**: [Change from 0.2.0 release](https://github.com/YakDriver/oschmod/compare/0.2.0...0.2.1)
**Commit Delta**: [Change from 0.2.0 release](https://github.com/YakDriver/oschmod/compare/0.2.0...0.2.2)

**Released**: 2020.04.20
**Released**: 2020.04.21

**Summary**:

Expand Down
12 changes: 8 additions & 4 deletions oschmod/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
try:
import ntsecuritycon # noqa: F401
import win32security # noqa: F401
from pywintypes import error as pywinerror
HAS_PYWIN32 = True
except ImportError:
pass
Expand Down Expand Up @@ -152,7 +153,7 @@
"S_IXOTH"
)

__version__ = "0.2.1"
__version__ = "0.2.2"


def get_mode(path):
Expand Down Expand Up @@ -349,9 +350,12 @@ def _win_set_permissions(path, mode, object_type):
system_ace = None
for _ in range(0, dacl.GetAceCount()):
ace = dacl.GetAce(0)
if ace[2] and ace[2].IsValid() and win32security.LookupAccountSid(
None, ace[2]) == SECURITY_NT_AUTHORITY:
system_ace = ace
try:
if ace[2] and ace[2].IsValid() and win32security.LookupAccountSid(
None, ace[2]) == SECURITY_NT_AUTHORITY:
system_ace = ace
except pywinerror:
print("Found orphaned SID:", ace[2])
dacl.DeleteAce(0)

if system_ace:
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = oschmod
description = Windows and Linux compatible chmod
long_description = file: README.md, CHANGELOG.md
long_description_content_type = text/markdown
version = 0.2.1
version = 0.2.2
author = YakDriver
author_email = [email protected]
url = https://github.com/yakdriver/oschmod
Expand Down

0 comments on commit 6b89b21

Please sign in to comment.