[svn] GnuPG - r5471 - in branches/STABLE-BRANCH-1-4: . g10 util
svn author wk
cvs at cvs.gnupg.org
Wed Oct 27 12:59:13 CEST 2010
Author: wk
Date: 2010-10-27 12:59:11 +0200 (Wed, 27 Oct 2010)
New Revision: 5471
Modified:
branches/STABLE-BRANCH-1-4/ChangeLog
branches/STABLE-BRANCH-1-4/THANKS
branches/STABLE-BRANCH-1-4/acinclude.m4
branches/STABLE-BRANCH-1-4/configure.ac
branches/STABLE-BRANCH-1-4/g10/ChangeLog
branches/STABLE-BRANCH-1-4/g10/keygen.c
branches/STABLE-BRANCH-1-4/g10/keyid.c
branches/STABLE-BRANCH-1-4/util/ChangeLog
branches/STABLE-BRANCH-1-4/util/miscutil.c
Log:
Detect unsigned time_t and adjust y2038 detection.
Modified: branches/STABLE-BRANCH-1-4/ChangeLog
===================================================================
--- branches/STABLE-BRANCH-1-4/ChangeLog 2010-10-27 07:37:52 UTC (rev 5470)
+++ branches/STABLE-BRANCH-1-4/ChangeLog 2010-10-27 10:59:11 UTC (rev 5471)
@@ -1,3 +1,8 @@
+2010-10-27 Werner Koch <wk at g10code.com>
+
+ * acinclude.m4 (GNUPG_TIME_T_UNSIGNED): New.
+ * configure.ac: Call AC_HEADER_TIME and GNUPG_TIME_T_UNSIGNED.
+
2010-10-18 Werner Koch <wk at g10code.com>
Release 1.4.11.
Modified: branches/STABLE-BRANCH-1-4/g10/ChangeLog
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/ChangeLog 2010-10-27 07:37:52 UTC (rev 5470)
+++ branches/STABLE-BRANCH-1-4/g10/ChangeLog 2010-10-27 10:59:11 UTC (rev 5471)
@@ -1,3 +1,10 @@
+2010-10-27 Werner Koch <wk at g10code.com>
+
+ * keygen.c (ask_expire_interval): Print 2038 warning only for 32
+ bit signed time_t.
+ * keyid.c (mk_datestr): Do the y2038 test only for a signed time_t.
+ (INVALID_TIME_CHECK): New.
+
2010-10-20 Werner Koch <wk at g10code.com>
* encr-data.c (decode_filter): Cast -1 to size_t. Reported by
Modified: branches/STABLE-BRANCH-1-4/util/ChangeLog
===================================================================
--- branches/STABLE-BRANCH-1-4/util/ChangeLog 2010-10-27 07:37:52 UTC (rev 5470)
+++ branches/STABLE-BRANCH-1-4/util/ChangeLog 2010-10-27 10:59:11 UTC (rev 5471)
@@ -1,3 +1,8 @@
+2010-10-27 Werner Koch <wk at g10code.com>
+
+ * miscutil.c (INVALID_TIME_CHECK): New.
+ (strtimestamp, isotimestamp, asctimestamp): Use it.
+
2010-09-28 Steven M. Schweda <sms at antinode.info> (wk)
Changes to help the VMS port. See
Modified: branches/STABLE-BRANCH-1-4/THANKS
===================================================================
--- branches/STABLE-BRANCH-1-4/THANKS 2010-10-27 07:37:52 UTC (rev 5470)
+++ branches/STABLE-BRANCH-1-4/THANKS 2010-10-27 10:59:11 UTC (rev 5471)
@@ -93,6 +93,7 @@
Jan Niehusmann jan at gondor.com
Janusz A. Urbanowicz alex at bofh.torun.pl
James Troup james at nocrew.org
+Jason Woodward jason dot woodward at timesys dot com
Jean-loup Gailly gzip at prep.ai.mit.edu
Jeff Long long at kestrel.cc.ukans.edu
Jeffery Von Ronne jronne at ics.uci.edu
Modified: branches/STABLE-BRANCH-1-4/acinclude.m4
===================================================================
--- branches/STABLE-BRANCH-1-4/acinclude.m4 2010-10-27 07:37:52 UTC (rev 5470)
+++ branches/STABLE-BRANCH-1-4/acinclude.m4 2010-10-27 10:59:11 UTC (rev 5471)
@@ -45,6 +45,33 @@
])
+# GNUPG_TIME_T_UNSIGNED
+# Check whether time_t is unsigned
+#
+AC_DEFUN([GNUPG_TIME_T_UNSIGNED],
+ [ AC_CACHE_CHECK(whether time_t is unsigned, gnupg_cv_time_t_unsigned,
+ [AC_REQUIRE([AC_HEADER_TIME])dnl
+ AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY(
+ [AC_INCLUDES_DEFAULT([])
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+],
+ [((time_t)-1) < 0])],
+ gnupg_cv_time_t_unsigned=no, gnupg_cv_time_t_unsigned=yes)])
+ if test $gnupg_cv_time_t_unsigned = yes; then
+ AC_DEFINE(HAVE_UNSIGNED_TIME_T,1,[Defined if time_t is an unsigned type])
+ fi
+])# GNUPG_TIME_T_UNSIGNED
+
+
dnl GNUPG_CHECK_GNUMAKE
dnl
AC_DEFUN([GNUPG_CHECK_GNUMAKE],
Modified: branches/STABLE-BRANCH-1-4/configure.ac
===================================================================
--- branches/STABLE-BRANCH-1-4/configure.ac 2010-10-27 07:37:52 UTC (rev 5470)
+++ branches/STABLE-BRANCH-1-4/configure.ac 2010-10-27 10:59:11 UTC (rev 5471)
@@ -956,6 +956,7 @@
AC_CHECK_SIZEOF(unsigned int)
AC_CHECK_SIZEOF(unsigned long)
AC_CHECK_SIZEOF(unsigned long long)
+AC_HEADER_TIME
AC_CHECK_SIZEOF(time_t,,[[
#include <stdio.h>
#if TIME_WITH_SYS_TIME
@@ -969,6 +970,7 @@
# endif
#endif
]])
+GNUPG_TIME_T_UNSIGNED
# Ensure that we have UINT64_C before we bother to check for uint64_t
AC_CHECK_HEADERS([inttypes.h])
Modified: branches/STABLE-BRANCH-1-4/g10/keygen.c
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/keygen.c 2010-10-27 07:37:52 UTC (rev 5470)
+++ branches/STABLE-BRANCH-1-4/g10/keygen.c 2010-10-27 10:59:11 UTC (rev 5471)
@@ -1789,7 +1789,7 @@
? _("Key expires at %s\n")
: _("Signature expires at %s\n"),
asctimestamp((ulong)(timestamp + interval) ) );
-#if SIZEOF_TIME_T <= 4
+#if SIZEOF_TIME_T <= 4 && !defined(HAVE_UNSIGNED_TIME_T)
if ((time_t)((ulong)(timestamp+interval)) < 0 )
tty_printf (_("Your system can't display dates beyond 2038.\n"
"However, it will be correctly handled up to"
Modified: branches/STABLE-BRANCH-1-4/g10/keyid.c
===================================================================
--- branches/STABLE-BRANCH-1-4/g10/keyid.c 2010-10-27 07:37:52 UTC (rev 5470)
+++ branches/STABLE-BRANCH-1-4/g10/keyid.c 2010-10-27 10:59:11 UTC (rev 5471)
@@ -33,6 +33,14 @@
#include "keydb.h"
#include "i18n.h"
+#ifdef HAVE_UNSIGNED_TIME_T
+# define INVALID_TIME_CHECK(a) ((a) == (time_t)(-1))
+#else
+ /* Error or 32 bit time_t and value after 2038-01-19. */
+# define INVALID_TIME_CHECK(a) ((a) < 0)
+#endif
+
+
int
pubkey_letter( int algo )
{
@@ -444,12 +452,8 @@
{
struct tm *tp;
- /* Note: VMS uses an unsigned time_t thus the compiler yields a
- warning here. You may ignore this warning or def out this test
- for VMS. The proper way to handle this would be a configure
- test to a detect properly implemented unsigned time_t. */
- if ( atime < 0 ) /* 32 bit time_t and after 2038-01-19 */
- strcpy (buffer, "????" "-??" "-??"); /* mark this as invalid */
+ if (INVALID_TIME_CHECK (atime))
+ strcpy (buffer, "????" "-??" "-??"); /* Mark this as invalid. */
else {
tp = gmtime (&atime);
sprintf (buffer,"%04d-%02d-%02d",
Modified: branches/STABLE-BRANCH-1-4/util/miscutil.c
===================================================================
--- branches/STABLE-BRANCH-1-4/util/miscutil.c 2010-10-27 07:37:52 UTC (rev 5470)
+++ branches/STABLE-BRANCH-1-4/util/miscutil.c 2010-10-27 10:59:11 UTC (rev 5471)
@@ -31,6 +31,13 @@
#include "util.h"
#include "i18n.h"
+#ifdef HAVE_UNSIGNED_TIME_T
+# define INVALID_TIME_CHECK(a) ((a) == (time_t)(-1))
+#else
+ /* Error or 32 bit time_t and value after 2038-01-19. */
+# define INVALID_TIME_CHECK(a) ((a) < 0)
+#endif
+
/****************
* I know that the OpenPGP protocol has a Y2106 problem ;-)
*/
@@ -117,8 +124,8 @@
static char buffer[11+5];
struct tm *tp;
time_t atime = stamp;
-
- if (atime < 0) {
+
+ if (INVALID_TIME_CHECK (atime)) {
strcpy (buffer, "????" "-??" "-??");
}
else {
@@ -140,7 +147,7 @@
struct tm *tp;
time_t atime = stamp;
- if (atime < 0) {
+ if (INVALID_TIME_CHECK (atime)) {
strcpy (buffer, "????" "-??" "-??" " " "??" ":" "??" ":" "??");
}
else {
@@ -216,10 +223,11 @@
struct tm *tp;
time_t atime = stamp;
- if (atime < 0) {
+ if (INVALID_TIME_CHECK (atime))
+ {
strcpy (buffer, "????" "-??" "-??");
return buffer;
- }
+ }
tp = localtime( &atime );
#ifdef HAVE_STRFTIME
More information about the Gnupg-commits
mailing list