summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2009-11-02 11:25:27 +0100
committerSimon Josefsson <simon@josefsson.org>2009-11-02 11:31:44 +0100
commit087fdeec5076ae1270f460685d8d36a50d9c3822 (patch)
treedba2353b7576527ab8d5d76008fff3d6cb872cbd
parent6a0dcf393892704d3bbb9e5fe762c62251bde20f (diff)
downloadgnutls-087fdeec5076ae1270f460685d8d36a50d9c3822.tar.gz
Fix time bomb in chainverify self-test.
Reported by Andreas Metzler <ametzler@downhill.at.eu.org> in <http://thread.gmane.org/gmane.comp.encryption.gpg.gnutls.devel/3925>.
-rw-r--r--tests/chainverify.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/chainverify.c b/tests/chainverify.c
index 0192da2d0f..16c59ee865 100644
--- a/tests/chainverify.c
+++ b/tests/chainverify.c
@@ -32,6 +32,21 @@
#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 */