learn to disable STARTTLS

Some servers might have this feature broken.

Github-ref: https://github.com/OfflineIMAP/offlineimap/issues/207
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht
2016-06-23 03:55:00 +02:00
parent 1410a391bc
commit ac2a547ec4
3 changed files with 21 additions and 1 deletions

View File

@ -106,6 +106,7 @@ class IMAPServer(object):
self.fingerprint = repos.get_ssl_fingerprint()
self.sslversion = repos.getsslversion()
self.tlslevel = repos.gettlslevel()
self.starttls = repos.getstarttls()
self.oauth2_refresh_token = repos.getoauth2_refresh_token()
self.oauth2_access_token = repos.getoauth2_access_token()
@ -414,7 +415,7 @@ class IMAPServer(object):
# TLS must be initiated before checking capabilities:
# they could have been changed after STARTTLS.
if tryTLS and not tried_tls:
if tryTLS and self.starttls and not tried_tls:
tried_tls = True
self.__start_tls(imapobj)

View File

@ -261,6 +261,9 @@ class IMAPRepository(BaseRepository):
def getsslversion(self):
return self.getconf('ssl_version', None)
def getstarttls(self):
return self.getconfboolean('starttls', True)
def get_ssl_fingerprint(self):
"""Return array of possible certificate fingerprints.