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.
This commit is contained in:
Carnë Draug 2018-06-13 13:13:50 +01:00
parent 950702d605
commit 2257e12b63
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: