summaryrefslogtreecommitdiffstats
path: root/Lib/smtplib.py
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2009-05-23 18:49:56 (GMT)
committerR. David Murray <rdmurray@bitdance.com>2009-05-23 18:49:56 (GMT)
commitcaa27b7823f12a971aec54f77a06280fdd84f058 (patch)
tree0874907c5c792cc18f957daa0ff16072aad31829 /Lib/smtplib.py
parentdfea192ad4317aab757989b0c815a5146b0d6336 (diff)
downloadcpython-caa27b7823f12a971aec54f77a06280fdd84f058.zip
cpython-caa27b7823f12a971aec54f77a06280fdd84f058.tar.gz
cpython-caa27b7823f12a971aec54f77a06280fdd84f058.tar.bz2
Fix for issue 5259: ASCII encode the username and password before passing
it to encode_base64, which requires bytes in py3k. Fix by Musashi Tamura, tests by Marcin Bachry.
Diffstat (limited to 'Lib/smtplib.py')
-rwxr-xr-xLib/smtplib.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/smtplib.py b/Lib/smtplib.py
index d8d717c..0b2a586 100755
--- a/Lib/smtplib.py
+++ b/Lib/smtplib.py
@@ -545,7 +545,8 @@ class SMTP:
return encode_base64(response)
def encode_plain(user, password):
- return encode_base64("\0%s\0%s" % (user, password))
+ s = "\0%s\0%s" % (user, password)
+ return encode_base64(s.encode('ascii'), eol='')
AUTH_PLAIN = "PLAIN"