summaryrefslogtreecommitdiffstats
path: root/web/attachments/394886-time-rfc822.diff
blob: e2e0d84137ebb1adb32d1f1517ebe0a638bbbb62 (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.15/plugins/sslutils.c	2010-07-27 20:47:16.000000000 +0000
+++ nagios-plugins-1.4.15.new/plugins/sslutils.c	2010-11-30 21:37:29.616606174 +0000
@@ -102,7 +102,7 @@
 	struct tm stamp;
 	float time_left;
 	int days_left;
-	char timestamp[17] = "";
+	char timestamp[128] = "";
 
 	certificate=SSL_get_peer_certificate(s);
 	if(! certificate){
@@ -149,10 +149,9 @@
 
 	time_left = difftime(timegm(&stamp), time(NULL));
 	days_left = time_left / 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);
+
+	stamp.tm_mon++;
+	strftime (timestamp, sizeof (timestamp), "%a, %d %b %Y %H:%M:%S %z", &stamp);
 
 	if (days_left > 0 && days_left <= days_till_exp) {
 		printf (_("WARNING - Certificate expires in %d day(s) (%s).\n"), days_left, timestamp);