diff options
author | Stefan Metzmacher <metze@samba.org> | 2017-02-13 22:34:06 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2017-02-25 11:29:13 +0100 |
commit | f9effa5ef146d963d664aa69d69cf70a20956e47 (patch) | |
tree | 6638e102e3cf3f6bae49fc98402cf6d8d4b8abb7 /python | |
parent | 8f437c62cea512a09f7bde643d87b33652b5752b (diff) | |
download | samba-f9effa5ef146d963d664aa69d69cf70a20956e47.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>
(cherry picked from commit b86c29b1e6fb2fb4cf203aa38c7764084d855730)
Diffstat (limited to 'python')
-rw-r--r-- | python/samba/join.py | 2 | ||||
-rw-r--r-- | python/samba/netcmd/user.py | 2 | ||||
-rw-r--r-- | python/samba/provision/__init__.py | 2 | ||||
-rw-r--r-- | python/samba/provision/sambadns.py | 2 | ||||
-rw-r--r-- | python/samba/samdb.py | 2 |
5 files changed, 5 insertions, 5 deletions
diff --git a/python/samba/join.py b/python/samba/join.py index c77cff81062..13680ee4472 100644 --- a/python/samba/join.py +++ b/python/samba/join.py @@ -863,7 +863,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 5adc2879bcc..2cceea8a7d0 100644 --- a/python/samba/netcmd/user.py +++ b/python/samba/netcmd/user.py @@ -670,7 +670,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 344766e3dd6..19fab258762 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 |