Check if username is provided before trying plain authentication.

If the username value is not provided on the configuration file, then
username if of NoneType and NULL.join will bomb since Nones can't be
joined with strings.  So check if username is empty and raise an
exception if so.

Github-ref: https://github.com/OfflineIMAP/offlineimap/issues/558
Signed-off-by: David Miguel Susano Pinto <carandraug+dev@gmail.com>
Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Carnë Draug 2018-06-13 13:13:50 +01:00 committed by Nicolas Sebrecht
parent 5f9474e10d
commit c9005cd4ff
1 changed files with 5 additions and 0 deletions

View File

@ -199,6 +199,11 @@ class IMAPServer(object):
http://tools.ietf.org/html/rfc4616"""
authc = self.username
if not authc:
raise OfflineImapError("No username provided for '%s'"
% self.repos.getname(),
OfflineImapError.ERROR.REPO)
passwd = self.__getpassword()
authz = b''
if self.user_identity != None: