From a0379ebd7134317293f8fadb9a8057db3d688d48 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 28 Aug 2020 17:44:00 +0200 Subject: [PATCH] Skip logout on not authenticated --- .../com/sun/mail/imap/protocol/IMAPProtocol.java | 3 +++ patches/JavaMail.patch | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/sun/mail/imap/protocol/IMAPProtocol.java b/app/src/main/java/com/sun/mail/imap/protocol/IMAPProtocol.java index ff300bbfde..3b22fdfaed 100644 --- a/app/src/main/java/com/sun/mail/imap/protocol/IMAPProtocol.java +++ b/app/src/main/java/com/sun/mail/imap/protocol/IMAPProtocol.java @@ -462,6 +462,9 @@ public class IMAPProtocol extends Protocol { */ public void logout() throws ProtocolException { try { + if (!authenticated) + return; + Response[] r = command("LOGOUT", null); authenticated = false; diff --git a/patches/JavaMail.patch b/patches/JavaMail.patch index fc901ba7ad..58478c72cd 100644 --- a/patches/JavaMail.patch +++ b/patches/JavaMail.patch @@ -286,8 +286,18 @@ diff -rupN /home/marcel/JavaMail/mail/src/main/java/com/sun/mail/imap/IMAPStore. // around the loop waiting for IDLE to complete, but we can't diff -rupN /home/marcel/JavaMail/mail/src/main/java/com/sun/mail/imap/protocol/IMAPProtocol.java ./app/src/main/java/com/sun/mail/imap/protocol/IMAPProtocol.java --- /home/marcel/JavaMail/mail/src/main/java/com/sun/mail/imap/protocol/IMAPProtocol.java 2020-08-14 11:44:05.406359065 +0200 -+++ ./app/src/main/java/com/sun/mail/imap/protocol/IMAPProtocol.java 2020-08-27 19:52:40.106269950 +0200 -@@ -627,6 +627,59 @@ public class IMAPProtocol extends Protoc ++++ ./app/src/main/java/com/sun/mail/imap/protocol/IMAPProtocol.java 2020-08-28 17:41:28.427621762 +0200 +@@ -462,6 +462,9 @@ public class IMAPProtocol extends Protoc + */ + public void logout() throws ProtocolException { + try { ++ if (!authenticated) ++ return; ++ + Response[] r = command("LOGOUT", null); + + authenticated = false; +@@ -627,6 +630,59 @@ public class IMAPProtocol extends Protoc authenticated = true; }