summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-07-08 09:36:30 +0200
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-07-08 19:28:43 +0200
commit32a2bbb44b58a8a3da6a6b70d5d21a21c1b68d10 (patch)
tree4ec25f712cb004311ee8832ff6ea96f99e127d70 /source4/scripting
parent61be498adbdcefb3d2d79bc26019ede01411178f (diff)
downloadsamba-32a2bbb44b58a8a3da6a6b70d5d21a21c1b68d10.tar.gz
samba-32a2bbb44b58a8a3da6a6b70d5d21a21c1b68d10.tar.bz2
samba-32a2bbb44b58a8a3da6a6b70d5d21a21c1b68d10.zip
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".
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/python/samba/samdb.py10
1 files 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)