From: Stefan Metzmacher Date: Mon, 4 Feb 2013 10:41:39 +0000 (+0100) Subject: s4:scripting/python: add support for utf-8 passwords from the command line X-Git-Tag: tevent-0.9.18~306 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d60be8167b7264dadae7d4735ee5977233d4cea9;p=thirdparty%2Fsamba.git s4:scripting/python: add support for utf-8 passwords from the command line Signed-off-by: Stefan Metzmacher Reviewed-by: Michael Adam --- diff --git a/source4/scripting/python/samba/samdb.py b/source4/scripting/python/samba/samdb.py index 0eb5a13faa0..2dfc839519e 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)