summaryrefslogtreecommitdiffstats
path: root/web/attachments/305196-sslutils.c.localtimeformat.patch
blob: 66435b87c3604097e20c537dc08253d6b9875f4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
--- nagios-plugins-1.4.13/plugins/sslutils.c.prelocaltimeformat	2008-12-13 22:26:49.000000000 +0000
+++ nagios-plugins-1.4.13/plugins/sslutils.c	2008-12-13 22:34:15.000000000 +0000
@@ -93,7 +93,8 @@
 	int offset;
 	struct tm stamp;
 	int days_left;
-	char timestamp[17] = "";
+ 	char timestamp[50] = "";
+ 	time_t tm_t;
 
 	certificate=SSL_get_peer_certificate(s);
 	if(! certificate){
@@ -139,10 +140,8 @@
 	stamp.tm_isdst = -1;
 
 	days_left = (mktime (&stamp) - time (NULL)) / 86400;
-	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);
+ 	tm_t = mktime (&stamp);
+ 	strftime(timestamp, 50, "%c", localtime(&tm_t));
 
 	if (days_left > 0 && days_left <= days_till_exp) {
 		printf (_("WARNING - Certificate expires in %d day(s) (%s).\n"), days_left, timestamp);