From 97babb50c75a520f405eddd0b405d5d1f7f33267 Mon Sep 17 00:00:00 2001
From: "Rob Swindell (on Windows)" <rob@synchro.net>
Date: Mon, 6 Feb 2023 11:56:01 -0800
Subject: [PATCH] If the FastCGI address starts with a '/', it's obviously a
 UNIX domain socket

We don't really need the "unix:" prefix now, but just leave that support in
for backward compatibility.
---
 src/sbbs3/websrvr.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/sbbs3/websrvr.c b/src/sbbs3/websrvr.c
index e729db7609..7f06ec4581 100644
--- a/src/sbbs3/websrvr.c
+++ b/src/sbbs3/websrvr.c
@@ -3929,7 +3929,7 @@ static SOCKET fastcgi_connect(const char *orig_path, SOCKET client_sock)
 	ulong val;
 	SOCKET sock;
 
-	if (strncmp(path, "unix:", 5) == 0) {
+	if (*path == '/' || strncmp(path, "unix:", 5) == 0) {
 #if defined(_WIN32) && !defined(UDS_SUPPORT)
 		lprintf(LOG_ERR, "%04d UNIX DOMAIN SOCKETS ARE NOT SUPPORTED in %s", client_sock, __FUNCTION__);
 		return INVALID_SOCKET;
@@ -3945,7 +3945,10 @@ static SOCKET fastcgi_connect(const char *orig_path, SOCKET client_sock)
 		}
 
 		addr.sun_family = AF_UNIX;
-		SAFECOPY(addr.sun_path, path + 5);
+		if(*path == '/')
+			SAFECOPY(addr.sun_path, path);
+		else
+			SAFECOPY(addr.sun_path, path + 5);
 #ifdef SUN_LEN
 		addr_len = SUN_LEN(&addr);
 #else
-- 
GitLab