summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2017-02-13 22:34:06 +0100
committerRalph Boehme <slow@samba.org>2017-02-21 16:09:22 +0100
commitb86c29b1e6fb2fb4cf203aa38c7764084d855730 (patch)
treef079ab0f34d50fb9a1b5991297a8614069a79921 /python
parent99b8d6beccf4d3d24f9d87a4d8e5eadfe0e0dd33 (diff)
downloadsamba-b86c29b1e6fb2fb4cf203aa38c7764084d855730.tar.gz
python/samba: use an explicit .encode('utf-8') where we expect utf8 passwords
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12262 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'python')
-rw-r--r--python/samba/join.py2
-rw-r--r--python/samba/netcmd/user.py2
-rw-r--r--python/samba/provision/__init__.py2
-rw-r--r--python/samba/provision/sambadns.py2
-rw-r--r--python/samba/samdb.py2
5 files changed, 5 insertions, 5 deletions
diff --git a/python/samba/join.py b/python/samba/join.py
index 64854681fb5..01c22602e39 100644
--- a/python/samba/join.py
+++ b/python/samba/join.py
@@ -880,7 +880,7 @@ class dc_join(object):
repl_creds.guess(ctx.lp)
repl_creds.set_kerberos_state(DONT_USE_KERBEROS)
repl_creds.set_username(ctx.samname)
- repl_creds.set_password(ctx.acct_pass)
+ repl_creds.set_password(ctx.acct_pass.encode('utf-8'))
else:
repl_creds = ctx.creds
diff --git a/python/samba/netcmd/user.py b/python/samba/netcmd/user.py
index 43581703bfd..f007ee58988 100644
--- a/python/samba/netcmd/user.py
+++ b/python/samba/netcmd/user.py
@@ -683,7 +683,7 @@ class cmd_user_password(Command):
self.outf.write("Sorry, passwords do not match.\n")
try:
- net.change_password(password)
+ net.change_password(password.encode('utf-8'))
except Exception, msg:
# FIXME: catch more specific exception
raise CommandError("Failed to change password : %s" % msg)
diff --git a/python/samba/provision/__init__.py b/python/samba/provision/__init__.py
index 3187b659e13..ad269aa1463 100644
--- a/python/samba/provision/__init__.py
+++ b/python/samba/provision/__init__.py
@@ -877,7 +877,7 @@ def secretsdb_self_join(secretsdb, domain,
msg["msDS-KeyVersionNumber"] = [str(key_version_number)]
msg["privateKeytab"] = ["secrets.keytab"]
- msg["secret"] = [machinepass]
+ msg["secret"] = [machinepass.encode('utf-8')]
msg["samAccountName"] = ["%s$" % netbiosname]
msg["secureChannelType"] = [str(secure_channel_type)]
if domainsid is not None:
diff --git a/python/samba/provision/sambadns.py b/python/samba/provision/sambadns.py
index df4673b9619..2c69dd4e910 100644
--- a/python/samba/provision/sambadns.py
+++ b/python/samba/provision/sambadns.py
@@ -661,7 +661,7 @@ def secretsdb_setup_dns(secretsdb, names, private_dir, realm,
"REALM": realm,
"DNSDOMAIN": dnsdomain,
"DNS_KEYTAB": dns_keytab_path,
- "DNSPASS_B64": b64encode(dnspass),
+ "DNSPASS_B64": b64encode(dnspass.encode('utf-8')),
"KEY_VERSION_NUMBER": str(key_version_number),
"HOSTNAME": names.hostname,
"DNSNAME" : '%s.%s' % (
diff --git a/python/samba/samdb.py b/python/samba/samdb.py
index eabe363aac9..19dd8e9a6ad 100644
--- a/python/samba/samdb.py
+++ b/python/samba/samdb.py
@@ -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