imapserver.py: Implement STARTTLS
If we do not use a SSL connection anyway and if the server supports it, authenticate automatically with STARTTLS. Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
416df0fc44
commit
6311716edb
@ -13,6 +13,9 @@ others.
|
||||
New Features
|
||||
------------
|
||||
|
||||
* Added StartTLS support, it will automatically be used if the server
|
||||
supports it.
|
||||
|
||||
Changes
|
||||
-------
|
||||
|
||||
|
@ -233,11 +233,18 @@ class IMAPServer:
|
||||
self.connectionlock.release()
|
||||
|
||||
if not self.gssapi:
|
||||
if 'STARTTLS' in imapobj.capabilities and not\
|
||||
self.usessl:
|
||||
self.ui.debug('imap',
|
||||
'Using STARTTLS connection')
|
||||
imapobj.starttls()
|
||||
|
||||
if 'AUTH=CRAM-MD5' in imapobj.capabilities:
|
||||
self.ui.debug('imap',
|
||||
'Attempting CRAM-MD5 authentication')
|
||||
'Attempting CRAM-MD5 authentication')
|
||||
try:
|
||||
imapobj.authenticate('CRAM-MD5', self.md5handler)
|
||||
imapobj.authenticate('CRAM-MD5',
|
||||
self.md5handler)
|
||||
except imapobj.error, val:
|
||||
self.plainauth(imapobj)
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user