From 48f64baecc84c3afd6ea242246b3053691b08dee Mon Sep 17 00:00:00 2001 From: Andrew Leary Date: Sat, 28 Jan 2017 07:45:44 -0500 Subject: [PATCH] Change storage format for the last OLR download date in users.data to ensure that the file will remain portable between the x86 and x86_64 versions. --- ChangeLog | 9 +++++++++ lib/users.h | 2 +- mbsebbs/newuser.c | 2 +- mbsebbs/offline.c | 22 ++++++++++------------ 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7b347a93..8a4b328a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +v1.0.6.14 28-Jan-2017 - Andrew Leary + + 1. Changed the storage format for the last OLR download + date to ensure that the users.data would remain portable + between the x86 and x86_64 versions. It should also now + properly reset the extension back to 0 with each new day. + + 2. Fixed a minor bug in the New User Registration function. + v1.0.6.13 15-Jan-2017 - Andrew Leary 1. Fixed mbfido using LFs instead of CRs in Notify messages. diff --git a/lib/users.h b/lib/users.h index f56af5f2..e270b1ac 100644 --- a/lib/users.h +++ b/lib/users.h @@ -151,7 +151,7 @@ struct userrec { char Password[Max_passlen+1];/* Plain password */ int Charset; /* Character set */ int OLRext; /* OLR extension counter */ - time_t OLRlast; /* OLR last download */ + char OLRlast[12]; /* OLR last download date */ }; diff --git a/mbsebbs/newuser.c b/mbsebbs/newuser.c index c2383945..3c3ff9c6 100644 --- a/mbsebbs/newuser.c +++ b/mbsebbs/newuser.c @@ -105,7 +105,7 @@ int newuser(void) /* Set default editor */ if (strlen(CFG.externaleditor)) - exitinfo.MsgEditor = EXTEDIT; + usrconfig.MsgEditor = EXTEDIT; else usrconfig.MsgEditor = FSEDIT; diff --git a/mbsebbs/offline.c b/mbsebbs/offline.c index 40f30bbc..454a6d6c 100644 --- a/mbsebbs/offline.c +++ b/mbsebbs/offline.c @@ -594,7 +594,7 @@ void OLR_SyncTags() /* * If the user has no .olrtagsfile yet, we silently create * a new one. The user will not be notified of new areas - * of coarse. + * of course. */ Syslog('m', "Creating %s", Tagname); if ((fp = fopen(Tagname, "w")) != NULL) { @@ -1160,9 +1160,9 @@ char *Extensions[] = { */ void OLR_DownBW() { - struct tm *tp, *tq; - time_t Now, Last; - char Pktname[32], *Work, *Temp, *cwd = NULL, *p; + struct tm *tp; + time_t Now; + char Pktname[32], *Work, *Temp, Temp2[12], *cwd = NULL, *p; int Area = 0; int RetVal = FALSE, rc = 0; FILE *fp, *tf, *mf, *af; @@ -1191,17 +1191,15 @@ void OLR_DownBW() Temp = calloc(PATH_MAX, sizeof(char)); Now = time(NULL); - Last = exitinfo.OLRlast; tp = localtime(&Now); - tq = localtime(&Last); - /* Zero all fields except the dates */ - tq->tm_sec = tq->tm_min = tq->tm_hour = tq->tm_wday = tq->tm_yday = tq->tm_isdst = 0; - tp->tm_sec = tp->tm_min = tp->tm_hour = tp->tm_wday = tp->tm_yday = tp->tm_isdst = 0; - if ((mktime(tp)) != (mktime(tq))) { /* Last download wasn't today */ + /* Build today's date for comparison to last download date */ + + snprintf(Temp2, 12, "%02d-%02d-%04d", tp->tm_mday, tp->tm_mon +1, tp->tm_year +1900); + + if (strcmp(Temp2,exitinfo.OLRlast)) { /* Last download wasn't today */ exitinfo.OLRext = 0; } - tp = localtime(&Now); Syslog('+', "Preparing Blue Wave packet"); snprintf(Pktname, 32, "%s%s%d", CFG.bbsid , Extensions[tp->tm_wday], exitinfo.OLRext); Syslog('m', "Packet name %s", Pktname); @@ -1429,7 +1427,7 @@ void OLR_DownBW() exitinfo.OLRext++; if (exitinfo.OLRext > 9) exitinfo.OLRext = 0; /* After 9, go back to 0 */ - exitinfo.OLRlast = Now; /* Save the last download date/time */ + snprintf(exitinfo.OLRlast, 12, "%s", Temp2); /* Save the last download date/time */ WriteExitinfo(); }