summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Sutton <josephsutton@catalyst.net.nz>2021-10-20 12:44:19 +1300
committerStefan Metzmacher <metze@samba.org>2021-10-27 22:37:10 +0000
commit3f376eeaa88237a15a523cbf1c11a75e20f3ffc8 (patch)
tree30c083b900ae5a24f5f056f3cf555d943d4aa376
parenta2a173d70ad4e9ea54b336ef9660897ea6ed58d6 (diff)
downloadsamba-3f376eeaa88237a15a523cbf1c11a75e20f3ffc8.tar.gz
tests/krb5: Allow creating machine accounts without a trailing dollar
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14874 BUG: https://bugzilla.samba.org/show_bug.cgi?id=14881 Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Stefan Metzmacher <metze@samba.org> (cherry picked from commit f4785ccfefe7c89f84ad847ca3c12f604172b321)
-rw-r--r--python/samba/tests/krb5/kdc_base_test.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/python/samba/tests/krb5/kdc_base_test.py b/python/samba/tests/krb5/kdc_base_test.py
index d8f3969d228..35f168a3c83 100644
--- a/python/samba/tests/krb5/kdc_base_test.py
+++ b/python/samba/tests/krb5/kdc_base_test.py
@@ -237,7 +237,7 @@ class KDCBaseTest(RawKerberosTest):
def create_account(self, samdb, name, account_type=AccountType.USER,
spn=None, upn=None, additional_details=None,
- ou=None, account_control=0):
+ ou=None, account_control=0, add_dollar=True):
'''Create an account for testing.
The dn of the created account is added to self.accounts,
which is used by tearDownClass to clean up the created accounts.
@@ -255,13 +255,14 @@ class KDCBaseTest(RawKerberosTest):
# remove the account if it exists, this will happen if a previous test
# run failed
delete_force(samdb, dn)
+ account_name = name
if account_type is self.AccountType.USER:
object_class = "user"
- account_name = name
account_control |= UF_NORMAL_ACCOUNT
else:
object_class = "computer"
- account_name = "%s$" % name
+ if add_dollar:
+ account_name += '$'
if account_type is self.AccountType.COMPUTER:
account_control |= UF_WORKSTATION_TRUST_ACCOUNT
else:
@@ -632,6 +633,7 @@ class KDCBaseTest(RawKerberosTest):
opts_default = {
'name_prefix': None,
'name_suffix': None,
+ 'add_dollar': True,
'spn': None,
'allowed_replication': False,
'allowed_replication_mock': False,
@@ -671,6 +673,7 @@ class KDCBaseTest(RawKerberosTest):
account_type,
name_prefix,
name_suffix,
+ add_dollar,
spn,
allowed_replication,
allowed_replication_mock,
@@ -739,7 +742,8 @@ class KDCBaseTest(RawKerberosTest):
account_type=account_type,
spn=spn,
additional_details=details,
- account_control=user_account_control)
+ account_control=user_account_control,
+ add_dollar=add_dollar)
keys = self.get_keys(samdb, dn)
self.creds_set_keys(creds, keys)