summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Sutton <josephsutton@catalyst.net.nz>2022-05-24 19:30:12 +1200
committerJule Anger <janger@samba.org>2022-07-24 11:42:01 +0200
commit5b030b176b853938b1895ec255e838147d8e7fa9 (patch)
tree362d1fff852a393497f70b2845fab342a20afb9b
parentca582250fcaf2ad3c585f7e31a1a4ce568b7ddb7 (diff)
downloadsamba-5b030b176b853938b1895ec255e838147d8e7fa9.tar.gz
tests/krb5: Add option for creating accounts with expired passwords
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andreas Schneider <asn@samba.org>
-rw-r--r--python/samba/tests/krb5/kdc_base_test.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/python/samba/tests/krb5/kdc_base_test.py b/python/samba/tests/krb5/kdc_base_test.py
index 14f1d1a243d..777b3b4aaf1 100644
--- a/python/samba/tests/krb5/kdc_base_test.py
+++ b/python/samba/tests/krb5/kdc_base_test.py
@@ -242,7 +242,8 @@ 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, add_dollar=True):
+ ou=None, account_control=0, add_dollar=True,
+ expired_password=False):
'''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.
@@ -294,6 +295,8 @@ class KDCBaseTest(RawKerberosTest):
details["servicePrincipalName"] = spn
if upn is not None:
details["userPrincipalName"] = upn
+ if expired_password:
+ details["pwdLastSet"] = "0"
if additional_details is not None:
details.update(additional_details)
samdb.add(details)
@@ -653,6 +656,7 @@ class KDCBaseTest(RawKerberosTest):
'revealed_to_rodc': False,
'revealed_to_mock_rodc': False,
'no_auth_data_required': False,
+ 'expired_password': False,
'supported_enctypes': None,
'not_delegated': False,
'delegation_to_spn': None,
@@ -695,6 +699,7 @@ class KDCBaseTest(RawKerberosTest):
revealed_to_rodc,
revealed_to_mock_rodc,
no_auth_data_required,
+ expired_password,
supported_enctypes,
not_delegated,
delegation_to_spn,
@@ -754,7 +759,8 @@ class KDCBaseTest(RawKerberosTest):
spn=spn,
additional_details=details,
account_control=user_account_control,
- add_dollar=add_dollar)
+ add_dollar=add_dollar,
+ expired_password=expired_password)
keys = self.get_keys(samdb, dn)
self.creds_set_keys(creds, keys)