From a107bb8b0d424bb1f8ee6df34e8f8e81dd499333 Mon Sep 17 00:00:00 2001 From: Joseph Sutton Date: Thu, 16 Dec 2021 10:18:42 +1300 Subject: [PATCH] tests/krb5: Generate unique UPNs for AS-REQ enterprise tests This helps to avoid problems with account creation due to UPN uniqueness constraints. Signed-off-by: Joseph Sutton Reviewed-by: Stefan Metzmacher --- python/samba/tests/krb5/as_req_tests.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/python/samba/tests/krb5/as_req_tests.py b/python/samba/tests/krb5/as_req_tests.py index 263e77d4812..b52937530e6 100755 --- a/python/samba/tests/krb5/as_req_tests.py +++ b/python/samba/tests/krb5/as_req_tests.py @@ -345,9 +345,10 @@ class AsReqKerberosTests(AsReqBaseTest): expect_edata=False) def test_as_req_enterprise_canon(self): + upn = self.get_new_username() client_creds = self.get_cached_creds( account_type=self.AccountType.USER, - opts={'upn': 'krb5_enterprise0'}) + opts={'upn': upn}) user_name = client_creds.get_username() realm = client_creds.get_realm() @@ -365,9 +366,10 @@ class AsReqKerberosTests(AsReqBaseTest): kdc_options=krb5_asn1.KDCOptions('canonicalize')) def test_as_req_enterprise_canon_case(self): + upn = self.get_new_username() client_creds = self.get_cached_creds( account_type=self.AccountType.USER, - opts={'upn': 'krb5_enterprise1'}) + opts={'upn': upn}) user_name = client_creds.get_username() realm = client_creds.get_realm().lower() @@ -385,9 +387,10 @@ class AsReqKerberosTests(AsReqBaseTest): kdc_options=krb5_asn1.KDCOptions('canonicalize')) def test_as_req_enterprise_canon_mac(self): + upn = self.get_new_username() client_creds = self.get_cached_creds( account_type=self.AccountType.COMPUTER, - opts={'upn': 'krb5_enterprise2'}) + opts={'upn': upn}) user_name = client_creds.get_username() realm = client_creds.get_realm() @@ -405,9 +408,10 @@ class AsReqKerberosTests(AsReqBaseTest): kdc_options=krb5_asn1.KDCOptions('canonicalize')) def test_as_req_enterprise_canon_mac_case(self): + upn = self.get_new_username() client_creds = self.get_cached_creds( account_type=self.AccountType.COMPUTER, - opts={'upn': 'krb5_enterprise3'}) + opts={'upn': upn}) user_name = client_creds.get_username() realm = client_creds.get_realm().lower() @@ -425,9 +429,10 @@ class AsReqKerberosTests(AsReqBaseTest): kdc_options=krb5_asn1.KDCOptions('canonicalize')) def test_as_req_enterprise_no_canon(self): + upn = self.get_new_username() client_creds = self.get_cached_creds( account_type=self.AccountType.USER, - opts={'upn': 'krb5_enterprise4'}) + opts={'upn': upn}) user_name = client_creds.get_username() realm = client_creds.get_realm() @@ -440,9 +445,10 @@ class AsReqKerberosTests(AsReqBaseTest): kdc_options=0) def test_as_req_enterprise_no_canon_case(self): + upn = self.get_new_username() client_creds = self.get_cached_creds( account_type=self.AccountType.USER, - opts={'upn': 'krb5_enterprise5'}) + opts={'upn': upn}) user_name = client_creds.get_username() realm = client_creds.get_realm().lower() @@ -455,9 +461,10 @@ class AsReqKerberosTests(AsReqBaseTest): kdc_options=0) def test_as_req_enterprise_no_canon_mac(self): + upn = self.get_new_username() client_creds = self.get_cached_creds( account_type=self.AccountType.COMPUTER, - opts={'upn': 'krb5_enterprise6'}) + opts={'upn': upn}) user_name = client_creds.get_username() realm = client_creds.get_realm() @@ -470,9 +477,10 @@ class AsReqKerberosTests(AsReqBaseTest): kdc_options=0) def test_as_req_enterprise_no_canon_mac_case(self): + upn = self.get_new_username() client_creds = self.get_cached_creds( account_type=self.AccountType.COMPUTER, - opts={'upn': 'krb5_enterprise7'}) + opts={'upn': upn}) user_name = client_creds.get_username() realm = client_creds.get_realm().lower()