From: Menno Smits Date: Tue, 21 Jul 2015 03:23:50 +0000 (+1200) Subject: Fixed dumb bugs in certificate error handling X-Git-Tag: 1.0.0~1^2~57^2~1 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=c9cd5d9c89fadf768fe3f4ea0b84540758c256bf;p=imapclient.git Fixed dumb bugs in certificate error handling --- diff --git a/imapclient/tls.py b/imapclient/tls.py index 344b489..a750c2f 100644 --- a/imapclient/tls.py +++ b/imapclient/tls.py @@ -109,9 +109,9 @@ def wrap_socket(sock, ssl_context, hostname): try: return ssl_context.wrap_socket(sock, server_hostname=hostname) except ssl.CertificateError: - sock.shutdown() + sock.shutdown(socket.SHUT_RDWR) sock.close() - raise imaplib.Error("server certificate not valid for %s" % hostname) + raise imaplib.IMAP4.error("server certificate not valid for %s" % hostname) class IMAP4_TLS(imaplib.IMAP4):