pytest: conditional_ace_claims: write_c_test_on_failure() copes with claims
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Mon, 13 Nov 2023 00:34:57 +0000 (13:34 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 27 Nov 2023 22:37:32 +0000 (22:37 +0000)
*copes badly, but better than crashing.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/tests/conditional_ace_claims.py

index 9b2aaef259fa515ca0e2a833f29dc33712db8c6c..e7fef5aed437015215bcc1e7f1cb70ba250e3d97 100644 (file)
@@ -20,6 +20,7 @@
 from samba.dcerpc import security
 from samba.security import access_check
 from samba.tests.token_factory import token as Token
+from samba.dcerpc.security import CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1
 from samba.tests import TestCase, DynamicTestCase, get_env_dir
 from samba.colour import c_RED, c_GREEN
 import os
@@ -73,10 +74,14 @@ def write_c_test_on_failure(f):
                 if s in token:
                     macro = s.upper()
                     for name, values in token[s].items():
-                        if not isinstance(values, (list, tuple)):
-                            values = [values]
-                        v = ', '.join(q(x) for x in values)
-                        v = q(f"{v}")
+                        if isinstance(values,
+                                      CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1):
+                            v = '...'
+                        else:
+                            if not isinstance(values, (list, tuple)):
+                                values = [values]
+                            v = ', '.join(q(x) for x in values)
+                            v = q(f"{v}")
                         print(f'\t{macro}({q(name)}, {v});')
             print(f'\tSD({q(sddl)});')
             if 'allow' in f.__name__: