]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
tests/krb5: Add method to determine if principal is krbtgt
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Mon, 20 Sep 2021 03:06:18 +0000 (15:06 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 23 Sep 2021 18:32:29 +0000 (18:32 +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 985792887ca9659f33f613b3d2ef7c0f09a733fe..cadf2b50dc90605914d4d38117fc252ef26b3c1d 100644 (file)
@@ -2977,7 +2977,7 @@ class RawKerberosTest(TestCaseInTempDir):
     def verify_ticket(self, ticket, krbtgt_key, expect_pac=True):
         # Check if the ticket is a TGT.
         sname = ticket.ticket['sname']
-        is_tgt = sname['name-string'][0] == b'krbtgt'
+        is_tgt = self.is_tgs(sname)
 
         # Decrypt the ticket.
 
@@ -3371,6 +3371,10 @@ class RawKerberosTest(TestCaseInTempDir):
             krb5pac.PAC_TYPE_KDC_CHECKSUM: krbtgt_key
         }
 
+    def is_tgs(self, principal):
+        name = principal['name-string'][0]
+        return name in ('krbtgt', b'krbtgt')
+
     def get_empty_pac(self):
         return self.AuthorizationData_create(AD_WIN2K_PAC, bytes(1))