]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
tests/krb5: Allow multiple ticket modification functions
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Thu, 28 Sep 2023 01:52:11 +0000 (14:52 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 28 Sep 2023 03:33:38 +0000 (03:33 +0000)
This means that callers can specify a stack of possible modifications.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/tests/krb5/raw_testcase.py

index 55a8b628c26cfb49abdd363683dc9582054fff76..a3837ff53a012966845851b9bf0aca414ca96c1e 100644 (file)
@@ -5587,7 +5587,7 @@ class RawKerberosTest(TestCase):
             self.assertFalse(checksum_keys)
             self.assertFalse(include_checksums)
 
-        expect_pac = modify_pac_fn is not None
+        expect_pac = bool(modify_pac_fn)
 
         key = ticket.decryption_key
 
@@ -5628,8 +5628,11 @@ class RawKerberosTest(TestCase):
             enc_part, asn1Spec=krb5_asn1.EncTicketPart())
 
         # Modify the ticket here.
-        if modify_fn is not None:
+        if callable(modify_fn):
             enc_part = modify_fn(enc_part)
+        elif modify_fn:
+            for fn in modify_fn:
+                enc_part = fn(enc_part)
 
         auth_data = enc_part.get('authorization-data')
         if expect_pac:
@@ -5649,8 +5652,11 @@ class RawKerberosTest(TestCase):
                     pac = ndr_unpack(krb5pac.PAC_DATA, pac_data)
 
                     # Modify the PAC here.
-                    if modify_pac_fn is not None:
+                    if callable(modify_pac_fn):
                         pac = modify_pac_fn(pac)
+                    elif modify_pac_fn:
+                        for fn in modify_pac_fn:
+                            pac = fn(pac)
 
                     if update_pac_checksums:
                         # Get the enc-part with an empty PAC, which is needed