Message98295
There is bug in PLAIN mechanism's of smtplib. The generated base64 string fail when the password start with numbers. As long as I could find, the error occur in method encode_plain. Using the null character (\0) in hexadecimal representation (\x00) seems to fix the problem.
Origin of the problem:
def encode_plain(user, password):
return encode_base64("\0%s\0%s" % (user, password), eol="")
Proposed fix:
def encode_plain(user, password):
return encode_base64("\x00%s\x00%s" % (user, password), eol="")
Current result:
>>> from email.base64mime import encode as encode_base64
>>> import base64
>>> encode_base64("\0user\0123foo", eol="")
'AHVzZXIKM2Zvbw=='
>>> f = base64.decodestring('AHVzZXIKM2Zvbw==')
>>> f
'\x00user\n3foo'
Expected result:
>>> from email.base64mime import encode as encode_base64
>>> import base64
>>> encode_base64("\x00user\x00123foo", eol="")
'AHVzZXIAMTIzZm9v'
>>> f = base64.decodestring('AHVzZXIAMTIzZm9v')
>>> f
'\x00user\x00123foo' |
|
Date |
User |
Action |
Args |
2010-01-25 20:52:59 | surkamp | set | recipients:
+ surkamp |
2010-01-25 20:52:59 | surkamp | set | messageid: <1264452779.18.0.958137638395.issue7779@psf.upfronthosting.co.za> |
2010-01-25 20:52:57 | surkamp | link | issue7779 messages |
2010-01-25 20:52:56 | surkamp | create | |
|