/offlineimap/head: changeset 280

Falls back to plain-text auth if CRAM-MD5 fails. Fixes [complete.org
#42]
This commit is contained in:
jgoerzen 2002-11-05 00:38:39 +01:00
parent 8392575e33
commit b538581bf6
2 changed files with 12 additions and 4 deletions

View File

@ -3,6 +3,7 @@ offlineimap (3.99.3) unstable; urgency=low
* Moved password promting into imapserver.py. Passwords are now asked
for on-demand and typos will no longer crash the program (the user
will be re-prompted). Closes: #162672.
* Falls back to plain-text auth if CRAM-MD5 fails. Fixes [complete.org #42]
-- John Goerzen <jgoerzen@complete.org> Mon, 4 Nov 2002 11:16:11 -0600

View File

@ -115,6 +115,12 @@ class IMAPServer:
reply.hexdigest()
return retval
def plainauth(self, imapobj):
UIBase.getglobalui().debug('imap',
'Attempting plain authentication')
imapobj.login(self.username, self.getpassword())
def acquireconnection(self):
"""Fetches a connection from the pool, making sure to create a new one
if needed, to obey the maximum connection limits, etc.
@ -164,11 +170,12 @@ class IMAPServer:
if 'AUTH=CRAM-MD5' in imapobj.capabilities:
UIBase.getglobalui().debug('imap',
'Attempting CRAM-MD5 authentication')
imapobj.authenticate('CRAM-MD5', self.md5handler)
try:
imapobj.authenticate('CRAM-MD5', self.md5handler)
except imapobj.error, val:
self.plainauth(imapobj)
else:
UIBase.getglobalui().debug('imap',
'Attempting plain authentication')
imapobj.login(self.username, self.getpassword())
self.plainauth(imapobj)
# Would bail by here if there was a failure.
success = 1
except imapobj.error, val: