From bc10e056004764e819318fd52e687490e4fc964e Mon Sep 17 00:00:00 2001 From: Sebastian Spaeth Date: Mon, 12 Sep 2011 09:50:43 +0200 Subject: [PATCH] Check for SSL module existence and only do fingerprint check then Python 2.5 has no ssl module, and we can therefor not get the server certificate for fingerprint verification. Add a check that disables fingerprint verification for python 2.5. Signed-off-by: Sebastian Spaeth Signed-off-by: Nicolas Sebrecht --- offlineimap/imaplibutil.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/offlineimap/imaplibutil.py b/offlineimap/imaplibutil.py index 609fd4d..5c94592 100644 --- a/offlineimap/imaplibutil.py +++ b/offlineimap/imaplibutil.py @@ -147,7 +147,8 @@ class WrappedIMAP4_SSL(UsefulIMAPMixIn, IMAP4_SSL): def open(self, host=None, port=None): super(WrappedIMAP4_SSL, self).open(host, port) - if self._fingerprint or not self.ca_certs: + if (self._fingerprint or not self.ca_certs) and\ + 'ssl' in locals(): # <--disable for python 2.5 # compare fingerprints fingerprint = sha1(self.sock.getpeercert(True)).hexdigest() if fingerprint != self._fingerprint: