]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
tests/krb5: Make get_default_enctypes() return a set of enctype constants
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Tue, 21 Sep 2021 05:01:12 +0000 (17:01 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 23 Sep 2021 18:32:29 +0000 (18:32 +0000)
This is often more convenient than a bitfield.

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/kdc_base_test.py

index 59175c7bb2ff1b35d5da7d5b505e07c31814e57f..3d2d20cb65b1d1ccea9ac01e9047fa88978b39f5 100644 (file)
@@ -222,11 +222,11 @@ class KDCBaseTest(RawKerberosTest):
         functional_level = self.get_domain_functional_level(samdb)
 
         # RC4 should always be supported
-        default_enctypes = security.KERB_ENCTYPE_RC4_HMAC_MD5
+        default_enctypes = {kcrypto.Enctype.RC4}
         if functional_level >= DS_DOMAIN_FUNCTION_2008:
             # AES is only supported at functional level 2008 or higher
-            default_enctypes |= security.KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96
-            default_enctypes |= security.KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96
+            default_enctypes.add(kcrypto.Enctype.AES256)
+            default_enctypes.add(kcrypto.Enctype.AES128)
 
         return default_enctypes
 
@@ -513,12 +513,7 @@ class KDCBaseTest(RawKerberosTest):
 
         default_enctypes = self.get_default_enctypes()
 
-        if default_enctypes & security.KERB_ENCTYPE_RC4_HMAC_MD5:
-            self.assertIn(kcrypto.Enctype.RC4, keys)
-        if default_enctypes & security.KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96:
-            self.assertIn(kcrypto.Enctype.AES256, keys)
-        if default_enctypes & security.KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96:
-            self.assertIn(kcrypto.Enctype.AES128, keys)
+        self.assertCountEqual(default_enctypes, keys)
 
         return keys