Revision: 2173
http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=2173&view=rev
Author: dermoth
Date: 2009-03-19 06:11:15 +0000 (Thu, 19 Mar 2009)
Log Message:
-----------
Revert "Add timezone support and fix checks around cert expiration" (keep the expiration fix)
This reverts commit d41a33a434558189300113c28b26e2d3d681d390.
From: Thomas Guyot-Sionnest <[email protected]>
Modified Paths:
--------------
nagiosplug/trunk/plugins/sslutils.c
nagiosplug/trunk/plugins/tests/check_http.t
Modified: nagiosplug/trunk/plugins/sslutils.c
===================================================================
--- nagiosplug/trunk/plugins/sslutils.c 2009-03-18 07:54:34 UTC (rev 2172)
+++ nagiosplug/trunk/plugins/sslutils.c 2009-03-19 06:11:15 UTC (rev 2173)
@@ -30,10 +30,6 @@
#include "common.h"
#include "netutils.h"
-/* Max length of timestamps, ex: "03/05/2009 00:13 GMT". Calculate up to 6
- * chars for the timezone (ex: "GMT-10") and one terminating \0 */
-#define TS_LENGTH 24
-
#ifdef HAVE_SSL
static SSL_CTX *c=NULL;
static SSL *s=NULL;
@@ -93,8 +89,9 @@
ASN1_STRING *tm;
int offset;
struct tm stamp;
+ float time_left;
int days_left;
- char timestamp[TS_LENGTH] = "";
+ char timestamp[17] = "";
certificate=SSL_get_peer_certificate(s);
if(! certificate){
@@ -139,12 +136,12 @@
stamp.tm_sec = 0;
stamp.tm_isdst = -1;
- float time_left = difftime(timegm(&stamp), time(NULL));
+ time_left = difftime(timegm(&stamp), time(NULL));
days_left = time_left / 86400;
snprintf
- (timestamp, TS_LENGTH, "%02d/%02d/%04d %02d:%02d %s",
+ (timestamp, 17, "%02d/%02d/%04d %02d:%02d",
stamp.tm_mon + 1,
- stamp.tm_mday, stamp.tm_year + 1900, stamp.tm_hour, stamp.tm_min, stamp.tm_zone);
+ 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);
Modified: nagiosplug/trunk/plugins/tests/check_http.t
===================================================================
--- nagiosplug/trunk/plugins/tests/check_http.t 2009-03-18 07:54:34 UTC (rev 2172)
+++ nagiosplug/trunk/plugins/tests/check_http.t 2009-03-19 06:11:15 UTC (rev 2173)
@@ -163,18 +163,18 @@
$result = NPTest->testCmd( "$command -p $port_https -S -C 14" );
is( $result->return_code, 0, "$command -p $port_https -S -C 14" );
- is( $result->output, 'OK - Certificate will expire on 03/03/2019 21:41 GMT.', "output ok" );
+ is( $result->output, 'OK - Certificate will expire on 03/03/2019 21:41.', "output ok" );
$result = NPTest->testCmd( "$command -p $port_https -S -C 14000" );
is( $result->return_code, 1, "$command -p $port_https -S -C 14000" );
- like( $result->output, '/WARNING - Certificate expires in \d+ day\(s\) \(03/03/2019 21:41 GMT\)./', "output ok" );
+ like( $result->output, '/WARNING - Certificate expires in \d+ day\(s\) \(03/03/2019 21:41\)./', "output ok" );
# Expired cert tests
$result = NPTest->testCmd( "$command -p $port_https_expired -S -C 7" );
is( $result->return_code, 2, "$command -p $port_https_expired -S -C 7" );
is( $result->output,
- 'CRITICAL - Certificate expired on 03/05/2009 00:13 GMT.',
+ 'CRITICAL - Certificate expired on 03/05/2009 00:13.',
"output ok" );
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.