Commit Graph

169 Commits

Author SHA1 Message Date
Serhiy Storchaka 42d72b23dd
gh-114241: Fix and improve the ftplib CLI (GH-114242)
* Fix writing the retrieved binary file to stdout.
* Add a newline after writing warnings to stderr.
* Fix a TypeError if the netrc file doesn't contain a host/default entry.
* Improve the usage message.
2024-01-21 22:16:45 +02:00
Nick Drozd 024ac542d7
bpo-45975: Simplify some while-loops with walrus operator (GH-29347) 2022-11-26 14:33:25 -08:00
Victor Stinner ef0e72b31d
gh-94172: Remove keyfile, certfile and check_hostname parameters (#94173)
Remove the keyfile, certfile and check_hostname parameters,
deprecated since Python 3.6, in modules: ftplib, http.client,
imaplib, poplib and smtplib. Use the context parameter (ssl_context
in imaplib) instead.

Parameters following the removed parameters become keyword-only
parameters.

ftplib: Remove the FTP_TLS.ssl_version class attribute: use the
context parameter instead.
2022-11-03 18:32:25 +01:00
Serhiy Storchaka 3680ebed7f
bpo-44712: Replace "type(literal)" with corresponding builtin types (GH-27294)
I suppose it is a remnants of very old code written when str, int, list, dict, etc
were functions and not classes.
2022-05-08 17:10:11 +03:00
Gregory P. Smith 0ab152c6b5
bpo-43285 Make ftplib not trust the PASV response. (GH-24838)
bpo-43285: Make ftplib not trust the PASV response.

The IPv4 address value returned from the server in response to the PASV command
should not be trusted.  This prevents a malicious FTP server from using the
response to probe IPv4 address and port combinations on the client network.

Instead of using the returned address, we use the IP address we're
already connected to.  This is the strategy other ftp clients adopted,
and matches the only strategy available for the modern IPv6 EPSV command
where the server response must return a port number and nothing else.

For the rare user who _wants_ this ugly behavior, set a `trust_server_pasv_ipv4_address`
attribute on your `ftplib.FTP` instance to True.
2021-03-15 11:39:31 -07:00
Sebastian Pedersen a1a0eb4a39
bpo-39380: Change ftplib encoding from latin-1 to utf-8 (GH-18048)
Add the encoding in ftplib.FTP and ftplib.FTP_TLS to the
constructor as keyword-only and change the default from "latin-1" to "utf-8"
to follow RFC 2640.
2020-04-14 01:07:56 +02:00
Dong-hee Na a190e2ade1 bpo-39259: ftplib.FTP/FTP_TLS now reject timeout = 0 (GH-17959) 2020-01-13 20:34:34 +01:00
Alan Yee efa3b51fd0 Enforce PEP 257 conventions in ftplib.py (GH-15604)
-`"""` over `'''`
-no blank line either before or after the docstring.
-place the closing quotes on a line by themselves
2019-09-02 21:21:33 -07:00
Steve Dower 44f91c388a
bpo-37390: Add audit event table to documentations (GH-14406)
Also updates some (unreleased) event names to be consistent with the others.
2019-06-27 10:47:59 -07:00
Steve Dower 60419a7e96
bpo-37363: Add audit events for a range of modules (GH-14301) 2019-06-24 08:42:54 -07:00
Giampaolo Rodola eb7e29f2a9
bpo-35934: Add socket.create_server() utility function (GH-11784) 2019-04-09 00:34:02 +02:00
Pablo Aguiar 4b5e62dbb2 bpo-35128: Fix spacing issues in warning.warn() messages. (GH-10268) 2018-11-01 12:33:35 +02:00
Christian Heimes a170fa162d bpo-31346: Use PROTOCOL_TLS_CLIENT/SERVER (#3058)
Replaces PROTOCOL_TLSv* and PROTOCOL_SSLv23 with PROTOCOL_TLS_CLIENT and
PROTOCOL_TLS_SERVER.

Signed-off-by: Christian Heimes <christian@python.org>
2017-09-15 20:27:30 +02:00
Dong-hee Na 2b1e6e9696 bpo-30119: fix ftplib.FTP.putline() to throw an error for a illegal command (#1214) 2017-07-22 19:20:22 +02:00
Christian Heimes d04863771b Issue #28022: Deprecate ssl-related arguments in favor of SSLContext.
The deprecation include manual creation of SSLSocket and certfile/keyfile
(or similar) in ftplib, httplib, imaplib, smtplib, poplib and urllib.

ssl.wrap_socket() is not marked as deprecated yet.
2016-09-10 23:23:33 +02:00
R David Murray 44b548dda8 #27364: fix "incorrect" uses of escape character in the stdlib.
And most of the tools.

Patch by Emanual Barry, reviewed by me, Serhiy Storchaka, and
Martin Panter.
2016-09-08 13:59:53 -04:00
Serhiy Storchaka ccd047ea4b Removed unused imports. 2016-04-25 00:12:32 +03:00
Martin Panter 19e69c5a20 Issue #23883: Add missing APIs to __all__; patch by Jacek Kołodziej 2015-11-14 12:46:42 +00:00
Martin Panter 2eb819f7a8 Issue #25523: Merge "a" to "an" fixes from 3.4 into 3.5 2015-11-02 04:04:57 +00:00
Martin Panter 7462b64911 Issue #25523: Correct "a" article to "an" article
This changes the main documentation, doc strings, source code comments, and a
couple error messages in the test suite. In some cases the word was removed
or edited some other way to fix the grammar.
2015-11-02 03:37:02 +00:00
Serhiy Storchaka 7e7a3dba5f Issue #23865: close() methods in multiple modules now are idempotent and more
robust at shutdown. If needs to release multiple resources, they are released
even if errors are occured.
2015-04-10 13:24:41 +03:00
Serhiy Storchaka 2116b12da5 Issue #23865: close() methods in multiple modules now are idempotent and more
robust at shutdown. If needs to release multiple resources, they are released
even if errors are occured.
2015-04-10 13:29:28 +03:00
Benjamin Peterson bfdec6263f merge 3.4 (#23111) 2014-12-30 15:16:13 -06:00
Benjamin Peterson 36fe7926f8 make PROTOCOL_SSLv23 the default protocol version for ftplib (closes #23111) 2014-12-30 15:15:43 -06:00
Benjamin Peterson 7243b574e5 don't require OpenSSL SNI to pass hostname to ssl functions (#22921)
Patch by Donald Stufft.
2014-11-23 17:04:34 -06:00
Benjamin Peterson f9284ae8ed merge 3.4 (#22921) 2014-11-23 17:06:39 -06:00
Berker Peksag 8f791d358b Issue #6623: Remove deprecated Netrc class in the ftplib module.
Patch by Matt Chaput.
2014-11-01 10:45:57 +02:00
Victor Stinner 69b1e261fc Issue #20978: pyflakes: fix undefined names 2014-03-20 08:50:52 +01:00
Christian Heimes e5b5edfa2c Issue #19781: ftplib now supports SSLContext.check_hostname and server name
indication for TLS/SSL connections.
2013-12-02 02:56:02 +01:00
Christian Heimes 67986f9431 Issue #19735: Implement private function ssl._create_stdlib_context() to
create SSLContext objects in Python's stdlib module. It provides a single
configuration point and makes use of SSLContext.load_default_certs().
2013-11-23 22:43:47 +01:00
Serhiy Storchaka 2acc456c33 Issue #16038: CVE-2013-1752: ftplib: Limit amount of data read by
limiting the call to readline().  Original patch by Michał
Jastrzębski and Giampaolo Rodola.
2013-10-20 17:02:10 +03:00
Serhiy Storchaka c30b178cbc Issue #16038: CVE-2013-1752: ftplib: Limit amount of data read by
limiting the call to readline().  Original patch by Michał
Jastrzębski and Giampaolo Rodola.
2013-10-20 16:58:27 +03:00
Brett Cannon cd171c8e92 Issue #18200: Back out usage of ModuleNotFoundError (8d28d44f3a9a) 2013-07-04 17:43:24 -04:00
Brett Cannon 0a140668fa Issue #18200: Update the stdlib (except tests) to use
ModuleNotFoundError.
2013-06-13 20:57:26 -04:00
Giampaolo Rodola' 11a9bd62b1 ftplib: update connect() docstring by mentioning 'timeout' argument 2013-04-26 15:23:43 +02:00
Giampaolo Rodola' a77d7a52e8 (issue 17452 / ftplib) fix TypeError occurring in case ssl module is not installed 2013-03-18 09:59:15 +01:00
Terry Jan Reedy 16b5c13668 Merge 3.3, issue #17047: remove doubled words found in 2.7 to
3.4 Lib/*, as reported by Serhiy Storchaka and Matthew Barnett.
2013-03-11 17:59:07 -04:00
Terry Jan Reedy 98472b8396 Merge 3.2, issue #17047: remove doubled words found in 2.7 to
3.4 Lib/*, as reported by Serhiy Storchaka and Matthew Barnett.
2013-03-11 17:58:27 -04:00
Terry Jan Reedy c30b7b16ea Issue #17047: remove doubled words found in 2.7 to 3.4 Lib/*,
as reported by Serhiy Storchaka and Matthew Barnett.
2013-03-11 17:57:08 -04:00
Giampaolo Rodola' 3ff5e7578e Refactor ftplib by getting rid of 4 methods (retr*() and stor*()) which were duplicated in TLS_FTP class. 2013-03-07 14:03:27 +01:00
Giampaolo Rodola' 94c56a172c PEP8-ify ftplib.py: get rid of multiple statements on one line (if cond: ...) 2013-03-07 13:51:20 +01:00
R David Murray 87632f1a9e #6623: Add explicit deprecation warning for ftplib.Netrc. 2013-02-19 18:32:28 -05:00
Andrew Svetlov f7a17b48d7 Replace IOError with OSError (#16715) 2012-12-25 16:47:37 +02:00
Andrew Svetlov 0832af6628 Issue #16717: get rid of socket.error, replace with OSError 2012-12-18 23:10:48 +02:00
Giampaolo Rodola' b6375a2d91 Issue 16646 (ftplib): deliberately use intermediate variable after catching exception 2012-12-17 20:46:29 +01:00
Giampaolo Rodola' 57f3487994 Issue 16646 (ftplib): deliberately use intermediate variable after catching exception 2012-12-17 20:46:16 +01:00
Giampaolo Rodola' 896cb15d0c Fix issue #16646: ftplib.FTP.makeport() might lose socket error details. (patch by Serhiy Storchaka) 2012-12-17 14:22:19 +01:00
Giampaolo Rodola' fc3278802c Fix issue #16646: ftplib.FTP.makeport() might lose socket error details. (patch by Serhiy Storchaka) 2012-12-17 14:20:27 +01:00
Giampaolo Rodola' 836e9aab2f fix #13563: make use of with statement in ftplib.py where needed 2011-12-10 21:25:04 +01:00
Florent Xicluna 2bb96f593a Cleanup code: remove int/long idioms and simplify a while statement. 2011-10-23 22:11:00 +02:00