summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2013-11-16 09:33:58 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2013-11-16 10:31:32 +0100
commit8f143858de895e8ab0dbee66508ecbf143d6d41d (patch)
treebad81ac8dbc1d469091b570bbda70c41c0c96417
parent968299d3b8d4e6d761157225a5de4b0bbf18d4e7 (diff)
downloadgnutls-8f143858de895e8ab0dbee66508ecbf143d6d41d.tar.gz
An expiration time of (time_t)-1 will set to the no well-defined expiration date value.
-rw-r--r--lib/x509/common.c5
-rw-r--r--lib/x509/x509_write.c2
2 files changed, 7 insertions, 0 deletions
diff --git a/lib/x509/common.c b/lib/x509/common.c
index 53cae80c06..dea8c03b96 100644
--- a/lib/x509/common.c
+++ b/lib/x509/common.c
@@ -706,6 +706,11 @@ gtime2generalTime(time_t gtime, char *str_time, size_t str_time_size)
{
size_t ret;
struct tm _tm;
+
+ if (gtime == (time_t)-1) {
+ snprintf(str_time, str_time_size, "99991231235959Z");
+ return 0;
+ }
if (!gmtime_r(&gtime, &_tm)) {
gnutls_assert();
diff --git a/lib/x509/x509_write.c b/lib/x509/x509_write.c
index 71f5a5d0d4..79b084a70a 100644
--- a/lib/x509/x509_write.c
+++ b/lib/x509/x509_write.c
@@ -884,6 +884,8 @@ gnutls_x509_crt_set_activation_time(gnutls_x509_crt_t cert,
* @exp_time: The actual time
*
* This function will set the time this Certificate will expire.
+ * Setting an expiration time of (time_t)-1 will set to the
+ * no well-defined expiration date value.
*
* Returns: On success, %GNUTLS_E_SUCCESS (0) is returned, otherwise a
* negative error value.