summaryrefslogtreecommitdiff
path: root/source4/scripting
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2013-02-04 11:41:39 +0100
committerMichael Adam <obnox@samba.org>2013-02-04 17:14:22 +0100
commitd60be8167b7264dadae7d4735ee5977233d4cea9 (patch)
treef042319c50c5bca948bc5cdf17ef3fc254c75c9d /source4/scripting
parentff65500f2b4f00dad25e342b51373f700d888c6b (diff)
downloadsamba-d60be8167b7264dadae7d4735ee5977233d4cea9.tar.gz
samba-d60be8167b7264dadae7d4735ee5977233d4cea9.tar.bz2
samba-d60be8167b7264dadae7d4735ee5977233d4cea9.zip
s4:scripting/python: add support for utf-8 passwords from the command line
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source4/scripting')
-rw-r--r--source4/scripting/python/samba/samdb.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/source4/scripting/python/samba/samdb.py b/source4/scripting/python/samba/samdb.py
index 0eb5a13faa..2dfc839519 100644
--- a/source4/scripting/python/samba/samdb.py
+++ b/source4/scripting/python/samba/samdb.py
@@ -473,12 +473,13 @@ member: %s
if len(res) > 1:
raise Exception('Matched %u multiple users with filter "%s"' % (len(res), search_filter))
user_dn = res[0].dn
+ pw = unicode('"' + password + '"', 'utf-8').encode('utf-16-le')
setpw = """
dn: %s
changetype: modify
replace: unicodePwd
unicodePwd:: %s
-""" % (user_dn, base64.b64encode(("\"" + password + "\"").encode('utf-16-le')))
+""" % (user_dn, base64.b64encode(pw))
self.modify_ldif(setpw)