From e63bf13bc03ef4b921d13217fd353b2cc093a61e Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Sat, 6 Oct 2018 22:31:35 +0000
Subject: [PATCH] Don't call putmsgptrs() from logout() unless the SS_USERON
 sys_status flag is set: this insures that uninitialized msg-scan ptrs/cfg
 won't be written to disk unless a successful logon()/getmsgptrs() was called
 first. This probably fixes the sighting that echicken reported where a failed
 SSH login caused his sub-scan config file (data/user/0001.subs) to contain
 uninitialized/garbage values. logout() could be called from multiple places
 (e.g. JS and Baja modules), even before a successful login is completed, so
 this sighting is not entirely impractical.

---
 src/sbbs3/logout.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/sbbs3/logout.cpp b/src/sbbs3/logout.cpp
index a8dc0d08ba..5c58d2ac68 100644
--- a/src/sbbs3/logout.cpp
+++ b/src/sbbs3/logout.cpp
@@ -108,7 +108,9 @@ void sbbs_t::logout()
 		remove(path);
 
 	delfiles(cfg.temp_dir,ALLFILES);
-	putmsgptrs();
+	if(sys_status&SS_USERON) {	// Insures the useron actually when through logon()/getmsgptrs() first
+		putmsgptrs();
+	}
 	if(!REALSYSOP)
 		logofflist();
 	useron.laston=(time32_t)now;
-- 
GitLab