From 1e3a3e7e47336ceaee07cc495c728e35f4ac9fc6 Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Sat, 11 May 2019 23:51:04 +0200 Subject: Drop socket when receiving unexpected untagged * BYE. Reported against 6.3.26 by minorwiping@vfemail.net when polling from imap.yandex.com and it looped on "* BYE Autologout; idle for too long" in response to a A0001 CAPABILITY request. --- imap.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/imap.c b/imap.c index 7eb3dc42..edad9581 100644 --- a/imap.c +++ b/imap.c @@ -72,6 +72,10 @@ static int imap_untagged_response(int sock, const char *buf) * connection to be cut-off after this */ if (outlevel > O_SILENT) report(stderr, GT_("Received BYE response from IMAP server: %s\n"), buf + 5); + return PS_SOCKET; /* tell caller to not touch the socket any longer. + Note this is under stage != STAGE_LOGOUT, so when + we are logging out properly, we will complete the + protocol exchange. */ } else if (strstr(buf, " EXISTS")) { -- cgit v1.2.3