[Python-checkins] cpython (2.7): make SSLv23 the default version in ftplib (closes #23111)

benjamin.peterson python-checkins at python.org
Sun Jan 4 17:20:44 CET 2015


https://hg.python.org/cpython/rev/98ee845a139a
changeset: 94016:98ee845a139a
branch: 2.7
parent: 94010:1346a6013127
user: Benjamin Peterson <benjamin at python.org>
date: Sun Jan 04 10:20:16 2015 -0600
summary:
 make SSLv23 the default version in ftplib (closes #23111)
files:
 Doc/library/ftplib.rst | 2 +-
 Lib/ftplib.py | 4 ++--
 Misc/NEWS | 2 ++
 3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/Doc/library/ftplib.rst b/Doc/library/ftplib.rst
--- a/Doc/library/ftplib.rst
+++ b/Doc/library/ftplib.rst
@@ -384,7 +384,7 @@
 
 .. attribute:: FTP_TLS.ssl_version
 
- The SSL version to use (defaults to *TLSv1*).
+ The SSL version to use (defaults to :attr:`ssl.PROTOCOL_SSLv23`).
 
 .. method:: FTP_TLS.auth()
 
diff --git a/Lib/ftplib.py b/Lib/ftplib.py
--- a/Lib/ftplib.py
+++ b/Lib/ftplib.py
@@ -638,7 +638,7 @@
 '221 Goodbye.'
 >>>
 '''
- ssl_version = ssl.PROTOCOL_TLSv1
+ ssl_version = ssl.PROTOCOL_SSLv23
 
 def __init__(self, host='', user='', passwd='', acct='', keyfile=None,
 certfile=None, timeout=_GLOBAL_DEFAULT_TIMEOUT):
@@ -656,7 +656,7 @@
 '''Set up secure control connection by using TLS/SSL.'''
 if isinstance(self.sock, ssl.SSLSocket):
 raise ValueError("Already using TLS")
- if self.ssl_version == ssl.PROTOCOL_TLSv1:
+ if self.ssl_version >= ssl.PROTOCOL_SSLv23:
 resp = self.voidcmd('AUTH TLS')
 else:
 resp = self.voidcmd('AUTH SSL')
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -15,6 +15,8 @@
 Library
 -------
 
+- Issue #23111: Maximize compatibility in protocol versions of ftplib.FTP_TLS.
+
 - Issue #23112: Fix SimpleHTTPServer to correctly carry the query string and
 fragment when it redirects to add a trailing slash.
 
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /