summaryrefslogtreecommitdiff
path: root/python/samba/samdb.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/samba/samdb.py')
-rw-r--r--python/samba/samdb.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/python/samba/samdb.py b/python/samba/samdb.py
index 424a648446b..abe434c8578 100644
--- a/python/samba/samdb.py
+++ b/python/samba/samdb.py
@@ -589,7 +589,11 @@ 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 = text_type(b'"' + password.encode('utf-8') + b'"', 'utf-8').encode('utf-16-le')
+ if not isinstance(password, text_type):
+ pw = password.decode('utf-8')
+ else:
+ pw = password
+ pw = ('"' + pw + '"').encode('utf-16-le')
setpw = """
dn: %s
changetype: modify