]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
tests/krb5: Allow passing expected etypes to get_keys()
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Mon, 11 Apr 2022 03:43:00 +0000 (15:43 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 5 May 2022 00:27:33 +0000 (00:27 +0000)
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/tests/krb5/kdc_base_test.py
python/samba/tests/krb5/protected_users_tests.py

index 16e3f7a6a734e25f45f4648ae09c01063fb0e727..7d180380d13ea27daaaf42a5f965bfbd6457b30c 100644 (file)
@@ -561,7 +561,7 @@ class KDCBaseTest(RawKerberosTest):
 
         return bind, identifier, attributes
 
-    def get_keys(self, samdb, dn):
+    def get_keys(self, samdb, dn, expected_etypes=None):
         admin_creds = self.get_admin_creds()
 
         bind, identifier, attributes = self.get_secrets(
@@ -599,9 +599,10 @@ class KDCBaseTest(RawKerberosTest):
                 pwd = attr.value_ctr.values[0].blob
                 keys[kcrypto.Enctype.RC4] = pwd.hex()
 
-        default_enctypes = self.get_default_enctypes()
+        if expected_etypes is None:
+            expected_etypes = self.get_default_enctypes()
 
-        self.assertCountEqual(default_enctypes, keys)
+        self.assertCountEqual(expected_etypes, keys)
 
         return keys
 
index dfa6021453fd9e455facbad0ccdf547e3afa7769..a03ccaf0c66d40b65c624f7fef145d05600ead1d 100755 (executable)
@@ -384,11 +384,10 @@ class ProtectedUsersTests(KDCBaseTest):
 
         client_creds.set_password(new_password)
 
-        keys = self.get_keys(samdb, client_dn)
-        self.assertEqual({kcrypto.Enctype.AES256,
-                          kcrypto.Enctype.AES128,
-                          kcrypto.Enctype.RC4},
-                         keys.keys())
+        self.get_keys(samdb, client_dn,
+                      expected_etypes={kcrypto.Enctype.AES256,
+                                       kcrypto.Enctype.AES128,
+                                       kcrypto.Enctype.RC4})
 
     # Test that DES-CBC-CRC cannot be used whether or not the user is
     # protected.