1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

tests/krb5: Allow passing expected etypes to get_keys()

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Joseph Sutton 2022-04-11 15:43:00 +12:00 committed by Andrew Bartlett
parent c294f72911
commit 2f17cbf3b2
2 changed files with 8 additions and 8 deletions

View 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

View File

@ -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.