From d60be8167b7264dadae7d4735ee5977233d4cea9 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 4 Feb 2013 11:41:39 +0100 Subject: s4:scripting/python: add support for utf-8 passwords from the command line Signed-off-by: Stefan Metzmacher Reviewed-by: Michael Adam --- source4/scripting/python/samba/samdb.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4') 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) -- cgit