Re: Millenium proofed

From: Arjan de Vet <Arjan.deVet@dont-contact.us>
Date: Wed, 7 Jan 1998 23:24:20 +0100 (CET)

In article <Pine.BSI.3.95.980107132629.424N-100000@valhalla.comshare.com> you write:

>Also, some of the logfiles are written by Squid with two-digit years that
>might confuse poorly-written logfile parsing routines when we hit 1/1/00,
>but that doesn't relate to Squid source code per se, aside from the fact
>that Squid could write four-digit dates to the logfiles in question.

I recently submitted this patch to squid-bugs to fix these problems but
I'm not sure whether I've already found all possible problems.

Arjan

diff -ur squid-1.1.19/lib/rfc1123.c squid-1.1.19-adv/lib/rfc1123.c
--- squid-1.1.19/lib/rfc1123.c Thu Oct 30 03:02:56 1997
+++ squid-1.1.19-adv/lib/rfc1123.c Fri Jan 2 23:32:57 1998
@@ -192,6 +192,9 @@
             tm.tm_mday = make_num(s);
             tm.tm_mon = make_month(s + 3);
             tm.tm_year = make_num(s + 7);
+ /* Y2K: if tm.tm_year < 70, assume it's after the year 2000 */
+ if (tm.tm_year < 70)
+ tm.tm_year += 100;
             tm.tm_hour = make_num(s + 10);
             tm.tm_min = make_num(s + 13);
             tm.tm_sec = make_num(s + 16);
diff -ur squid-1.1.19/src/cachemgr.c squid-1.1.19-adv/src/cachemgr.c
--- squid-1.1.19/src/cachemgr.c Wed Oct 8 19:10:23 1997
+++ squid-1.1.19-adv/src/cachemgr.c Fri Jan 2 23:21:51 1998
@@ -318,7 +318,7 @@
     struct tm *gmt;
 
     gmt = gmtime(&now);
- strftime(tbuf, 128, "%A, %d-%b-%y %H:%M:%S GMT", gmt);
+ strftime(tbuf, 128, "%a, %d-%b-%Y %H:%M:%S GMT", gmt);
 
     printf("<HR>\n");
     printf("<ADDRESS>\n");
diff -ur squid-1.1.19/src/debug.c squid-1.1.19-adv/src/debug.c
--- squid-1.1.19/src/debug.c Mon Apr 28 20:14:14 1997
+++ squid-1.1.19-adv/src/debug.c Fri Jan 2 23:09:47 1998
@@ -285,7 +285,7 @@
     static time_t last_t = 0;
     if (t != last_t) {
         tm = localtime(&t);
- strftime(buf, 127, "%y/%m/%d %H:%M:%S", tm);
+ strftime(buf, 127, "%Y/%m/%d %H:%M:%S", tm);
         last_t = t;
     }
     return buf;
diff -ur squid-1.1.19/src/ftpget.c squid-1.1.19-adv/src/ftpget.c
--- squid-1.1.19/src/ftpget.c Wed Oct 22 17:58:12 1997
+++ squid-1.1.19-adv/src/ftpget.c Fri Jan 2 23:25:19 1998
@@ -1009,7 +1021,7 @@
 
     when = t ? t : time(NULL);
     gmt = gmtime(&when);
- strftime(tbuf, 128, "%A, %d-%b-%y %H:%M:%S GMT", gmt);
+ strftime(tbuf, 128, "%a, %d-%b-%Y %H:%M:%S GMT", gmt);
     return tbuf;
 }
 
Received on Wed Jan 07 1998 - 14:29:13 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:38:20 MST