[Twisted-Python] smtp-server: issue with checkers.FilePasswordDB and hash

aleuser at inwind.it aleuser at inwind.it
Sun Apr 4 20:41:32 EDT 2010

Hi all,
   I use FilePasswordDB with a small smtp-server (a very small toy), but when 
I use the hash function the authentication doesn't work.

Here few lines of code:
def _hash(name, clearpsw, hashedpsw):
    # a very simple hash function ?
    return md5.md5(clearpsw).hexdigest()
    # return 'aa'

# doesn't work; password file content is correctly "hashed"
smtpusers = checkers.FilePasswordDB('smtppasswords.txt', caseSensitive=True, 
hash=_hash, cache=True)

# work! in the file the passwords are in plain text
#smtpusers = checkers.FilePasswordDB('smtppasswords.txt', caseSensitive=True, 

mailservice = mail.MailService()
smtpserver = mailservice.getESMTPFactory()
application = service.Application("Console SMTP Server")
internet.TCPServer(SMTP_PORT, smtpserver).setServiceParent(application)

The error is:
Failure: twisted.cred.error.UnhandledCredentials: No checker for twisted.cred.

Obviously FilePasswordDB doesn't provide that credential when there is the 
hash function; why smtp connection is hashed and not in plaintext? How can I 
get it works?

I found a similar question, with no answer:


More information about the Twisted-Python mailing list