tests/krb5: Use admin creds for SamDB rather than user creds
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Wed, 16 Jun 2021 00:52:11 +0000 (12:52 +1200)
committerJule Anger <janger@samba.org>
Thu, 16 Sep 2021 08:07:11 +0000 (08:07 +0000)
This makes the purpose of each set of credentials more consistent, and
makes some tests more convenient to run standalone as they no longer
require user credentials.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14817
(cherry picked from commit ab221c1b3e24696aa0eed6aa970f310447657069)

python/samba/tests/krb5/kdc_base_test.py
source4/selftest/tests.py

index 89d374fc5cca37cdef87d43853e729f958b8e6dc..0f5238a3de90ad72fe45cdad5b555ac5bc29664f 100644 (file)
@@ -109,7 +109,7 @@ class KDCBaseTest(RawKerberosTest):
 
     def get_samdb(self):
         if self._ldb is None:
-            creds = self.get_user_creds()
+            creds = self.get_admin_creds()
             lp = self.get_lp()
 
             session = system_session()
index 64bf82fd4226dabaa6aa8a903a4641da7152dd3b..843cc81c1d330dec93c6040183e71e0d9cef959c 100755 (executable)
@@ -797,10 +797,26 @@ planoldpythontestsuite("ad_dc_default:local", "samba.tests.krb5.s4u_tests",
 
 planoldpythontestsuite("fl2008r2dc:local", "samba.tests.krb5.xrealm_tests")
 
-planoldpythontestsuite("ad_dc_default", "samba.tests.krb5.test_ccache")
-planoldpythontestsuite("ad_dc_default", "samba.tests.krb5.test_ldap")
-planoldpythontestsuite("ad_dc_default", "samba.tests.krb5.test_rpc")
-planoldpythontestsuite("ad_dc_smb1", "samba.tests.krb5.test_smb")
+planoldpythontestsuite("ad_dc_default", "samba.tests.krb5.test_ccache",
+                       environ={
+                           'ADMIN_USERNAME': '$USERNAME',
+                           'ADMIN_PASSWORD': '$PASSWORD'
+                       })
+planoldpythontestsuite("ad_dc_default", "samba.tests.krb5.test_ldap",
+                       environ={
+                           'ADMIN_USERNAME': '$USERNAME',
+                           'ADMIN_PASSWORD': '$PASSWORD'
+                       })
+planoldpythontestsuite("ad_dc_default", "samba.tests.krb5.test_rpc",
+                       environ={
+                           'ADMIN_USERNAME': '$USERNAME',
+                           'ADMIN_PASSWORD': '$PASSWORD'
+                       })
+planoldpythontestsuite("ad_dc_smb1", "samba.tests.krb5.test_smb",
+                       environ={
+                           'ADMIN_USERNAME': '$USERNAME',
+                           'ADMIN_PASSWORD': '$PASSWORD'
+                       })
 
 for env in ["ad_dc", smbv1_disabled_testenv]:
     planoldpythontestsuite(env, "samba.tests.smb", extra_args=['-U"$USERNAME%$PASSWORD"'])
@@ -1365,15 +1381,27 @@ for env in ["rodc", "promoted_dc", "fl2000dc", "fl2008r2dc"]:
                                                             '--option=torture:expect_machine_account=true'] + extra_options,
                              "samba4.krb5.kdc with machine account")
 
-planpythontestsuite("ad_dc", "samba.tests.krb5.as_canonicalization_tests")
+planpythontestsuite("ad_dc", "samba.tests.krb5.as_canonicalization_tests",
+                       environ={
+                           'ADMIN_USERNAME': '$USERNAME',
+                           'ADMIN_PASSWORD': '$PASSWORD'
+                       })
 planpythontestsuite("ad_dc", "samba.tests.krb5.compatability_tests")
 planpythontestsuite("ad_dc", "samba.tests.krb5.kdc_tests")
 planpythontestsuite(
     "ad_dc",
-    "samba.tests.krb5.kdc_tgs_tests")
+    "samba.tests.krb5.kdc_tgs_tests",
+    environ={
+        'ADMIN_USERNAME': '$USERNAME',
+        'ADMIN_PASSWORD': '$PASSWORD'
+    })
 planpythontestsuite(
     "ad_dc",
-    "samba.tests.krb5.ms_kile_client_principal_lookup_tests")
+    "samba.tests.krb5.ms_kile_client_principal_lookup_tests",
+    environ={
+        'ADMIN_USERNAME': '$USERNAME',
+        'ADMIN_PASSWORD': '$PASSWORD'
+    })
 
 for env in [
         'vampire_dc',