]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:scripting/python: add support for utf-8 passwords from the command line
authorStefan Metzmacher <metze@samba.org>
Mon, 4 Feb 2013 10:41:39 +0000 (11:41 +0100)
committerMichael Adam <obnox@samba.org>
Mon, 4 Feb 2013 16:14:22 +0000 (17:14 +0100)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
source4/scripting/python/samba/samdb.py

index 0eb5a13faa0b80cd21fa158ea93267d421eedfd3..2dfc839519e491ba1d8ec7a2fdb7459ffedcecd6 100644 (file)
@@ -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)