[Python-checkins] r60015 - in python/trunk: Doc/whatsnew/2.6.rst Lib/smtplib.py

gregory.p.smith python-checkins at python.org
Thu Jan 17 08:43:21 CET 2008


Author: gregory.p.smith
Date: Thu Jan 17 08:43:20 2008
New Revision: 60015

Modified:
   python/trunk/Doc/whatsnew/2.6.rst
   python/trunk/Lib/smtplib.py
Log:
Comply with RFC 3207.
Fixes issue 829951 - http://bugs.python.org/issue829951


Modified: python/trunk/Doc/whatsnew/2.6.rst
==============================================================================
--- python/trunk/Doc/whatsnew/2.6.rst	(original)
+++ python/trunk/Doc/whatsnew/2.6.rst	Thu Jan 17 08:43:20 2008
@@ -1091,6 +1091,12 @@
 
   .. Patch #957003
 
+* In the :mod:`smtplib` module, SMTP.starttls() now complies with :rfc:`3207`
+  and forgets any knowledge obtained from the server not obtained from
+  the TLS negotiation itself.  Patch contributed by Bill Fenner.
+
+  .. Issue 829951
+
 * The :mod:`socket` module now supports TIPC (http://tipc.sf.net),
   a high-performance non-IP-based protocol designed for use in clustered
   environments.  TIPC addresses are 4- or 5-tuples.

Modified: python/trunk/Lib/smtplib.py
==============================================================================
--- python/trunk/Lib/smtplib.py	(original)
+++ python/trunk/Lib/smtplib.py	Thu Jan 17 08:43:20 2008
@@ -589,6 +589,14 @@
                 raise RuntimeError("No SSL support included in this Python")
             self.sock = ssl.wrap_socket(self.sock, keyfile, certfile)
             self.file = SSLFakeFile(self.sock)
+            # RFC 3207:
+            # The client MUST discard any knowledge obtained from
+            # the server, such as the list of SMTP service extensions,
+            # which was not obtained from the TLS negotiation itself.
+            self.helo_resp = None
+            self.ehlo_resp = None
+            self.esmtp_features = {}
+            self.does_esmtp = 0
         return (resp, reply)
 
     def sendmail(self, from_addr, to_addrs, msg, mail_options=[],


More information about the Python-checkins mailing list