From 32a2bbb44b58a8a3da6a6b70d5d21a21c1b68d10 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Thu, 8 Jul 2010 09:36:30 +0200 Subject: s4:samdb.py - "setpassword" - performs password sets using the "unicodePwd" attribute This does work per default on each AD-compatible DC. "userPassword" support on Windows however has to be activated explicitly by the "dSHeuristics". --- source4/scripting/python/samba/samdb.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/source4/scripting/python/samba/samdb.py b/source4/scripting/python/samba/samdb.py index 34d5606993..f810926710 100644 --- a/source4/scripting/python/samba/samdb.py +++ b/source4/scripting/python/samba/samdb.py @@ -339,10 +339,6 @@ member: %s username=None): """Sets the password for a user - Note: This call uses the "userPassword" attribute to set the password. - This works correctly on SAMBA 4 and on Windows DCs with - "2003 Native" or higer domain function level. - :param filter: LDAP filter to find the user (eg samccountname=name) :param password: Password for the user :param force_change_at_next_login: Force password change @@ -359,9 +355,9 @@ member: %s setpw = """ dn: %s changetype: modify -replace: userPassword -userPassword:: %s -""" % (user_dn, base64.b64encode(password)) +replace: unicodePwd +unicodePwd:: %s +""" % (user_dn, base64.b64encode(("\"" + password + "\"").encode('utf-16-le'))) self.modify_ldif(setpw) -- cgit