[monitoring-plugins] fix typo from #1336

Sven Nierlein git at monitoring-plugins.org
Fri Oct 2 16:00:11 CEST 2015


 Module: monitoring-plugins
 Branch: master
 Commit: 9eeb3e170f2638ec36c6770687a11bd01846e75a
 Author: Sven Nierlein <sven at nierlein.de>
   Date: Fri Oct  2 15:53:08 2015 +0200
    URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=9eeb3e1

fix typo from #1336

if exactly one hour before the expire date, we would mixup
minutes and hours.

Signed-off-by: Sven Nierlein <sven at nierlein.de>

---

 plugins/sslutils.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/plugins/sslutils.c b/plugins/sslutils.c
index 76e4507..c9882c6 100644
--- a/plugins/sslutils.c
+++ b/plugins/sslutils.c
@@ -209,7 +209,8 @@ int np_net_ssl_check_cert(int days_till_exp_warn, int days_till_exp_crit){
 		(tm->data[6 + offset] - '0') * 10 + (tm->data[7 + offset] - '0');
 	stamp.tm_min =
 		(tm->data[8 + offset] - '0') * 10 + (tm->data[9 + offset] - '0');
-	stamp.tm_sec = 0;
+	stamp.tm_sec =
+		(tm->data[10 + offset] - '0') * 10 + (tm->data[11 + offset] - '0');
 	stamp.tm_isdst = -1;
 
 	time_left = difftime(timegm(&stamp), time(NULL));
@@ -231,7 +232,7 @@ int np_net_ssl_check_cert(int days_till_exp_warn, int days_till_exp_crit){
 
 		printf (_("%s - Certificate '%s' expires in %u %s (%s)\n"),
 			(days_left>days_till_exp_crit) ? "WARNING" : "CRITICAL", cn, time_remaining,
-			time_left > 3600 ? "hours" : "minutes", timestamp);
+			time_left >= 3600 ? "hours" : "minutes", timestamp);
 
 		if ( days_left > days_till_exp_crit)
 			status = STATE_WARNING;



More information about the Commits mailing list