From 096aa0765049d03e24f6436230842cd79ec77f3c Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Fri, 14 Dec 2018 14:28:06 -0500 Subject: [PATCH] Handle empty token with complete GSSAPI context This fixes a potential traceback when we try to unwrap(None). Tested-by: Stefan Hajnoczi Signed-off-by: Robbie Harwood Signed-off-by: Nicolas Sebrecht --- offlineimap/imapserver.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/offlineimap/imapserver.py b/offlineimap/imapserver.py index 5eef250..600ce65 100644 --- a/offlineimap/imapserver.py +++ b/offlineimap/imapserver.py @@ -292,6 +292,13 @@ class IMAPServer(object): if not self.gss_vc.complete: response = self.gss_vc.step(token) return response if response else "" + elif token is None: + # uh... context is complete, so there's no negotiation we can + # do. But we also don't have a token, so we can't send any + # kind of response. Empirically, some (but not all) servers + # seem to put us in this state, and seem fine with getting no + # GSSAPI content in response, so give it to them. + return "" # Don't bother checking qop because we're over a TLS channel # already. But hey, if some server started encrypting tomorrow,