]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Fix time bomb in chainverify self-test.
authorSimon Josefsson <simon@josefsson.org>
Mon, 2 Nov 2009 10:25:27 +0000 (11:25 +0100)
committerSimon Josefsson <simon@josefsson.org>
Mon, 2 Nov 2009 10:25:27 +0000 (11:25 +0100)
Reported by Andreas Metzler <ametzler@downhill.at.eu.org>
in <http://thread.gmane.org/gmane.comp.encryption.gpg.gnutls.devel/3925>.

tests/chainverify.c

index 19b27eb82c72b2864de0fab8cdd3ada94591633b..13d47103b77fbd50fa4a98f03a4006c2afed0b44 100644 (file)
 #include <gnutls/gnutls.h>
 #include <gnutls/x509.h>
 
+/* GnuTLS internally calls time() to find out the current time when
+   verifying certificates.  To avoid a time bomb, we hard code the
+   current time.  This should work fine on systems where the library
+   call to time is resolved at run-time.  */
+time_t
+time (time_t *t)
+{
+  time_t then = 1256803113;
+
+  if (t)
+    *t = then;
+
+  return then;
+}
+
 /* *INDENT-OFF* */
 
 /* Triggers incorrect verification success on older versions */