summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2018-07-01 11:24:16 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2018-07-02 12:49:44 +0200
commit27e5059fa136ddb7b978caf72dacc0effbff55ef (patch)
tree0b4ddb99e72b76632bf7d26c72e2e5654c0c22f7
parent40783f122b033ae56fcf787ff86a7cbc461a9dc9 (diff)
downloadgnutls-27e5059fa136ddb7b978caf72dacc0effbff55ef.tar.gz
certtool: print information on time_t restrictions on failure
This informs the user of the tool why dates after 2038 cannot be expressed on systems with a 32-bit time_t. Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
-rw-r--r--src/certtool-cfg.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/certtool-cfg.c b/src/certtool-cfg.c
index b4894e63a6..1836fe85a1 100644
--- a/src/certtool-cfg.c
+++ b/src/certtool-cfg.c
@@ -68,6 +68,10 @@ extern int ask_pass;
#define MAX_ENTRIES 128
#define MAX_POLICIES 8
+#define PRINT_TIME_T_ERROR \
+ if (sizeof(time_t) < 8) \
+ fprintf(stderr, "This system expresses time with a 32-bit time_t; that prevents dates after 2038 to be expressed by GnuTLS.\n")
+
enum option_types { OPTION_NUMERIC, OPTION_STRING, OPTION_BOOLEAN, OPTION_MULTI_LINE };
struct cfg_options {
@@ -1693,6 +1697,7 @@ time_t get_date(const char* date)
struct timespec r;
if (date==NULL || parse_datetime(&r, date, NULL) == 0) {
+ PRINT_TIME_T_ERROR;
fprintf(stderr, "Cannot parse date: %s\n", date);
exit(1);
}
@@ -1754,6 +1759,7 @@ time_t now = time(NULL);
return secs;
overflow:
+ PRINT_TIME_T_ERROR;
fprintf(stderr, "Overflow while parsing days\n");
exit(1);
}