* 'VirtualMailManager/VirtualMailManager.py'
authorPascal Volk <neverseen@users.sourceforge.net>
Fri, 29 Aug 2008 03:28:25 +0000
changeset 70 a3663ad491bf
parent 69 0c124160a991
child 71 4c94ba297698
* 'VirtualMailManager/VirtualMailManager.py' - Fixed DIGEST-MD5 hash generation.
VirtualMailManager/VirtualMailManager.py
--- a/VirtualMailManager/VirtualMailManager.py	Wed Aug 27 20:42:41 2008 +0000
+++ b/VirtualMailManager/VirtualMailManager.py	Fri Aug 29 03:28:25 2008 +0000
@@ -391,8 +391,8 @@
         elif self.__scheme == 'PLAIN-MD5':
             return _md5.hexdigest()
         elif self.__scheme == 'DIGEST-MD5' and emailaddress is not None:
-            _md5 = md5.new('%s:%s:' % tuple(emailaddress.split('@')))
-            _md5.update(password)
+            # use an empty realm - works better with usenames like user@dom
+            _md5 = md5.new('%s::%s' % (emailaddress, password))
             return _md5.hexdigest()
 
     def __pwMD4(self, password):
@@ -635,11 +635,10 @@
     def userPassword(self, emailaddress, password):
         acc = self.__getAccount(emailaddress)
         if acc.getUID() == 0:
-           raise VMMException(_(u"Account doesn't exists"),
-               ERR.NO_SUCH_ACCOUNT)
+           raise VMMException(_(u"Account doesn't exists"), ERR.NO_SUCH_ACCOUNT)
         if password is None:
             password = self._readpass()
-        acc.modify('password', self.__pwhash(password))
+        acc.modify('password', self.__pwhash(password, user=emailaddress))
 
     def userName(self, emailaddress, name):
         acc = self.__getAccount(emailaddress)