python/samba: use an explicit .encode('utf-8') where we expect utf8 passwords
[samba.git] / python / samba / samdb.py
index eabe363aac92e266aad5f5dc126e66e62dcb815b..19dd8e9a6ad7d0dfc8e698f40c6d0a772a620525 100644 (file)
@@ -503,7 +503,7 @@ 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')
+            pw = unicode('"' + password.encode('utf-8') + '"', 'utf-8').encode('utf-16-le')
             setpw = """
 dn: %s
 changetype: modify