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 craigh
Recipients craigh
Date 2015-03-25.22:21:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1427322083.72.0.863898159285.issue23779@psf.upfronthosting.co.za>
In-reply-to
Content
If the authenticator object passed to the IMAP authenticate method tries to abort the handshake by returning None, TypeError is raised instead of sending the * line to the server.

>>> import imaplib
>>> imap = imaplib.IMAP4_SSL('imap.gmail.com')
>>> imap.authenticate(b'PLAIN', lambda x: None)
Traceback (most recent call last):
  File "<pyshell#5>", line 1, in <module>
    imap.authenticate(b'PLAIN', lambda x: None)
  File "C:\Python34\lib\imaplib.py", line 380, in authenticate
    typ, dat = self._simple_command('AUTHENTICATE', mech)
  File "C:\Python34\lib\imaplib.py", line 1133, in _simple_command
    return self._command_complete(name, self._command(name, *args))
  File "C:\Python34\lib\imaplib.py", line 940, in _command
    self.send(literal)
  File "C:\Python34\lib\imaplib.py", line 276, in send
    self.sock.sendall(data)
  File "C:\Python34\lib\ssl.py", line 723, in sendall
    v = self.send(data[count:])
  File "C:\Python34\lib\ssl.py", line 684, in send
    v = self._sslobj.write(data)
TypeError: 'str' does not support the buffer interface

The problem is that _Authenticator.process returns a string instead of bytes in this case.
History
Date User Action Args
2015-03-25 22:21:23craighsetrecipients: + craigh
2015-03-25 22:21:23craighsetmessageid: <1427322083.72.0.863898159285.issue23779@psf.upfronthosting.co.za>
2015-03-25 22:21:23craighlinkissue23779 messages
2015-03-25 22:21:23craighcreate