From c9cd5d9c89fadf768fe3f4ea0b84540758c256bf Mon Sep 17 00:00:00 2001 From: Menno Smits Date: Tue, 21 Jul 2015 15:23:50 +1200 Subject: [PATCH] Fixed dumb bugs in certificate error handling --- imapclient/tls.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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): -- 2.43.0