From 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 30 Sep 2013 00:03:24 +0200 Subject: Import Nagios Plugins site Import the Nagios Plugins web site, Cronjobs, infrastructure scripts, and configuration files. --- web/attachments/305359-sslutils.c.expiry.patch | 45 ++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 web/attachments/305359-sslutils.c.expiry.patch (limited to 'web/attachments/305359-sslutils.c.expiry.patch') diff --git a/web/attachments/305359-sslutils.c.expiry.patch b/web/attachments/305359-sslutils.c.expiry.patch new file mode 100644 index 0000000..151fc62 --- /dev/null +++ b/web/attachments/305359-sslutils.c.expiry.patch @@ -0,0 +1,45 @@ +--- nagios-plugins-1.4.13/plugins/sslutils.c.orig 2008-12-13 22:26:49.000000000 +0000 ++++ nagios-plugins-1.4.13/plugins/sslutils.c 2008-12-15 11:46:37.000000000 +0000 +@@ -92,7 +92,7 @@ + ASN1_STRING *tm; + int offset; + struct tm stamp; +- int days_left; ++ double days_left, hours_left, minutes_left; + char timestamp[17] = ""; + + certificate=SSL_get_peer_certificate(s); +@@ -138,20 +138,26 @@ + stamp.tm_sec = 0; + stamp.tm_isdst = -1; + +- days_left = (mktime (&stamp) - time (NULL)) / 86400; ++ minutes_left = (mktime (&stamp) - time (NULL)) / 60.0; ++ hours_left = minutes_left / 60.0; ++ days_left = hours_left / 24.0; + snprintf + (timestamp, 17, "%02d/%02d/%04d %02d:%02d", + stamp.tm_mon + 1, + stamp.tm_mday, stamp.tm_year + 1900, stamp.tm_hour, stamp.tm_min); + +- if (days_left > 0 && days_left <= days_till_exp) { +- printf (_("WARNING - Certificate expires in %d day(s) (%s).\n"), days_left, timestamp); +- return STATE_WARNING; +- } else if (days_left < 0) { ++ if (days_left < 0) { + printf (_("CRITICAL - Certificate expired on %s.\n"), timestamp); + return STATE_CRITICAL; +- } else if (days_left == 0) { +- printf (_("WARNING - Certificate expires today (%s).\n"), timestamp); ++ } ++ else if (days_left <= days_till_exp) { ++ printf (_("WARNING - Certificate expires in %d day(s) (%s).\n"), days_left, timestamp); ++ return STATE_WARNING; ++ } else if (days_left < 1 && hours_left > 1 && days_left <= days_till_exp) { ++ printf (_("WARNING - Certificate expires in %d hours (%s).\n"), hours_left, timestamp); ++ return STATE_WARNING; ++ } else if (days_left < 1 && hours_left < 1 && days_left <= days_till_exp) { ++ printf (_("WARNING - Certificate expires in %d minutes (%s).\n"), minutes_left, timestamp); + return STATE_WARNING; + } + -- cgit v1.2.3-74-g34f1