This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Fix broken smtplib.login()
Type: Stage:
Components: Library (Lib) Versions: Python 2.2
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: barry Nosy List: arjones, barry, ghaering, loewis
Priority: normal Keywords: patch

Created on 2002-05-05 18:23 by arjones, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
smtplib.py.patch arjones, 2002-05-05 18:23 Patch for smtplib.py
Messages (9)
msg39887 - (view) Author: Andrew Rucker Jones (arjones) Date: 2002-05-05 18:23
RFC 2554 explicitly states that all base64 data in SMTP
AUTH challenges and responses can be of arbitrary
length, but the base64 module adds a newline after 57
bytes of binary data that it has converted to ascii.
This is not accounted for in smtplib.login(), leading
to extraneous newline characters in the middle of long
responses that do weird things to the SMTP session. The
patch is for smtplib.py already patched with the patch
from SourceForge patch ID 552060 and fixes this problem.
msg39888 - (view) Author: Gerhard Häring (ghaering) * (Python committer) Date: 2002-06-21 10:42
Logged In: YES 
user_id=163326

Good spot!

I've incorporated this patch into my AUTH=LOGIN support with
patch #572031.
msg39889 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2002-06-30 15:58
Logged In: YES 
user_id=12800

We should probably be using the email.base64MIME package
instead of base64.  The former is more RFC compliant for
email and related functions.  

email.base64MIME.encode(s, eol='') will eliminate the
newlines.  However base64MIME is only present in Python 2.3
cvs.  It may be backported to Python 2.2.2, but I'm not sure
about that yet.
msg39890 - (view) Author: Gerhard Häring (ghaering) * (Python committer) Date: 2002-06-30 21:20
Logged In: YES 
user_id=163326

I'd suggest to apply this simple patch for the 2.2
maintenance line and use email.base64MIME.encode in the CVS
version. This way we could move on without having to keep
this patch in the queue.
msg39891 - (view) Author: Andrew Rucker Jones (arjones) Date: 2002-07-17 18:40
Logged In: YES 
user_id=236100

Not that my opinion matters much, but i'm all for ghaering's
solution.
msg39892 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-10-07 21:30
Logged In: YES 
user_id=21627

Now that the AUTH=LOGIN patch is committed, can 
somebody explain what needs to be done with this patch?
msg39893 - (view) Author: Gerhard Häring (ghaering) * (Python committer) Date: 2002-10-07 22:28
Logged In: YES 
user_id=163326

The patch addressed a problem, but the proposed fix was
WRONG. Just as wrong as my original SMTP auth code, though
(using [:-1] to remove the newlines from base64.encode,
which is WRONG because there might be multiple newlines in
there).

In my now committed there was a correct solution using
email.base64MIME.encode resp. a workaround for Python 2.2.

So I'd propose to close this as 'Fixed'.
msg39894 - (view) Author: Gerhard Häring (ghaering) * (Python committer) Date: 2002-10-07 22:30
Logged In: YES 
user_id=163326

Argh. Sorry - I was talking utter, complete garbage. Of
course the fix in this patch is correct (I was downloading
the patch before, but too stupid to read diffs). It's still
already taken care of in what's committed already.
msg39895 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2002-10-08 09:29
Logged In: YES 
user_id=21627

Ok, closing as a duplicate, then. Thanks for your efforts.
History
Date User Action Args
2022-04-10 16:05:17adminsetgithub: 36558
2002-05-05 18:23:12arjonescreate