From c2dca953e5b5088f0d4d87dc248e350d3d26122e Mon Sep 17 00:00:00 2001
From: Rob Swindell <rob@synchro.net>
Date: Wed, 6 Oct 2021 18:37:53 -0700
Subject: [PATCH] When packing netmail (stored messages), don't discard
 non-zero zones

As reported by Ragnarok (DOCKSUD) via DOVE-Net, when packing (packetizing) netmail messages, the source and destination zones from the netmail header were discarded (since they are defined as "optional" in FTS-1) and the zone values were replaced with the system's primary/default zone number. If the netmail message included an INTL kludge, the source and destination zone values would be parsed from that kludge line and this issue would not be noticed.

So the fix is: Only if the netmail message header contains a source or destination zone number of 0, replace that zone with the system's primary/default zone number. As before, the INTL kludge zone information can override the header fields.

Also, there's no reason to force the point numbers from the header to zero, since if they were not valid (e.g. "fill" in the original FTS-1 specification), they would be already zero. So use the source and destination point numbers, as is, from the netmail header too (with the FMPT and TOPT kludge override support left in-tact).
---
 src/sbbs3/sbbsecho.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/sbbs3/sbbsecho.c b/src/sbbs3/sbbsecho.c
index 449d6aaabc..772c51c4a8 100644
--- a/src/sbbs3/sbbsecho.c
+++ b/src/sbbs3/sbbsecho.c
@@ -5377,8 +5377,10 @@ void pack_netmail(void)
 			lprintf(LOG_ERR,"ERROR line %d reading fido msghdr from %s",__LINE__,path);
 			continue;
 		}
-		hdr.destzone=hdr.origzone=sys_faddr.zone;
-		hdr.destpoint=hdr.origpoint=0;
+		if(hdr.destzone == 0)
+			hdr.destzone = sys_faddr.zone;
+		if(hdr.origzone == 0)
+			hdr.origzone = sys_faddr.zone;
 		getzpt(fidomsg,&hdr);				/* use kludge if found */
 		addr.zone		= hdr.destzone;
 		addr.net		= hdr.destnet;
-- 
GitLab