cpython: a00842b783cf (original) (raw)

Mercurial > cpython

changeset 88212:a00842b783cf 3.3

Issue #19422: Explicitly disallow non-SOCK_STREAM sockets in the ssl module, rather than silently let them emit clear text data. [#19422]

Antoine Pitrou solipsis@pitrou.net
date Sat, 28 Dec 2013 17:26:33 +0100
parents 100f632d4306
children f7dc02e6987a a43e96695203
files Doc/library/ssl.rst Lib/ssl.py Lib/test/test_ssl.py Misc/NEWS
diffstat 4 files changed, 34 insertions(+), 8 deletions(-)[+] [-] Doc/library/ssl.rst 22 Lib/ssl.py 5 Lib/test/test_ssl.py 12 Misc/NEWS 3

line wrap: on

line diff

--- a/Doc/library/ssl.rst +++ b/Doc/library/ssl.rst @@ -141,13 +141,16 @@ instead. Takes an instance sock of :class:socket.socket, and returns an instance of :class:ssl.SSLSocket, a subtype of :class:socket.socket, which wraps

--- a/Lib/ssl.py +++ b/Lib/ssl.py @@ -111,6 +111,7 @@ else: from socket import getnameinfo as _getnameinfo from socket import error as socket_error from socket import socket, AF_INET, SOCK_STREAM, create_connection +from socket import SOL_SOCKET, SO_TYPE import base64 # for DER-to-PEM translation import traceback import errno @@ -296,6 +297,10 @@ class SSLSocket(socket): self.ssl_version = ssl_version self.ca_certs = ca_certs self.ciphers = ciphers

--- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -493,6 +493,18 @@ class BasicSocketTests(unittest.TestCase support.gc_collect() self.assertIn(r, str(cm.warning.args[0]))

+ + class ContextTests(unittest.TestCase): @skip_if_broken_ubuntu_ssl

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -29,6 +29,9 @@ Core and Builtins Library ------- +- Issue #19422: Explicitly disallow non-SOCK_STREAM sockets in the ssl