From eecb31ac9a55b6d60a0d5f956375b35a7a5c0363 Mon Sep 17 00:00:00 2001 From: Andris Reinman Date: Thu, 4 Jan 2024 10:38:13 +0200 Subject: [PATCH] fix(pop3): if connection is closed during authentication, then do not process the response. Fixes #596 --- lib/pop3/connection.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/pop3/connection.js b/lib/pop3/connection.js index b553b73a..9b7ba5a1 100644 --- a/lib/pop3/connection.js +++ b/lib/pop3/connection.js @@ -390,6 +390,11 @@ class POP3Connection extends EventEmitter { }, this.session, (err, response) => { + if (!this.session) { + // already closed, do nothing + return; + } + if (err) { this.logger.info( { @@ -438,6 +443,7 @@ class POP3Connection extends EventEmitter { username, 'USER' ); + this.session.user = response.user; this.openMailbox(err => {