diff options
author | Douglas Bagnall <douglas.bagnall@catalyst.net.nz> | 2023-04-15 20:32:30 +1200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2023-04-28 02:15:36 +0000 |
commit | 97353c00917c7313ba91c4d424e4358ecf9eead4 (patch) | |
tree | 16175f4d3a9d0a112d610e0cd0fc47ce22983a5b /python | |
parent | fb588d768be91b7d1618a9e69d48ae6a2a23dbec (diff) | |
download | samba-97353c00917c7313ba91c4d424e4358ecf9eead4.tar.gz |
pytest:sddl: SDDL strings where Windows behaviour differs
These ones we might want to match. They are understandable behaviours,
like matching lowercase flags and coping with whitespace in some
places. These tests are set up to document the differences without
overwhelming the knownfails.
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'python')
-rw-r--r-- | python/samba/tests/sddl.py | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/python/samba/tests/sddl.py b/python/samba/tests/sddl.py index 228829bea30..63883334755 100644 --- a/python/samba/tests/sddl.py +++ b/python/samba/tests/sddl.py @@ -549,6 +549,68 @@ class SddlShouldFail(SddlDecodeEncodeBase): @DynamicTestCase +class SddlWindowsIsFussy(SddlDecodeEncodeBase): + """Windows won't accept these strings, seemingly for semantic rather than + syntactic reasons. + """ + name = "windows_is_fussy" + should_succeed = True + strings = [ + # Windows doesn't seem to want AU type in DACL. + ("D:(A;;RP;;;WD)" + "(AU;SA;CR;;;BA)" + "(AU;SA;CR;;;DU)"), + ] + + +@DynamicTestCase +class SddlWindowsIsLessFussy(SddlDecodeEncodeBase): + """Windows will accept these seemingly malformed strings, but Samba + won't. + """ + name = "windows_is_less_fussy" + should_succeed = False + strings = [ + # whitespace is ignored, repaired on return + ("D:(A;;GA;;; LG)", "D:(A;;GA;;;LG)"), + ("D: (A;;GA;;;LG)", "D:(A;;GA;;;LG)"), + # whitespace before string flags is ignored. + ("D:(A;; GA;;;LG)", "D:(A;;GA;;;LG)"), + # wrong case on type is ignored, fixed + ("D:(a;;GA;;;LG)", "D:(A;;GA;;;LG)"), + ("D:(A;;GA;;;lg)", "D:(A;;GA;;;LG)"), + ("D:(A;;ga;;;LG)", "D:(A;;GA;;;LG)"), + ("D: S:","D:S:"), + + # whitespace around ACL flags + ("D: P(A;;GA;;;LG)", "D:P(A;;GA;;;LG)"), + ("D:P (A;;GA;;;LG)", "D:P(A;;GA;;;LG)"), + + # whitespace between ACES + ("D:P(A;;GA;;;LG) (A;;GX;;;AA)", + "D:P(A;;GA;;;LG)(A;;GX;;;AA)"), + + # whitespace in absent ace flags + ("D:(A; ;GA;;;LG)","D:(A;;GA;;;LG)"), + + # and more whitespace. + ("D:(A;;GA;;; WD)", "D:(A;;GA;;;WD)"), + ("D:(A;;GA;;;WD )", "D:(A;;GA;;;WD)"), + ("D:(A;;GA;;; S-1-3-4)", "D:(A;;GA;;;OW)"), + ("D:(A;;GA;; ;S-1-3-4)", "D:(A;;GA;;;OW)"), + ("D:(A;;GA; ;;S-1-3-4)", "D:(A;;GA;;;OW)"), + ("D:(A;;GA;;; S-1-333-4)", "D:(A;;GA;;;S-1-333-4)"), + ("D:(A;;GA; ;;S-1-333-4)", "D:(A;;GA;;;S-1-333-4)"), + (" O:AA", "O:AA"), + (" O:AA ", "O:AA"), + (" O:AA G:WD ", "O:AAG:WD"), + + # spaces in some parts of the SID (not subauth) + ("O:S- 1- 2-3", "O:S-1-2-3"), + ] + + +@DynamicTestCase class SddlWindowsIsWeird(SddlDecodeEncodeBase): """Windows will accept some very misleading SDDL strings. """ |