all the upper level libraries that use it, including urllib2.
Added and fixed some tests, and changed docs correspondingly.
Thanks to John J Lee for the patch and the pusing, :)
- Factor out the duplication of EHLO/HELO in login() and sendmail() to
a new function, ehlo_or_helo_if_needed().
- Use ehlo_or_helo_if_needed() in starttls()
- Check for the starttls exception in starttls() in the same way as
login() checks for the auth extension.
Contributed by Bill Fenner.
* Much expanded test suite:
All protocols tested against all other protocols.
All protocols tested with all certificate options.
Tests for bad key and bad cert.
Test of STARTTLS functionality.
Test of RAND_* functions.
* Fixes for threading/malloc bug.
* Issue 1065 fixed:
sslsocket class renamed to SSLSocket.
sslerror class renamed to SSLError.
Function "wrap_socket" now used to wrap an existing socket.
* Issue 1583946 finally fixed:
Support for subjectAltName added.
Subject name now returned as proper DN list of RDNs.
* SSLError exported from socket as "sslerror".
* RAND_* functions properly exported from ssl.py.
* Documentation improved:
Example of how to create a self-signed certificate.
Better indexing.
1) Improve the documentation of the SSL module, with a fuller
explanation of certificate usage, another reference, proper
formatting of this and that.
2) Fix Windows bug in ssl.py, and general bug in sslsocket.close().
Remove some unused code from ssl.py. Allow accept() to be called on
sslsocket sockets.
3) Use try-except-else in import of ssl in socket.py. Deprecate use of
socket.ssl().
4) Remove use of socket.ssl() in every library module, except for
test_socket_ssl.py and test_ssl.py.
Found them using::
find . -name '*.py' | while read i ; do grep 'def[^(]*( ' $i /dev/null ; done
find . -name '*.py' | while read i ; do grep ' ):' $i /dev/null ; done
(I was doing this all over my own code anyway, because I'd been using spaces in
all defs, so I thought I'd make a run on the Python code as well. If you need
to do such fixes in your own code, you can use xx-rename or parenregu.el within
emacs.)
smtplib can not log in to some server using command AUTH PLAIN, it sends
``user\0user\0pass'' to the server, but ``\0user\0pass'' has better
compatibility.
The problem was that it expected rfc822.parseaddr() to return None
upon a parse failure. The actual, documented return value for a
parse failure is (None, None).
Closes SF bug 602029.
which requires that if there are ehlo parameters returned with an ehlo
keyword (in the response to EHLO), the keyword and parameters must be
delimited by an ASCII space. Thus responses like
250-AUTH=LOGIN
should be ignored as non-conformant to the RFC (the `=' isn't allowed
in the ehlo keyword).
This is a bug fix candidate.
better local_hostname default. According to RFC 2821, it is
recommended that the fqdn hostname be provided in the EHLO/HELO verb
and if that can't be calculated, to use a domain literal.
The rationale for this change is documented in SF patch #497736 which
also had privacy concerns about leaking the fqdn in the EHLO/HELO. We
decided this wasn't a big concern because no user data is leaked, and
the IP will always be leaked. The local_hostname argument is provided
for those clients that are super paranoid.
Using localhost.localdomain may break some strict smtp servers so we
decided against using it as the default.
This patch adds the features from RFC 2487 (Secure SMTP
over TLS) to the smtplib module:
- A starttls() function
- Wrapper classes that simulate enough of sockets and
files for smtplib, but really wrap a SSLObject
- reset the list of known SMTP extensions at each call
of ehlo(). This should have been the case anyway.