Permalink
Browse files

Use correct ssl purpose

The ssl contexts are created to authenticate servers so we should
use `ssl.Purpose.SERVER_AUTH` which is the default.

Fixes #317
  • Loading branch information...
NicolasLM committed Nov 30, 2017
1 parent cf62d40 commit a5c8cfc601b0159fc6a95edc7b4a9d9d7c87675a
Showing with 2 additions and 2 deletions.
  1. +1 −1 imapclient/config.py
  2. +1 −1 imapclient/tls.py
View
@@ -151,7 +151,7 @@ def create_client_from_config(conf, login=True):
ssl_context = None
if conf.ssl:
ssl_context = ssl.create_default_context(purpose=ssl.Purpose.CLIENT_AUTH)
ssl_context = ssl.create_default_context()
ssl_context.check_hostname = conf.ssl_check_hostname
if not conf.ssl_verify_cert:
ssl_context.verify_mode = ssl.CERT_NONE
View
@@ -27,7 +27,7 @@ def wrap_socket(sock, ssl_context, host):
return ssl.wrap_socket(sock)
if ssl_context is None:
ssl_context = ssl.create_default_context(purpose=ssl.Purpose.CLIENT_AUTH)
ssl_context = ssl.create_default_context()
return ssl_context.wrap_socket(sock, server_hostname=host)

0 comments on commit a5c8cfc

Please sign in to comment.