New submission from Craig Holmquist:

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.

----------
components: Library (Lib)
files: imap_auth.patch
keywords: patch
messages: 239283
nosy: craigh
priority: normal
severity: normal
status: open
title: imaplib authenticate raises TypeError if authenticator tries to abort
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file38694/imap_auth.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23779>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to