From: Stefan Metzmacher Date: Thu, 6 Feb 2025 15:47:30 +0000 (+0100) Subject: python:tests/krb5: add remove_pac_buffers() X-Git-Tag: tevent-0.17.0~625 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fabf0d1565ab7c9ab89f70ad98616c0161c4c4ff;p=thirdparty%2Fsamba.git python:tests/krb5: add remove_pac_buffers() Signed-off-by: Stefan Metzmacher Reviewed-by: Ralph Boehme --- diff --git a/python/samba/tests/krb5/kdc_base_test.py b/python/samba/tests/krb5/kdc_base_test.py index 23d2b4b799a..23577dccf12 100644 --- a/python/samba/tests/krb5/kdc_base_test.py +++ b/python/samba/tests/krb5/kdc_base_test.py @@ -2362,6 +2362,19 @@ class KDCBaseTest(TestCaseInTempDir, RawKerberosTest): return pac + def remove_pac_buffers(self, pac, *, pac_buffer_type=None): + + old_buffers = pac.buffers + new_buffers = [] + for pac_buffer in old_buffers: + if pac_buffer.type != pac_buffer_type: + new_buffers.append(pac_buffer) + + pac.buffers = new_buffers + pac.num_buffers = len(new_buffers) + + return pac + def get_cached_creds(self, *, account_type: AccountType, opts: Optional[dict]=None,