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:25:27 +0100
commit293d9ba46f66a2d80f13cf87fe31db4eda9c61a7 (patch)
treeb13381266b9984324a88e2bee3a91ac302d92c3a
parent1d8288977316750e97b706ee537abe15bf94bd2b (diff)
downloadgnutls-293d9ba46f66a2d80f13cf87fe31db4eda9c61a7.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 19b27eb82c..13d47103b7 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 */