diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/sslutils.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/plugins/sslutils.c b/plugins/sslutils.c index 687bffb..d0ae474 100644 --- a/plugins/sslutils.c +++ b/plugins/sslutils.c | |||
@@ -153,7 +153,8 @@ int np_net_ssl_check_cert(int days_till_exp_warn, int days_till_exp_crit){ | |||
153 | struct tm stamp; | 153 | struct tm stamp; |
154 | float time_left; | 154 | float time_left; |
155 | int days_left; | 155 | int days_left; |
156 | char timestamp[17] = ""; | 156 | char timestamp[50] = ""; |
157 | time_t tm_t; | ||
157 | 158 | ||
158 | certificate=SSL_get_peer_certificate(s); | 159 | certificate=SSL_get_peer_certificate(s); |
159 | if (!certificate) { | 160 | if (!certificate) { |
@@ -211,10 +212,8 @@ int np_net_ssl_check_cert(int days_till_exp_warn, int days_till_exp_crit){ | |||
211 | 212 | ||
212 | time_left = difftime(timegm(&stamp), time(NULL)); | 213 | time_left = difftime(timegm(&stamp), time(NULL)); |
213 | days_left = time_left / 86400; | 214 | days_left = time_left / 86400; |
214 | snprintf | 215 | tm_t = mktime (&stamp); |
215 | (timestamp, 17, "%02d/%02d/%04d %02d:%02d", | 216 | strftime(timestamp, 50, "%c", localtime(&tm_t)); |
216 | stamp.tm_mon + 1, | ||
217 | stamp.tm_mday, stamp.tm_year + 1900, stamp.tm_hour, stamp.tm_min); | ||
218 | 217 | ||
219 | if (days_left > 0 && days_left <= days_till_exp_warn) { | 218 | if (days_left > 0 && days_left <= days_till_exp_warn) { |
220 | printf (_("%s - Certificate '%s' expires in %d day(s) (%s).\n"), (days_left>days_till_exp_crit)?"WARNING":"CRITICAL", cn, days_left, timestamp); | 219 | printf (_("%s - Certificate '%s' expires in %d day(s) (%s).\n"), (days_left>days_till_exp_crit)?"WARNING":"CRITICAL", cn, days_left, timestamp); |