This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author j.l.caceres
Recipients ajaksu2, j.l.caceres, kalevi, loewis, marcin.bachry, miwa, r.david.murray, toastedrobot
Date 2009-05-23.22:34:32
SpamBayes Score 0.0019626652
Marked as misclassified No
Message-id <>
There is a similar problem that I found with encode_cram_md5 in, SMTP.login() method. I used the solution proposed by miwa, 
both for PLAIN and CRAM MD5 authentication. Additionally, for the last 
one, I had to introduce a second correction and byte encode the 
password string when passing it to hmac.HMAC.  

I do not know if I did things correctly, but just in case it can help  
here is the complete patch that I used and worked well with the two 
AUTH methods. I keep the original and modified lines for clarity.

def encode_cram_md5(challenge, user, password):
            challenge = base64.decodestring(challenge)
            #response = user + " " + hmac.HMAC(password,    
            response = user + " " + hmac.HMAC(password.encode(), 
            #return encode_base64(response)
            return encode_base64((response).encode('ascii'), eol='')
        def encode_plain(user, password):
            #return encode_base64("\0%s\0%s" % (user, password))
            return encode_base64(("\0%s\0%s" % (user, password)).encode
('ascii'), eol='')
Date User Action Args
2009-05-23 22:34:36j.l.caceressetrecipients: + j.l.caceres, loewis, ajaksu2, marcin.bachry, r.david.murray, miwa, kalevi, toastedrobot
2009-05-23 22:34:35j.l.caceressetmessageid: <>
2009-05-23 22:34:34j.l.cacereslinkissue5259 messages
2009-05-23 22:34:33j.l.cacerescreate