]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
python:tests/krb5: add remove_pac_buffers()
authorStefan Metzmacher <metze@samba.org>
Thu, 6 Feb 2025 15:47:30 +0000 (16:47 +0100)
committerRalph Boehme <slow@samba.org>
Mon, 24 Feb 2025 09:27:38 +0000 (09:27 +0000)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
python/samba/tests/krb5/kdc_base_test.py

index 23d2b4b799aeb9b9138c881495fcba13621cacbd..23577dccf12bdf47f4c0d72db72b94d54071e86c 100644 (file)
@@ -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,