From 5b8577aef312011d38aaebf2bad2cb8a3cf66b84 Mon Sep 17 00:00:00 2001
From: Rob Swindell <rob@synchro.net>
Date: Wed, 17 Nov 2021 18:03:31 -0800
Subject: [PATCH] Don't use time_t in scfg_t definition

sbbsctrl.exe is built with Borland C++ still which only has a 32-bit time_t, so to keep the scfg_t definition compatible between MSVC and Borland builds, use time32_t (32-bit time_t) values only.

This fixes the reported sbbsctrl.exe error:
Error loading configuration
cfg->size (23944) != sizeof(scfg_t) (23952)

Introduced in commit e535aaac.
Reported via DOVE-Net by  Daryl Stout (TBOLT), confirmed by Nightfox (DIGDIST).
---
 src/sbbs3/scfgdefs.h | 2 +-
 src/sbbs3/ssl.c      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/sbbs3/scfgdefs.h b/src/sbbs3/scfgdefs.h
index 29087ffae0..fdd9d91419 100644
--- a/src/sbbs3/scfgdefs.h
+++ b/src/sbbs3/scfgdefs.h
@@ -620,7 +620,7 @@ typedef struct
 
 	// Run-time state information (not configuration)
 	int				tls_certificate;
-	time_t                  tls_cert_file_date;
+	time32_t        tls_cert_file_date;
 
 } scfg_t;
 
diff --git a/src/sbbs3/ssl.c b/src/sbbs3/ssl.c
index 047d09b10c..8f0588826d 100644
--- a/src/sbbs3/ssl.c
+++ b/src/sbbs3/ssl.c
@@ -291,7 +291,7 @@ CRYPT_CONTEXT get_ssl_cert(scfg_t *cfg, char **estr, int *level)
 		return -1;
 	pthread_mutex_lock(&ssl_cert_mutex);
 	SAFEPRINTF2(str,"%s%s",cfg->ctrl_dir,"ssl.cert");
-	time_t fd = fdate(str);
+	time32_t fd = (time32_t)fdate(str);
 	if (cfg->tls_certificate != -1 || !cfg->prepped) {
 		if (fd == cfg->tls_cert_file_date) {
 			pthread_mutex_unlock(&ssl_cert_mutex);
-- 
GitLab