From: Nikos Mavrogiannopoulos Date: Mon, 27 Jan 2014 15:04:02 +0000 (+0100) Subject: Added check for gnutls_db_check_entry_time(). X-Git-Tag: gnutls_3_3_0pre0~243 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6dcbd344e93f4def413b9a81dffa92901db4767a;p=thirdparty%2Fgnutls.git Added check for gnutls_db_check_entry_time(). --- diff --git a/tests/resume.c b/tests/resume.c index c238a8667e..3579e88681 100644 --- a/tests/resume.c +++ b/tests/resume.c @@ -469,6 +469,8 @@ static void wrap_db_deinit(void) static int wrap_db_store(void *dbf, gnutls_datum_t key, gnutls_datum_t data) { + time_t t, now = time(0); + if (debug) { unsigned int i; fprintf(stderr, "resume db storing (%d-%d): ", key.size, @@ -484,6 +486,13 @@ wrap_db_store(void *dbf, gnutls_datum_t key, gnutls_datum_t data) fprintf(stderr, "\n"); } + /* check the correctness of gnutls_db_check_entry_time() */ + t = gnutls_db_check_entry_time(&data); + if (t < now - 10 || t > now + 10) { + fail("Time returned by gnutls_db_check_entry_time is bogus\n"); + exit(1); + } + if (cache_db == NULL) return -1;