summaryrefslogtreecommitdiff
path: root/Lib/smtplib.py
diff options
context:
space:
mode:
authorR. David Murray <rdmurray@bitdance.com>2009-05-23 18:49:56 +0000
committerR. David Murray <rdmurray@bitdance.com>2009-05-23 18:49:56 +0000
commitcaa27b7823f12a971aec54f77a06280fdd84f058 (patch)
tree0874907c5c792cc18f957daa0ff16072aad31829 /Lib/smtplib.py
parentdfea192ad4317aab757989b0c815a5146b0d6336 (diff)
downloadcpython-git-caa27b7823f12a971aec54f77a06280fdd84f058.tar.gz
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 d8d717c05b..0b2a586a44 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"