From c9005cd4ff3bf94653d7bbea7583cd544dccba40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carn=C3=AB=20Draug?= Date: Wed, 13 Jun 2018 13:13:50 +0100 Subject: [PATCH] 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 Signed-off-by: Nicolas Sebrecht --- offlineimap/imapserver.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/offlineimap/imapserver.py b/offlineimap/imapserver.py index 79163f2..311ab89 100644 --- a/offlineimap/imapserver.py +++ b/offlineimap/imapserver.py @@ -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: