From d054f583ead4c4a41d235db463dc968d67039313 Mon Sep 17 00:00:00 2001 From: Joseph Sutton Date: Thu, 28 Sep 2023 14:52:11 +1300 Subject: [PATCH] tests/krb5: Allow multiple ticket modification functions This means that callers can specify a stack of possible modifications. Signed-off-by: Andrew Bartlett Signed-off-by: Joseph Sutton Reviewed-by: Andrew Bartlett --- python/samba/tests/krb5/raw_testcase.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/python/samba/tests/krb5/raw_testcase.py b/python/samba/tests/krb5/raw_testcase.py index 55a8b628c26..a3837ff53a0 100644 --- a/python/samba/tests/krb5/raw_testcase.py +++ b/python/samba/tests/krb5/raw_testcase.py @@ -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