diff --git a/tests/test_security.py b/tests/test_security.py index 73ed0dc..443240c 100644 --- a/tests/test_security.py +++ b/tests/test_security.py @@ -28,6 +28,12 @@ def test_empty_security_descriptor(): assert esd.dacl is None assert esd.sacl is None +def test_security_descriptor__str__(): + sddl = "D:(A;;FA;;;WD)" + sd = SecurityDescriptor.from_string(sddl) + assert str(sd) == sddl + + def test_pacl_object(): SDDL = "O:ANG:S-1-2-3D:(A;;;;;S-1-42-42)(A;;;;;S-1-42-43)(A;;;;;S-1-42-44)" diff --git a/windows/security.py b/windows/security.py index 63e5687..a3d62ab 100644 --- a/windows/security.py +++ b/windows/security.py @@ -927,7 +927,7 @@ class SecurityDescriptor(gdef.PSECURITY_DESCRIPTOR): None) result = result_cstr.value # Retrieve a python-str copy winproxy.LocalFree(result_cstr) - return result + return result.decode() __str__ = to_string @@ -1056,7 +1056,7 @@ def explain_acl(acl, sdtype=None): if acl is None: yield u"None" for ace in acl.aces: - yield unicode(ace) + yield str(ace) for line in ACE_EXPLAINER[ace.Header.AceType](ace, sdtype): yield u" " + line