summaryrefslogtreecommitdiff
path: root/python/samba
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-27 10:52:36 +0000
commit1e80767c1d29ec7c2466622c386786931afb76e0 (patch)
tree11a913a9a80250af5d651e20a7cb74ba96d5ae1f /python/samba
parent2bb1f40b9a46d36af5604b1ac69079ad066b42fe (diff)
downloadsamba-1e80767c1d29ec7c2466622c386786931afb76e0.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>
Diffstat (limited to 'python/samba')
-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 3e93db87160..0cc7f6a7e84 100644
--- a/python/samba/tests/krb5/kdc_base_test.py
+++ b/python/samba/tests/krb5/kdc_base_test.py
@@ -270,7 +270,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.
@@ -324,6 +325,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)
# Save the account name so it can be deleted in tearDownClass
@@ -732,6 +735,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,
@@ -778,6 +782,7 @@ class KDCBaseTest(RawKerberosTest):
revealed_to_rodc,
revealed_to_mock_rodc,
no_auth_data_required,
+ expired_password,
supported_enctypes,
not_delegated,
delegation_to_spn,
@@ -843,7 +848,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)