]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/tmplout.c
Update for new password codes for MSVC5
[openldap] / libraries / libldap / tmplout.c
index ead67ea0751709dcab010712edc38597ae5d1724..e804fe0be74e32349653fd5b8fd69289caeea443 100644 (file)
@@ -1,3 +1,4 @@
+/* $OpenLDAP$ */
 /*
  * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
@@ -11,6 +12,7 @@
 
 #include <stdio.h>
 
+#include <ac/socket.h>
 #include <ac/stdlib.h>
 
 #include <ac/ctype.h>
 #include <sys/file.h>
 #endif
 
-#include "lber.h"
-#include "ldap.h"
+#include <ldap.h>
+#include <disptmpl.h>
 
 #include "ldap_log.h"
-#include "disptmpl.h"
 
 #include "ldap-int.h"
 #include "ldap_defaults.h"
@@ -909,8 +910,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;