diff options
author | Andrew Bartlett <abartlet@samba.org> | 2009-06-17 09:14:17 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2009-06-18 13:49:30 +1000 |
commit | 2afc6df9b49a246129acdd7c8c24448c8cf3b6ef (patch) | |
tree | 2b570668e29057987d12c040ccd496e61c66a9ad /source4/scripting/python | |
parent | 0ac46b00abf045c6dcd48ed9a96f948fc8416138 (diff) | |
download | samba-2afc6df9b49a246129acdd7c8c24448c8cf3b6ef.tar.gz samba-2afc6df9b49a246129acdd7c8c24448c8cf3b6ef.tar.bz2 samba-2afc6df9b49a246129acdd7c8c24448c8cf3b6ef.zip |
s4:setup Add an option to 'setpassword' to force password change at next login
Diffstat (limited to 'source4/scripting/python')
-rw-r--r-- | source4/scripting/python/samba/samdb.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/source4/scripting/python/samba/samdb.py b/source4/scripting/python/samba/samdb.py index 454a9d144c..8ca4f65d6e 100644 --- a/source4/scripting/python/samba/samdb.py +++ b/source4/scripting/python/samba/samdb.py @@ -152,7 +152,7 @@ userAccountControl: %u raise self.transaction_commit() - def setpassword(self, filter, password): + def setpassword(self, filter, password, must_change_at_next_login=False): """Set a password on a user record :param filter: LDAP filter to find the user (eg samccountname=name) @@ -184,6 +184,15 @@ userPassword:: %s self.modify_ldif(setpw) + if must_change_at_next_login: + mod = """ +dn: %s +changetype: modify +replace: pwdLastSet +pwdLastSet: 0 +""" % (user_dn) + self.modify_ldif(mod) + # modify the userAccountControl to remove the disabled bit self.enable_account(user_dn) except: @@ -212,7 +221,7 @@ userPassword:: %s glue.dsdb_set_ntds_invocation_id(self, invocation_id) def setexpiry(self, user, expiry_seconds, noexpiry): - """Set the password expiry for a user + """Set the account expiry for a user :param expiry_seconds: expiry time from now in seconds :param noexpiry: if set, then don't expire password @@ -246,3 +255,4 @@ accountExpires: %u self.transaction_cancel() raise self.transaction_commit(); + |