]> git.sur5r.net Git - openldap/commitdiff
Apply ITS#294 y2k fix
authorKurt Zeilenga <kurt@openldap.org>
Fri, 17 Sep 1999 22:12:54 +0000 (22:12 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 17 Sep 1999 22:12:54 +0000 (22:12 +0000)
CHANGES
libraries/libldap/tmplout.c

diff --git a/CHANGES b/CHANGES
index 08b5e2853edb74a11660e13baf747958c877f74c..7b5f0118150734998ee6d0488719643872a0ca81 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -3,6 +3,7 @@ OpenLDAP Change Log
 Changes included in OpenLDAP 1.2 Release Engineering
        CVS Tag: OPENLDAP_REL_ENG_1_2
        Fixed slapd lint
+       Fixed -lldap templates y2k bug (ITS#294)
 
 Changes included in OpenLDAP 1.2.7
        CVS Tag: OPENLDAP_REL_ENG_1_2_7
index f40c343c52be4ebdb3b5e02a3bdf40a313180c82..d80b3774056e210edcbea9dbe5df71547e4c28be 100644 (file)
@@ -900,8 +900,17 @@ time2text( char *ldtimestr, int dateonly )
                /* POSIX says tm_year should be year - 1900 */
        t.tm_year = 100 * GET2BYTENUM( p ) - 1900;
                p += 2;
+               t.tm_year += GET2BYTENUM( p ); p += 2;
+
+       } else {
+               /* came without a century */
+               t.tm_year = GET2BYTENUM( p ); p += 2;
+
+               /* Y2K hack - 2 digit years < 70 are 21st century */
+               if( t.tm_year < 70 ) {
+                       t.tm_year += 100;
+               }
        }
-    t.tm_year = GET2BYTENUM( p ); p += 2;
 
     t.tm_mon = GET2BYTENUM( p ) - 1; p += 2;
     t.tm_mday = GET2BYTENUM( p ); p += 2;