1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

pytest:sid_strings: Windows and Samba divergent tests

The Samba side is aspirational -- what we actually do is generally
worse. However the Windows behaviour in these cases seems more
surprising still, and seems to be neither documented nor used.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Douglas Bagnall 2023-04-12 13:31:40 +12:00 committed by Andrew Bartlett
parent 2d75daa9c4
commit f66b0f8688
2 changed files with 92 additions and 0 deletions

View File

@ -352,6 +352,53 @@ class SidStringsThatStartWithS(SidStringBase):
}
@DynamicTestCase
class SidStringBehavioursThatWindowsAllows(SidStringBase):
"""Windows interpretations that we probably don't want to follow"""
cases = {
# saturating sub-auth values at 32 bits
'S-1-5-9999999999-579': 'S-1-5-4294967295-579',
'S-1-0x500000000-0x500000000-579': 'S-1-0x500000000-4294967295-579',
'S-1-5-11111111111111111111111111111111111-579': 'S-1-5-4294967295-579',
f'S-1-5-{(1 << 64) - 1}-579': 'S-1-5-4294967295-579',
f'S-1-5-{1 << 64}-579': 'S-1-5-4294967295-579',
# S-0x1- ?! on Windows this makes everything else a hex number.
'S-0x1-5-40-579': 'S-1-5-64-1401',
'S-0x1-0-0-579': 'S-1-0-0-1401',
'S-0x1-500000000-20-243': 'S-1-0x500000000-32-579',
'S-0x1-5-20-243': 'S-1-5-32-579',
'S-0x1-0x5-020-0243': 'S-1-5-32-579',
'S-1-0xABcDef123-0xABCDef123-579': 'S-1-0xabcdef123-4294967295-579',
'S-0-5-32-579': late_ERR_CONSTRAINT_VIOLATION,
'S-2-5-32-579': late_ERR_CONSTRAINT_VIOLATION,
'S-10-5-32-579': late_ERR_CONSTRAINT_VIOLATION,
}
@DynamicTestCase
class SidStringBehavioursThatSambaPrefers(SidStringBase):
"""Aspirational alternative answers to the
SidStringBehavioursThatWindowsAllows cases."""
cases = {
'S-1-5-9999999999-579': ldb.ERR_UNWILLING_TO_PERFORM,
'S-1-0x500000000-0x500000000-579': ldb.ERR_UNWILLING_TO_PERFORM,
'S-1-5-11111111111111111111111111111111111-579': ldb.ERR_UNWILLING_TO_PERFORM,
f'S-1-5-{(1 << 64) - 1}-579': ldb.ERR_UNWILLING_TO_PERFORM,
f'S-1-5-{1 << 64}-579': ldb.ERR_UNWILLING_TO_PERFORM,
'S-0x1-5-40-579': ldb.ERR_UNWILLING_TO_PERFORM,
'S-0x1-0-0-579': ldb.ERR_UNWILLING_TO_PERFORM,
'S-0x1-500000000-20-243': ldb.ERR_UNWILLING_TO_PERFORM,
'S-0x1-5-20-243': ldb.ERR_UNWILLING_TO_PERFORM,
'S-0x1-0x5-020-0243': ldb.ERR_UNWILLING_TO_PERFORM,
'S-1-0xABcDef123-0xABCDef123-579': ldb.ERR_UNWILLING_TO_PERFORM,
'S-0-5-32-579': ldb.ERR_UNWILLING_TO_PERFORM,
'S-2-5-32-579': ldb.ERR_UNWILLING_TO_PERFORM,
'S-10-5-32-579': ldb.ERR_UNWILLING_TO_PERFORM,
}
if __name__ == '__main__':
global_asn1_print = False
global_hexdump = False

View File

@ -1,3 +1,48 @@
^samba.tests.sid_strings.+.SidStringBehavioursThatSambaPrefers.test_sid_string_S-0-5-32-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatSambaPrefers.test_sid_string_S-0x1-0-0-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatSambaPrefers.test_sid_string_S-0x1-0x5-020-0243.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatSambaPrefers.test_sid_string_S-0x1-5-20-243.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatSambaPrefers.test_sid_string_S-0x1-5-40-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatSambaPrefers.test_sid_string_S-0x1-500000000-20-243.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatSambaPrefers.test_sid_string_S-1-0x500000000-0x500000000-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatSambaPrefers.test_sid_string_S-1-0xABcDef123-0xABCDef123-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatSambaPrefers.test_sid_string_S-1-5-11111111111111111111111111111111111-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatSambaPrefers.test_sid_string_S-1-5-18446744073709551615-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatSambaPrefers.test_sid_string_S-1-5-18446744073709551616-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatSambaPrefers.test_sid_string_S-1-5-9999999999-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatSambaPrefers.test_sid_string_S-10-5-32-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatSambaPrefers.test_sid_string_S-2-5-32-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatSambaPrefers.test_sid_string_internal_S-0-5-32-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatSambaPrefers.test_sid_string_internal_S-10-5-32-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatSambaPrefers.test_sid_string_internal_S-2-5-32-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatWindowsAllows.test_sid_string_S-0-5-32-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatWindowsAllows.test_sid_string_S-0x1-0-0-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatWindowsAllows.test_sid_string_S-0x1-0x5-020-0243.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatWindowsAllows.test_sid_string_S-0x1-5-20-243.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatWindowsAllows.test_sid_string_S-0x1-5-40-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatWindowsAllows.test_sid_string_S-0x1-500000000-20-243.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatWindowsAllows.test_sid_string_S-1-0x500000000-0x500000000-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatWindowsAllows.test_sid_string_S-1-0xABcDef123-0xABCDef123-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatWindowsAllows.test_sid_string_S-1-5-11111111111111111111111111111111111-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatWindowsAllows.test_sid_string_S-1-5-18446744073709551615-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatWindowsAllows.test_sid_string_S-1-5-18446744073709551616-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatWindowsAllows.test_sid_string_S-1-5-9999999999-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatWindowsAllows.test_sid_string_S-10-5-32-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatWindowsAllows.test_sid_string_S-2-5-32-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatWindowsAllows.test_sid_string_internal_S-0-5-32-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatWindowsAllows.test_sid_string_internal_S-0x1-0-0-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatWindowsAllows.test_sid_string_internal_S-0x1-0x5-020-0243.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatWindowsAllows.test_sid_string_internal_S-0x1-5-20-243.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatWindowsAllows.test_sid_string_internal_S-0x1-5-40-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatWindowsAllows.test_sid_string_internal_S-0x1-500000000-20-243.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatWindowsAllows.test_sid_string_internal_S-1-0x500000000-0x500000000-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatWindowsAllows.test_sid_string_internal_S-1-0xABcDef123-0xABCDef123-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatWindowsAllows.test_sid_string_internal_S-1-5-11111111111111111111111111111111111-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatWindowsAllows.test_sid_string_internal_S-1-5-18446744073709551615-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatWindowsAllows.test_sid_string_internal_S-1-5-18446744073709551616-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatWindowsAllows.test_sid_string_internal_S-1-5-9999999999-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatWindowsAllows.test_sid_string_internal_S-10-5-32-579.ad_dc
^samba.tests.sid_strings.+.SidStringBehavioursThatWindowsAllows.test_sid_string_internal_S-2-5-32-579.ad_dc
^samba.tests.sid_strings.+.SidStringTests.test_sid_string_Aa.ad_dc
^samba.tests.sid_strings.+.SidStringTests.test_sid_string_aA.ad_dc
^samba.tests.sid_strings.+.SidStringTests.test_sid_string_aa.ad_dc