From fdd62e9699b181a140292689fcd88a559bc26211 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Wed, 19 Aug 2009 12:37:11 +0200 Subject: s4: Let the "setpassword" script finally use the "samdb_set_password" routine The "setpassword" script should use the "samdb_set_password" call to change the NT user password. Windows Server tests show that "userPassword" is not the right place to save the NT password and does not inherit the password complexity. --- source4/scripting/python/samba/samdb.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'source4/scripting/python/samba') diff --git a/source4/scripting/python/samba/samdb.py b/source4/scripting/python/samba/samdb.py index a58d6c5b12..b78c8f37d9 100644 --- a/source4/scripting/python/samba/samdb.py +++ b/source4/scripting/python/samba/samdb.py @@ -161,14 +161,14 @@ pwdLastSet: 0 assert(len(res) == 1) user_dn = res[0].dn - setpw = """ -dn: %s -changetype: modify -replace: userPassword -userPassword:: %s -""" % (user_dn, base64.b64encode(password)) + mod = ldb.Message() + mod.dn = user_dn + + glue.samdb_set_password(samdb=self, user_dn=str(user_dn), + dom_dn=self.domain_dn(), mod=mod, new_password=password, + user_change=True) - self.modify_ldif(setpw) + self.modify(mod) if force_password_change_at_next_login: self.force_password_change_at_next_login(user_dn) -- cgit