From d1182efcc1f98728ce721019b7bc8dc6413cc87a Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Fri, 30 Oct 2009 06:20:24 +0000
Subject: [PATCH] Initialize the sbbs_t::inbuf even when there is no
 input_thread() (prevents crash when including @pause@ in text/badhost.msg
 file). Don't set sbbs->client_socket to INVALID_SOCKET as that stops the
 output_thread() and prevents SSH and other stuff from working.

---
 src/sbbs3/main.cpp | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/src/sbbs3/main.cpp b/src/sbbs3/main.cpp
index 6e8bc56224..b15633a2b0 100644
--- a/src/sbbs3/main.cpp
+++ b/src/sbbs3/main.cpp
@@ -2960,10 +2960,9 @@ bool sbbs_t::init()
 	socklen_t	addr_len;
 	SOCKADDR_IN	addr;
 
-	if(cfg.node_num>0) {
-		RingBufInit(&inbuf, IO_THREAD_BUF_SIZE);
+	RingBufInit(&inbuf, IO_THREAD_BUF_SIZE);
+	if(cfg.node_num>0)
 		node_inbuf[cfg.node_num-1]=&inbuf;
-	}
 
     RingBufInit(&outbuf, IO_THREAD_BUF_SIZE);
 	outbuf.highwater_mark=startup->outbuf_highwater_mark;
@@ -3261,7 +3260,7 @@ sbbs_t::~sbbs_t()
 
 	if(cfg.node_num>0)
 		node_inbuf[cfg.node_num-1]=NULL;
-	if(cfg.node_num>0 && !input_thread_running)
+	if(!input_thread_running)
 		RingBufDispose(&inbuf);
 	if(!output_thread_running)
 		RingBufDispose(&outbuf);
@@ -4849,7 +4848,7 @@ NO_SSH:
 		}
 
     	sbbs->online=FALSE;
-		sbbs->client_socket=INVALID_SOCKET;
+//		sbbs->client_socket=INVALID_SOCKET;
 #ifdef USE_CRYPTLIB
 		sbbs->ssh_mode=false;
 #endif
@@ -5154,6 +5153,16 @@ NO_SSH:
 				continue;
 			if(node.status==NODE_WFC) {
 				node.status=NODE_LOGON;
+#ifdef USE_CRYPTLIB
+				if(ssh)
+					node.connection=NODE_CONNECTION_SSH;
+				else
+#endif
+				if(rlogin)
+					node.connection=NODE_CONNECTION_RLOGIN;
+				else
+					node.connection=NODE_CONNECTION_TELNET;
+
 				sbbs->putnodedat(i,&node);
 				break;
 			}
-- 
GitLab