[issue13700] imaplib.IMAP4.authenticate authobject fails with PLAIN mechanism

2012-04-14 Thread Simonas Kazlauskas
Simonas Kazlauskas simo...@kazlauskas.me added the comment: Exactly same thing happens with `XOAUTH` mechanism too, so this bug report should be made more general. (Py3.2.2) -- nosy: +nagisa ___ Python tracker rep...@bugs.python.org

[issue13700] imaplib.IMAP4.authenticate authobject fails with PLAIN mechanism

2012-04-03 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: I made some time to work on this today. Attached is a new patch. I've incorporated the tests from the existing patches (though I'm doing the infrastructure a bit differently). PLAIN seems to be a specific case of the general

[issue13700] imaplib.IMAP4.authenticate authobject fails with PLAIN mechanism

2012-02-04 Thread Johannes Bauer
Johannes Bauer dfnsonfsdu...@gmx.de added the comment: Issue also affects Python3.1. Hunk succeeds against 3.1 imaplib.py and works for me. -- nosy: +joebauer versions: +Python 3.1 ___ Python tracker rep...@bugs.python.org

[issue13700] imaplib.IMAP4.authenticate authobject fails with PLAIN mechanism

2012-01-03 Thread Erno Tukia
Erno Tukia erno.tu...@iki.fi added the comment: In Python 2.6 PLAIN authentication works, in Python 3.1 not. Lib/test/test_imaplib.py does not test IMAP4.authenticate() or IMAP4.login_cram_md5() functions, only IMAP4.login(). I would still like to go back to imaplib._Authenticator.encode()

[issue13700] imaplib.IMAP4.authenticate authobject fails with PLAIN mechanism

2012-01-03 Thread Erno Tukia
Erno Tukia erno.tu...@iki.fi added the comment: I tried to fix the problem and the correct fix is to change oup = '' to oup = b'' in imaplib._Authenticator.encode() function, and not what I suggested in my previous post. After changing that PLAIN authentication works. --

[issue13700] imaplib.IMAP4.authenticate authobject fails with PLAIN mechanism

2012-01-03 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: Would you be interested in providing a patch that includes tests? I think Antoine set up a test framework for testing the login as part of issue 4471. -- ___ Python tracker

[issue13700] imaplib.IMAP4.authenticate authobject fails with PLAIN mechanism

2012-01-03 Thread Erno Tukia
Erno Tukia erno.tu...@iki.fi added the comment: Here's a patch with test. I am not an IMAP guru, so please verify my patch. -- keywords: +patch Added file: http://bugs.python.org/file24132/issue13700.patch ___ Python tracker rep...@bugs.python.org

[issue13700] imaplib.IMAP4.authenticate authobject fails with PLAIN mechanism

2012-01-03 Thread Erno Tukia
Erno Tukia erno.tu...@iki.fi added the comment: Here's another patch that should fix the CRAM-MD5 authentication. My previous patch is required with this one. The patch includes a test. -- Added file: http://bugs.python.org/file24134/cram_md5.patch

[issue13700] imaplib.IMAP4.authenticate authobject fails with PLAIN mechanism

2012-01-02 Thread Erno Tukia
New submission from Erno Tukia erno.tu...@iki.fi: import imaplib imap = imaplib.IMAP4_SSL(imap.example.com) authcb = lambda resp: {0}\x00{0}\x00{1}.format(username,password) imap.authenticate(PLAIN, authcb) Traceback (most recent call last): File pyshell#3, line 1, in module

[issue13700] imaplib.IMAP4.authenticate authobject fails with PLAIN mechanism

2012-01-02 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: The first argument to authenticate must be bytes. This is not well documented. It might also be a bug, since I'm not sure anyone has done a thorough audit of what should be bytes and what should be string in imaplib. 3.1 no longer

[issue13700] imaplib.IMAP4.authenticate authobject fails with PLAIN mechanism

2012-01-02 Thread Erno Tukia
Erno Tukia erno.tu...@iki.fi added the comment: The same problems exists even if I use bPLAIN as the first argument in authenticate(). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13700

[issue13700] imaplib.IMAP4.authenticate authobject fails with PLAIN mechanism

2012-01-02 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: Gah, I was looking at the wrong source code when I wrote that. A string first argument is indeed valid. I'm not sure where the problem is coming from since the internal CRAM_MD5 returns a string and that seems to work... --

[issue13700] imaplib.IMAP4.authenticate authobject fails with PLAIN mechanism

2012-01-02 Thread Erno Tukia
Erno Tukia erno.tu...@iki.fi added the comment: File /usr/lib/python3.1/imaplib.py, line 1257, in encode e = binascii.b2a_base64(t) imaplib._Authenticator.encode() calls binascii.b2a_base64() function. In Python 2.6 that function returns a string, and in Python 3.1 it returns bytes. What

[issue13700] imaplib.IMAP4.authenticate authobject fails with PLAIN mechanism

2012-01-02 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: Bytes definitely. We hashed that out a while ago. My point is that CRAM_MD5 login calls authenticate, and its authenticator returns a string, just like your example does. So it ought to be going through the same code path. I haven't