Commit Graph

71 Commits

Author SHA1 Message Date
Victor Stinner 74125a60b7
bpo-36348: IMAP4.logout() doesn't ignore exc (GH-12411)
The imap.IMAP4.logout() method no longer ignores silently arbitrary
exceptions.

Changes:

* The IMAP4.logout() method now expects a "BYE" untagged response,
  rather than relying on _check_bye() which raises a self.abort()
  exception.
* IMAP4.__exit__() now does nothing if the client already logged out.
* Add more debug info if test_logout() tests fail.
2019-04-15 18:23:20 +02:00
Victor Stinner 3c7931e514
bpo-36629: Add support.get_socket_conn_refused_errs() (GH-12834)
Fix test_imap4_host_default_value() of test_imaplib: catch also
errno.ENETUNREACH error.
2019-04-15 12:34:53 +02:00
Matěj Cepl 3dc67d0316 bpo-35505: Skip test_imap4_host_default_value if localhost listens on IMAP port (GH-11823)
Make test_imap4_host_default_value independent on whether the 
local IMAP server is running.
2019-02-12 19:30:19 +01:00
Berker Peksag e4dcbbd7f4
bpo-18540: Fix EAI_NONAME in imaplib.IMAP4*() (GH-8634) 2018-08-07 05:12:18 +03:00
Christian Heimes 61d478c71c
bpo-31399: Let OpenSSL verify hostname and IP address (#3462)
bpo-31399: Let OpenSSL verify hostname and IP

The ssl module now uses OpenSSL's X509_VERIFY_PARAM_set1_host() and
X509_VERIFY_PARAM_set1_ip() API to verify hostname and IP addresses.

* Remove match_hostname calls
* Check for libssl with set1_host, libssl must provide X509_VERIFY_PARAM_set1_host()
* Add documentation for OpenSSL 1.0.2 requirement
* Don't support OpenSSL special mode with a leading dot, e.g. ".example.org" matches "www.example.org". It's not standard conform.
* Add hostname_checks_common_name

Signed-off-by: Christian Heimes <christian@python.org>
2018-01-27 15:51:38 +01: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
Victor Stinner b9b69003d9 bpo-31234: Add support.join_thread() helper (#3587)
join_thread() joins a thread but raises an AssertionError if the
thread is still alive after timeout seconds.
2017-09-14 14:40:56 -07:00
Antoine Pitrou a6a4dc816d bpo-31370: Remove support for threads-less builds (#3385)
* Remove Setup.config
* Always define WITH_THREAD for compatibility.
2017-09-07 18:56:24 +02:00
Victor Stinner b18563da88 bpo-30231: Remove skipped test_imaplib tests (#1419)
The public cyrus.andrew.cmu.edu IMAP server (port 993) doesn't accept
TLS connection using our self-signed x509 certificate. Remove the two
tests which are already skipped.

Write a new test_certfile_arg_warn() unit test for the certfile
deprecation warning.
2017-06-14 18:48:32 +02:00
Victor Stinner 5bccca58b9 bpo-30175: Skip client cert tests of test_imaplib (#1320)
* bpo-30175: Skip client cert tests of test_imaplib

The IMAP server cyrus.andrew.cmu.edu doesn't accept our randomly
generated client x509 certificate anymore.

* bpo-30188: Catch EOFError in NetworkedNNTPTests

test_nntplib fails randomly with EOFError in
NetworkedNNTPTests.setUpClass(). Catch EOFError to skip tests in that
case.
2017-04-27 17:30:13 +02:00
Victor Stinner d6debb24e0 bpo-29919: Remove unused imports found by pyflakes (#137)
Make also minor PEP8 coding style fixes on modified imports.
2017-03-27 16:05:26 +02:00
Victor Stinner 12c4aba1a0 Merge 3.5 2017-01-12 11:53:09 +01:00
Victor Stinner de383289ea Issue #25591: Fix test_imaplib if ssl miss 2017-01-12 11:51:31 +01:00
R David Murray a7613aa06c Merge: #25591: improve imap tests. 2016-12-24 21:34:05 -05:00
R David Murray b079c07f7d #25591: improve imap tests.
Patch by Maciej Szulik.
2016-12-24 21:32:26 -05:00
Christian Heimes 727cc9337f Issue #28022: Catch another deprecation warning in imaplib 2016-09-11 22:47:02 +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 317f64f048 #21815: violate IMAP RFC to be compatible with, e.g., gmail
and others, including imaplib's own behavior.  I'm applying this only to 3.6
because there's a potential backward compatibility concern: if there are
servers that include ] characters in the 'text' portion of their imap
responses, this code change could introduce a new bug.

Patch by Lita Cho, reviewed by Jessica McKellar, Berker Peksag, Maciej Szulik,
silentghost, and me (I fleshed out the comments with the additional
info/concerns.)
2016-01-02 17:18:34 -05:00
Martin Panter 42347100bf Issue #20220: Merge time zone workaround from 3.4 into 3.5 2015-11-16 09:42:41 +00:00
Martin Panter 6e0889f0c7 Issue #20220: Add DST rules to work around glibc quirk
This was triggering intermittent failures in unrelated tests.
2015-11-16 07:21:38 +00:00
Robert Collins 5ccc18f298 Issue #23779: imaplib raises TypeError if authenticator tries to abort.
Patch from Craig Holmquist.
2015-07-31 08:59:02 +12:00
Robert Collins 78378e8939 Issue #23779: imaplib raises TypeError if authenticator tries to abort.
Patch from Craig Holmquist.
2015-07-31 09:01:38 +12:00
R David Murray a6429db4b8 #21800: Add RFC 6855 support to imaplib.
Original patch by Milan Oberkirch, updated by myself and
Maciej Szulik.
2015-05-10 19:17:23 -04:00
Benjamin Peterson f9284ae8ed merge 3.4 (#22921) 2014-11-23 17:06:39 -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
Serhiy Storchaka 38684c3663 imaplib.IMAP4 now supports the context manager protocol.
Original patch by Tarek Ziadé.
2014-09-09 19:07:49 +03:00
Antoine Pitrou cac9e719cc Issue #22111: Assorted cleanups in test_imaplib. Patch by Milan Oberkirch. 2014-07-31 18:35:45 -04:00
Zachary Ware 66f2928479 Issue #18492: Allow all resources when tests are not run by regrtest.py.
This changeset also includes cleanup allowed by this behavior change.
2014-06-02 16:01:29 -05:00
Christian Heimes aab99fdd65 test_imaplib: skip check_hostname test when SNI is not available 2013-12-15 19:39:32 +01:00
Charles-François Natali 9b116e8b02 Issue #19857: Make sure that test_imaplib reaps server threads even in face of
error upon client disconnection.
2013-12-07 20:27:41 +01:00
Christian Heimes 48aae57996 Issue #19782: imaplib now supports SSLContext.check_hostname and server name
indication for TLS/SSL connections.
2013-12-02 20:01:29 +01:00
Georg Brandl b89b5df9c9 merge with 3.3 2013-10-27 07:46:09 +01:00
Georg Brandl ca580f4ec1 Issue #16039: CVE-2013-1752: Change use of readline in imaplib module to limit
line length.  Patch by Emil Lind.
2013-10-27 06:52:14 +01:00
Ezio Melotti 5c67e22145 #17333: merge with 3.3. 2013-03-02 14:33:05 +02:00
Ezio Melotti 02bf701b25 #17333: test_imaplib now works with unittest test discovery. Patch by Zachary Ware. 2013-03-02 14:25:56 +02:00
R David Murray 8aa164b395 Merge: #13700: Make imap.authenticate with authobject work.
This fixes a bytes/string confusion in the API which prevented
custom authobjects from working at all.

Original patch by Erno Tukia.
2013-02-19 12:20:32 -05:00
R David Murray 6cd6f01556 Merge: #13700: Make imap.authenticate with authobject work.
This fixes a bytes/string confusion in the API which prevented
custom authobjects from working at all.

Original patch by Erno Tukia.
2013-02-19 12:19:13 -05:00
R David Murray 774a39f26e #13700: Make imap.authenticate with authobject work.
This fixes a bytes/string confusion in the API which prevented
custom authobjects from working at all.

Original patch by Erno Tukia.
2013-02-19 12:17:31 -05:00
Andrew Svetlov f7a17b48d7 Replace IOError with OSError (#16715) 2012-12-25 16:47:37 +02:00
Andrew Svetlov 5b89840d9c Issue #16714: use 'raise' exceptions, don't 'throw'.
Patch by Serhiy Storchaka.
2012-12-18 21:26:36 +02:00
Andrew Svetlov 737fb89dd1 Issue #16714: use 'raise' exceptions, don't 'throw'.
Patch by Serhiy Storchaka.
2012-12-18 21:14:22 +02:00
Alexander Belopolsky 648921371e fixed whitespace 2012-06-22 21:10:50 -04:00
Alexander Belopolsky 8141cc7f88 Issues #11024: Fixes and additional tests for Time2Internaldate. 2012-06-22 21:03:39 -04:00
Nick Coghlan e51e25a3bc Merge from 3.2 (Issue #15095: Use better assertions in test_imaplib) 2012-06-17 21:15:45 +10:00
Nick Coghlan e6ef462243 Issue #15095: Use better assertions in test_imaplib 2012-06-17 21:10:21 +10:00
Alexander Belopolsky 5a38f80f9c Issue #10941: Fix imaplib.Internaldate2tuple to produce correct result near
the DST transition.  Patch by Joe Peterson.
2012-04-29 16:12:27 -04:00
Alexander Belopolsky 2420d83158 Issue #10941: Fix imaplib.Internaldate2tuple to produce correct result near
the DST transition.  Patch by Joe Peterson.
2012-04-29 15:56:49 -04:00
Antoine Pitrou 0872816dc1 Issue #8808: The IMAP4_SSL constructor now allows passing an SSLContext
parameter to control parameters of the secure channel.  Patch by Sijin
Joseph.
2011-05-06 18:49:52 +02:00
Antoine Pitrou 924cbea467 Use transient_internet() consistently in test_imaplib 2011-03-23 03:10:14 +01:00
Alexander Belopolsky 7dabf16f69 Issue #10939: Make Internaldate2tuple test more robust. 2011-01-29 19:49:40 +00:00