- certwatch: use UTC time correctly (Tomas Mraz, #158703)
This commit is contained in:
parent
ea20726f53
commit
366eceb32f
12
certwatch.c
12
certwatch.c
@ -39,11 +39,12 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <getopt.h>
|
||||
#include <time.h>
|
||||
|
||||
static int warn_period = 30;
|
||||
static char *warn_address = "root";
|
||||
|
||||
/* Turn an ASN.1 UTCTIME object into a time_t, ish. */
|
||||
/* Turn an ASN.1 UTCTIME object into a time_t. */
|
||||
static time_t decode_utctime(const ASN1_UTCTIME *utc)
|
||||
{
|
||||
struct tm tm = {0};
|
||||
@ -66,9 +67,8 @@ static time_t decode_utctime(const ASN1_UTCTIME *utc)
|
||||
tm.tm_hour = (utc->data[6]-'0') * 10 + (utc->data[7]-'0');
|
||||
tm.tm_min = (utc->data[8]-'0') * 10 + (utc->data[9]-'0');
|
||||
tm.tm_sec = (utc->data[10]-'0') * 10 + (utc->data[11]-'0');
|
||||
tm.tm_isdst = -1;
|
||||
|
||||
return mktime(&tm);
|
||||
return mktime(&tm) - timezone;
|
||||
}
|
||||
|
||||
/* Print a warning message that the certificate in 'filename', issued
|
||||
@ -104,7 +104,7 @@ static int warning(FILE *out, const char *filename, const char *hostname,
|
||||
" ################# SSL Certificate Warning ################\n\n");
|
||||
|
||||
fprintf(out,
|
||||
" Certificate for %s, in file:\n"
|
||||
" Certificate for hostname '%s', in file:\n"
|
||||
" %s\n\n",
|
||||
hostname, filename);
|
||||
|
||||
@ -194,6 +194,10 @@ int main(int argc, char **argv)
|
||||
{ "address", required_argument, NULL, 'a' },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
/* The 'timezone' global is needed to adjust local times from
|
||||
* mktime() back to UTC: */
|
||||
tzset();
|
||||
|
||||
while ((optc = getopt_long(argc, argv, "qhvp:", options, NULL)) != -1) {
|
||||
switch (optc) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
Summary: SSL certificate and key management utilities
|
||||
Name: crypto-utils
|
||||
Version: 2.2
|
||||
Release: 5
|
||||
Release: 6
|
||||
Source: crypto-rand-%{crver}.tar.gz
|
||||
Source1: genkey.pl
|
||||
Source2: certwatch.c
|
||||
@ -101,6 +101,9 @@ sed -e "s|^\$bindir.*$|\$bindir = \"%{_bindir}\";|" \
|
||||
%{_mandir}/man1/*.1*
|
||||
|
||||
%changelog
|
||||
* Thu May 26 2005 Joe Orton <jorton@redhat.com> 2.2-6
|
||||
- certwatch: use UTC time correctly (Tomas Mraz, #158703)
|
||||
|
||||
* Fri May 13 2005 Joe Orton <jorton@redhat.com> 2.2-5
|
||||
- genkey(1): fix paths to use /etc/pki
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user