/offlineimap/head: changeset 284

Working (and tested) CRAM-MD5 implementation.
This commit is contained in:
mj 2002-11-06 02:10:14 +01:00
parent 32713cb0d1
commit a2720a4d21

View File

@ -108,18 +108,9 @@ class IMAPServer:
ui = UIBase.getglobalui() ui = UIBase.getglobalui()
challenge = response.strip() challenge = response.strip()
ui.debug('imap', 'md5handler: got challenge %s' % challenge) ui.debug('imap', 'md5handler: got challenge %s' % challenge)
while len(challenge) < 64:
challenge += "\0"
if len(challenge) > 64: passwd = self.getpassword()
challenge = md5.new(challenge).digest() retval = self.username + ' ' + hmac.new(passwd, challenge).hexdigest()
ui.debug('imap', 'md5handler: post-processed challenge is %s' % \
repr(challenge))
msg = self.getpassword()
reply = hmac.new(challenge, msg)
retval = self.username + ' ' + \
reply.hexdigest()
ui.debug('imap', 'md5handler: returning %s' % retval) ui.debug('imap', 'md5handler: returning %s' % retval)
return retval return retval