From 27e5059fa136ddb7b978caf72dacc0effbff55ef Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Sun, 1 Jul 2018 11:24:16 +0200 Subject: 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 --- src/certtool-cfg.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/certtool-cfg.c') 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); } -- cgit v1.2.1