Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 36fe792

Browse files
committed
make PROTOCOL_SSLv23 the default protocol version for ftplib (closes #23111)
1 parent 3cd1af5 commit 36fe792

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

Lib/ftplib.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ class FTP_TLS(FTP):
713713
'221 Goodbye.'
714714
>>>
715715
'''
716-
ssl_version = ssl.PROTOCOL_TLSv1
716+
ssl_version = ssl.PROTOCOL_SSLv23
717717

718718
def __init__(self, host='', user='', passwd='', acct='', keyfile=None,
719719
certfile=None, context=None,
@@ -743,7 +743,7 @@ def auth(self):
743743
'''Set up secure control connection by using TLS/SSL.'''
744744
if isinstance(self.sock, ssl.SSLSocket):
745745
raise ValueError("Already using TLS")
746-
if self.ssl_version == ssl.PROTOCOL_TLSv1:
746+
if self.ssl_version >= ssl.PROTOCOL_SSLv23:
747747
resp = self.voidcmd('AUTH TLS')
748748
else:
749749
resp = self.voidcmd('AUTH SSL')

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ Core and Builtins
4141
Library
4242
-------
4343

44+
- Issue #23111: In the ftplib, make ssl.PROTOCOL_SSLv23 the default protocol
45+
version.
46+
4447
- Issue #22585: On OpenBSD 5.6 and newer, os.urandom() now calls getentropy(),
4548
instead of reading /dev/urandom, to get pseudo-random bytes.
4649

0 commit comments

Comments
 (0)