]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
tests/krb5: Don't include empty AD-IF-RELEVANT
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Tue, 28 Sep 2021 23:07:40 +0000 (12:07 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 14 Oct 2021 18:59:31 +0000 (18:59 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14642

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

index 2e289c90ce7953ee658dccae2ea41aa8a685ab24..e008223eb23cb6dfb6ac9c24c537e98b5b0ee19e 100644 (file)
@@ -3424,14 +3424,19 @@ class RawKerberosTest(TestCaseInTempDir):
                 if expect_pac:
                     self.assertIsNotNone(old_pac, 'Expected PAC')
 
-                ad_relevant = self.der_encode(
-                    relevant_elems,
-                    asn1Spec=krb5_asn1.AD_IF_RELEVANT())
-
-                authdata_elem = self.AuthorizationData_create(AD_IF_RELEVANT,
-                                                              ad_relevant)
+                if relevant_elems:
+                    ad_relevant = self.der_encode(
+                        relevant_elems,
+                        asn1Spec=krb5_asn1.AD_IF_RELEVANT())
+
+                    authdata_elem = self.AuthorizationData_create(
+                        AD_IF_RELEVANT,
+                        ad_relevant)
+                else:
+                    authdata_elem = None
 
-            new_auth_data.append(authdata_elem)
+            if authdata_elem is not None:
+                new_auth_data.append(authdata_elem)
 
         if expect_pac:
             self.assertIsNotNone(ad_relevant, 'Expected AD-RELEVANT')