Commit b51e1cc5 authored by rswindell's avatar rswindell
Browse files

Eliminated the "LOCAL_TZ/TIMEZONE" system toggle option and server/service

startup option - we will *always* use the local timezone. If the sysop wants to
use GMT/UTC, they should configure their operating system accordingly.
parent da8b7dcb
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2008 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -711,9 +711,6 @@ int main(int argc, char **argv)
SAFECOPY(scfg.temp_dir,"../temp");
prep_dir(scfg.ctrl_dir, scfg.temp_dir, sizeof(scfg.temp_dir));
if(!(scfg.sys_misc&SM_LOCAL_TZ))
putenv("TZ=UTC0");
if(argv[1][0]=='*' || argv[1][0]=='-') {
if(argv[1][1]=='?') {
printf(usage);
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2008 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -133,9 +133,6 @@ int main(int argc, char **argv)
load_cfg(&cfg, NULL, TRUE, str);
chdir(cfg.ctrl_dir);
if(!(cfg.sys_misc&SM_LOCAL_TZ))
putenv("TZ=UTC0");
dirnum=libnum=-1;
if(argv[1][0]=='*')
misc|=ALL;
......
......@@ -10,7 +10,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2007 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2008 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -175,9 +175,6 @@ int main(int argc, char **argv)
SAFECOPY(scfg.temp_dir,"../temp");
prep_dir(scfg.ctrl_dir, scfg.temp_dir, sizeof(scfg.temp_dir));
if(!(scfg.sys_misc&SM_LOCAL_TZ))
putenv("TZ=UTC0");
dirnum=libnum=-1;
if(argv[1][0]=='*')
misc|=ALL;
......
......@@ -997,16 +997,6 @@ BOOL js_generate_index(JSContext* js_cx, JSObject* parent,
#endif /* ifdef JAVASCRIPT */
static time_t checktime(void)
{
struct tm tm;
memset(&tm,0,sizeof(tm));
tm.tm_year=94;
tm.tm_mday=1;
return(mktime(&tm)-0x2D24BD00L);
}
BOOL upload_stats(ulong bytes)
{
char str[MAX_PATH+1];
......@@ -4680,16 +4670,8 @@ void DLLCALL ftp_server(void* arg)
if(startup->host_name[0]==0)
SAFECOPY(startup->host_name,scfg.sys_inetaddr);
if(!(scfg.sys_misc&SM_LOCAL_TZ) && !(startup->options&FTP_OPT_LOCAL_TIMEZONE)) {
if(putenv("TZ=UTC0"))
lprintf(LOG_ERR,"!putenv() FAILED");
tzset();
if((t=checktime())!=0) { /* Check binary time */
lprintf(LOG_ERR,"!TIME PROBLEM (%ld)",t);
cleanup(1,__LINE__);
return;
}
if((t=checktime())!=0) { /* Check binary time */
lprintf(LOG_ERR,"!TIME PROBLEM (%ld)",t);
}
if(uptime==0)
......
......@@ -116,11 +116,10 @@ static struct init_field ftp_init_fields[] = {
#define FTP_OPT_NO_HOST_LOOKUP (1<<11)
#define FTP_OPT_NO_RECYCLE (1<<27) /* Disable recycling of server */
#define FTP_OPT_NO_JAVASCRIPT (1<<29) /* JavaScript disabled */
#define FTP_OPT_LOCAL_TIMEZONE (1<<30) /* Don't force UTC/GMT */
#define FTP_OPT_MUTE (1<<31)
/* ftp_startup_t.options bits that require re-init/recycle when changed */
#define FTP_INIT_OPTS (FTP_OPT_LOCAL_TIMEZONE)
#define FTP_INIT_OPTS (0)
#if defined(STARTUP_INI_BITDESC_TABLES)
static ini_bitdesc_t ftp_options[] = {
......@@ -138,7 +137,6 @@ static ini_bitdesc_t ftp_options[] = {
{ FTP_OPT_NO_HOST_LOOKUP ,"NO_HOST_LOOKUP" },
{ FTP_OPT_NO_RECYCLE ,"NO_RECYCLE" },
{ FTP_OPT_NO_JAVASCRIPT ,"NO_JAVASCRIPT" },
{ FTP_OPT_LOCAL_TIMEZONE ,"LOCAL_TIMEZONE" },
{ FTP_OPT_MUTE ,"MUTE" },
/* terminator */
{ 0 ,NULL }
......
......@@ -959,9 +959,6 @@ int main(int argc, char **argv, char** environ)
if(host_name==NULL)
host_name=scfg.sys_inetaddr;
if(!(scfg.sys_misc&SM_LOCAL_TZ))
putenv("TZ=UTC0");
#if defined(__unix__)
if(daemonize) {
fprintf(statfp,"\nRunning as daemon\n");
......
......@@ -302,16 +302,6 @@ int sockprintf(SOCKET sock, char *fmt, ...)
return(len);
}
static time_t checktime(void)
{
struct tm tm;
memset(&tm,0,sizeof(tm));
tm.tm_year=94;
tm.tm_mday=1;
return(mktime(&tm)-0x2D24BD00L);
}
static void recverror(SOCKET socket, int rd, int line)
{
if(rd==0)
......@@ -4360,16 +4350,8 @@ void DLLCALL mail_server(void* arg)
if(startup->host_name[0]==0)
SAFECOPY(startup->host_name,scfg.sys_inetaddr);
if(!(scfg.sys_misc&SM_LOCAL_TZ) && !(startup->options&MAIL_OPT_LOCAL_TIMEZONE)) {
if(putenv("TZ=UTC0"))
lprintf(LOG_ERR,"!putenv() FAILED");
tzset();
if((t=checktime())!=0) { /* Check binary time */
lprintf(LOG_ERR,"!TIME PROBLEM (%ld)",t);
cleanup(1);
return;
}
if((t=checktime())!=0) { /* Check binary time */
lprintf(LOG_ERR,"!TIME PROBLEM (%ld)",t);
}
if(uptime==0)
......
......@@ -146,13 +146,12 @@ static struct init_field mail_init_fields[] = {
#define MAIL_OPT_RELAY_AUTH_CRAM_MD5 (1<<25)
#define MAIL_OPT_NO_AUTO_EXEMPT (1<<26) /* Do not auto DNSBL-exempt recipient e-mail addresses */
#define MAIL_OPT_NO_RECYCLE (1<<27) /* Disable recycling of server */
#define MAIL_OPT_LOCAL_TIMEZONE (1<<30) /* Don't force UTC/GMT */
#define MAIL_OPT_MUTE (1<<31)
#define MAIL_OPT_RELAY_AUTH_MASK (MAIL_OPT_RELAY_AUTH_PLAIN|MAIL_OPT_RELAY_AUTH_LOGIN|MAIL_OPT_RELAY_AUTH_CRAM_MD5)
/* mail_startup_t.options bits that require re-init/recycle when changed */
#define MAIL_INIT_OPTS (MAIL_OPT_ALLOW_POP3|MAIL_OPT_NO_SENDMAIL|MAIL_OPT_LOCAL_TIMEZONE)
#define MAIL_INIT_OPTS (MAIL_OPT_ALLOW_POP3|MAIL_OPT_NO_SENDMAIL)
#if defined(STARTUP_INI_BITDESC_TABLES)
static ini_bitdesc_t mail_options[] = {
......@@ -185,7 +184,6 @@ static ini_bitdesc_t mail_options[] = {
{ MAIL_OPT_RELAY_AUTH_CRAM_MD5 ,"RELAY_AUTH_CRAM_MD5" },
{ MAIL_OPT_NO_AUTO_EXEMPT ,"NO_AUTO_EXEMPT" },
{ MAIL_OPT_NO_RECYCLE ,"NO_RECYCLE" },
{ MAIL_OPT_LOCAL_TIMEZONE ,"LOCAL_TIMEZONE" },
{ MAIL_OPT_MUTE ,"MUTE" },
/* terminator */
{ 0 ,NULL }
......
......@@ -4029,16 +4029,6 @@ void sbbs_t::daily_maint(void)
}
}
time_t checktime(void)
{
struct tm tm;
memset(&tm,0,sizeof(tm));
tm.tm_year=94;
tm.tm_mday=1;
return(mktime(&tm)-0x2D24BD00L);
}
const char* DLLCALL js_ver(void)
{
#ifdef JAVASCRIPT
......@@ -4311,16 +4301,8 @@ void DLLCALL bbs_thread(void* arg)
if(startup->host_name[0]==0)
SAFECOPY(startup->host_name,scfg.sys_inetaddr);
if(!(scfg.sys_misc&SM_LOCAL_TZ) && !(startup->options&BBS_OPT_LOCAL_TIMEZONE)) {
if(putenv("TZ=UTC0"))
lprintf(LOG_ERR,"!putenv() FAILED");
tzset();
if((t=checktime())!=0) { /* Check binary time */
lprintf(LOG_ERR,"!TIME PROBLEM (%ld)",t);
cleanup(1);
return;
}
if((t=checktime())!=0) { /* Check binary time */
lprintf(LOG_ERR,"!TIME PROBLEM (%ld)",t);
}
if(uptime==0)
......
......@@ -125,9 +125,6 @@ int main(int argc, char **argv)
exit(1);
}
if(!(scfg.sys_misc&SM_LOCAL_TZ))
putenv("TZ=UTC0");
now=time(NULL);
memset(&user,0,sizeof(user));
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2006 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2008 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -173,7 +173,6 @@ static const char* usage = "\nusage: %s [[setting] [...]] [path/ini_file]\n"
#ifdef __unix__
"\tnd do not read run as daemon - overrides .ini file\n"
#endif
"\tlt use local timezone (do not force UTC/GMT)\n"
"\tdefaults show default settings and options\n"
"\n"
;
......@@ -1659,19 +1658,6 @@ int main(int argc, char** argv)
return(1);
}
break;
case 'L': /* Local */
switch(toupper(*(arg++))) {
case 'T': /* timezone */
bbs_startup.options |=BBS_OPT_LOCAL_TIMEZONE;
ftp_startup.options |=BBS_OPT_LOCAL_TIMEZONE;
mail_startup.options |=BBS_OPT_LOCAL_TIMEZONE;
services_startup.options|=BBS_OPT_LOCAL_TIMEZONE;
break;
default:
show_usage(argv[0]);
return(1);
}
break;
default:
show_usage(argv[0]);
......
......@@ -153,7 +153,7 @@ typedef struct {
#define SM_CELERITY (1L<<10) /* Expand Celerity color codes in messages */
#define SM_RENEGADE (1L<<11) /* Expand Renegade color codes in messages */
#define SM_ECHO_PW (1L<<12) /* Echo passwords locally */
#define SM_LOCAL_TZ (1L<<13) /* Use local timezone representations */
#define SM_UNUSED (1L<<13) /* Defaults to *on* (used to SM_LOCAL_TZ) */
#define SM_AUTO_DST (1L<<14) /* Automatic Daylight Savings Toggle (US) */
#define SM_R_SYSOP (1L<<15) /* Allow remote sysop logon/commands */
#define SM_QUOTE_EM (1L<<16) /* Allow quoting of e-mail */
......
......@@ -250,16 +250,6 @@ static void status(char* str)
startup->status(startup->cbdata,str);
}
static time_t checktime(void)
{
struct tm tm;
memset(&tm,0,sizeof(tm));
tm.tm_year=94;
tm.tm_mday=1;
return(mktime(&tm)-0x2D24BD00L);
}
/* Global JavaScript Methods */
static JSBool
......@@ -1737,16 +1727,8 @@ void DLLCALL services_thread(void* arg)
if(startup->host_name[0]==0)
SAFECOPY(startup->host_name,scfg.sys_inetaddr);
if(!(scfg.sys_misc&SM_LOCAL_TZ) && !(startup->options&BBS_OPT_LOCAL_TIMEZONE)) {
if(putenv("TZ=UTC0"))
lprintf(LOG_ERR,"!putenv() FAILED");
tzset();
if((t=checktime())!=0) { /* Check binary time */
lprintf(LOG_ERR,"!TIME PROBLEM (%ld)",t);
cleanup(1);
return;
}
if((t=checktime())!=0) { /* Check binary time */
lprintf(LOG_ERR,"!TIME PROBLEM (%ld)",t);
}
if(uptime==0)
......
......@@ -98,7 +98,7 @@ static struct init_field services_init_fields[] = {
#define SERVICE_OPT_FULL_ACCEPT (1<<4) /* Accept/close connections when server is full */
/* services_startup_t.options bits that require re-init/recycle when changed */
#define SERVICE_INIT_OPTS (BBS_OPT_LOCAL_TIMEZONE)
#define SERVICE_INIT_OPTS (0)
#if defined(STARTUP_INI_BITDESC_TABLES) || defined(SERVICES_INI_BITDESC_TABLE)
static ini_bitdesc_t service_options[] = {
......
......@@ -160,12 +160,11 @@ static struct init_field {
#define BBS_OPT_NO_RECYCLE (1<<27) /* Disable recycling of server */
#define BBS_OPT_GET_IDENT (1<<28) /* Get Identity (RFC 1413) */
#define BBS_OPT_NO_JAVASCRIPT (1<<29) /* JavaScript disabled */
#define BBS_OPT_LOCAL_TIMEZONE (1<<30) /* Don't force UTC/GMT */
#define BBS_OPT_MUTE (1<<31) /* Mute sounds */
/* bbs_startup_t.options bits that require re-init/recycle when changed */
#define BBS_INIT_OPTS (BBS_OPT_ALLOW_RLOGIN|BBS_OPT_ALLOW_SSH|BBS_OPT_NO_EVENTS|BBS_OPT_NO_SPY_SOCKETS \
|BBS_OPT_NO_JAVASCRIPT|BBS_OPT_LOCAL_TIMEZONE)
|BBS_OPT_NO_JAVASCRIPT)
#if defined(STARTUP_INI_BITDESC_TABLES)
static ini_bitdesc_t bbs_options[] = {
......@@ -185,7 +184,6 @@ static ini_bitdesc_t bbs_options[] = {
{ BBS_OPT_NO_RECYCLE ,"NO_RECYCLE" },
{ BBS_OPT_GET_IDENT ,"GET_IDENT" },
{ BBS_OPT_NO_JAVASCRIPT ,"NO_JAVASCRIPT" },
{ BBS_OPT_LOCAL_TIMEZONE ,"LOCAL_TIMEZONE" },
{ BBS_OPT_MUTE ,"MUTE" },
/* terminator */
{ 0 ,NULL }
......
......@@ -5352,12 +5352,6 @@ void DLLCALL web_server(void* arg)
if(startup->host_name[0]==0)
SAFECOPY(startup->host_name,scfg.sys_inetaddr);
if(!(scfg.sys_misc&SM_LOCAL_TZ) && !(startup->options&BBS_OPT_LOCAL_TIMEZONE)) {
if(putenv("TZ=UTC0"))
lprintf(LOG_WARNING,"!putenv() FAILED");
tzset();
}
if(uptime==0)
uptime=time(NULL); /* this must be done *after* setting the timezone */
......
......@@ -121,7 +121,7 @@ static struct init_field web_init_fields[] = {
#define WEB_OPT_HTTP_LOGGING (1<<6) /* Create/write-to HttpLogFile */
/* web_startup_t.options bits that require re-init/recycle when changed */
#define WEB_INIT_OPTS (BBS_OPT_LOCAL_TIMEZONE|WEB_OPT_HTTP_LOGGING)
#define WEB_INIT_OPTS (WEB_OPT_HTTP_LOGGING)
#if defined(STARTUP_INI_BITDESC_TABLES)
static ini_bitdesc_t web_options[] = {
......@@ -138,7 +138,6 @@ static ini_bitdesc_t web_options[] = {
{ BBS_OPT_NO_RECYCLE ,"NO_RECYCLE" },
{ BBS_OPT_GET_IDENT ,"GET_IDENT" },
{ BBS_OPT_NO_JAVASCRIPT ,"NO_JAVASCRIPT" },
{ BBS_OPT_LOCAL_TIMEZONE ,"LOCAL_TIMEZONE" },
{ BBS_OPT_MUTE ,"MUTE" },
/* terminator */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment