From 04340d911b1e7282cdb7411962eeb2de34c5309e Mon Sep 17 00:00:00 2001
From: "Rob Swindell (on Debian Linux)" <rob@synchro.net>
Date: Thu, 12 Sep 2024 16:40:41 -0700
Subject: [PATCH] Close any open message base after input timeout (5 minutes)

As Nelgin pointed out, the nntpservice can leave a message bases open while
a client is idle. Normally, an inactive client would be disconnected after 5
minutes of inactivity, so that wouldn't be much of an issue. However, if
authenticated as a user with the H-exemption, no auto-disconnection after
input timeout would happen. So let's close any open message base for good
measure.

The input/receive timeout probably should be configurable and lowered to
a smaller duration (one minute?). I'll leave that for another commit.
---
 exec/nntpservice.js | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/exec/nntpservice.js b/exec/nntpservice.js
index 4743c7daa0..4b220559d7 100644
--- a/exec/nntpservice.js
+++ b/exec/nntpservice.js
@@ -199,6 +199,8 @@ while(client.socket.is_connected && !quit) {
 	cmdline = client.socket.recvline(1024 /*maxlen*/, 300 /*timeout*/);
 
 	if(cmdline==null) {
+		if(msgbase && msgbase.is_open)
+			msgbase.close();
 		if(client.socket.is_connected) {
 			if(user.security.exemptions&UFLAG_H)
 				continue;
-- 
GitLab