summaryrefslogtreecommitdiffstats
path: root/Lib/smtplib.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2002-04-15 20:03:30 (GMT)
committerBarry Warsaw <barry@python.org>2002-04-15 20:03:30 (GMT)
commitbe22ae6def4ff3bfb826a96c1e5b1360b5a7c1e0 (patch)
treed7125bc13687ad8b0921ac0c38c1254ff480b145 /Lib/smtplib.py
parent8a5a27000099780e8705128001dc370c1555f315 (diff)
downloadcpython-be22ae6def4ff3bfb826a96c1e5b1360b5a7c1e0.zip
cpython-be22ae6def4ff3bfb826a96c1e5b1360b5a7c1e0.tar.gz
cpython-be22ae6def4ff3bfb826a96c1e5b1360b5a7c1e0.tar.bz2
ehlo(): A proper fix for SF bug #498572. RFC 1869 describes ESMTP
which requires that if there are ehlo parameters returned with an ehlo keyword (in the response to EHLO), the keyword and parameters must be delimited by an ASCII space. Thus responses like 250-AUTH=LOGIN should be ignored as non-conformant to the RFC (the `=' isn't allowed in the ehlo keyword). This is a bug fix candidate.
Diffstat (limited to 'Lib/smtplib.py')
-rwxr-xr-xLib/smtplib.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/smtplib.py b/Lib/smtplib.py
index 6f37cee..2836165 100755
--- a/Lib/smtplib.py
+++ b/Lib/smtplib.py
@@ -398,7 +398,11 @@ class SMTP:
resp=self.ehlo_resp.split('\n')
del resp[0]
for each in resp:
- m=re.match(r'(?P<feature>[A-Za-z0-9][A-Za-z0-9\-]*)',each)
+ # RFC 1869 requires a space between ehlo keyword and parameters.
+ # It's actually stricter, in that only spaces are allowed between
+ # parameters, but were not going to check for that here. Note
+ # that the space isn't present if there are no parameters.
+ m=re.match(r'(?P<feature>[A-Za-z0-9][A-Za-z0-9\-]*) ?',each)
if m:
feature=m.group("feature").lower()
params=m.string[m.end("feature"):].strip()