Closed as not planned
Description
https://bugs.python.org/issue1210 introduced via fb5faf0 the removal of quoting of arguments.
The quoting code has been then removed via f241afa
Python 3 now sends broken IMAP protocol data.
Python 2 and 3 now behaves differently, see:
# python2.7 -c 'import imaplib; imap = imaplib.IMAP4_SSL("localhost", 993); imap.login("", "password")'
('RESP', '* OK [CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE LITERAL+ AUTH=PLAIN AUTH=LOGIN] Dovecot (Debian) ready.')
('DATA', 'BPAK0 CAPABILITY\r\n')
('RESP', '* CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE LITERAL+ AUTH=PLAIN AUTH=LOGIN')
('RESP', 'BPAK0 OK Pre-login capabilities listed, post-login capabilities have more.')
('DATA', 'BPAK1 LOGIN "" "password"\r\n')
('RESP', 'BPAK1 NO [AUTHENTICATIONFAILED] Authentication failed.')
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python2.7/imaplib.py", line 523, in login
raise self.error(dat[-1])
imaplib.error: [AUTHENTICATIONFAILED] Authentication failed.
vs:
# python3 -c 'import imaplib; imap = imaplib.IMAP4_SSL("localhost", 993); imap.login("", "password")'
RESP b'* OK [CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE LITERAL+ AUTH=PLAIN AUTH=LOGIN] Dovecot (Debian) ready.'
DATA b'BJOB0 CAPABILITY\r\n'
RESP b'* CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE LITERAL+ AUTH=PLAIN AUTH=LOGIN'
RESP b'BJOB0 OK Pre-login capabilities listed, post-login capabilities have more.'
DATA b'BJOB1 LOGIN "password"\r\n'
RESP b'BJOB1 BAD Error in IMAP command received by server.'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3.7/imaplib.py", line 597, in login
typ, dat = self._simple_command('LOGIN', user, self._quote(password))
File "/usr/lib/python3.7/imaplib.py", line 1199, in _simple_command
return self._command_complete(name, self._command(name, *args))
File "/usr/lib/python3.7/imaplib.py", line 1028, in _command_complete
raise self.error('%s command error: %s %s' % (name, typ, data))
imaplib.error: LOGIN command error: BAD [b'Error in IMAP command received by server.']
The broken IMAP data: b'BJOB1 LOGIN "password"\r\n'
.
I think the quoting / behavior of Python 2.7 should be restored.
It looks like it was accidentally removed.