diff --git a/common/ChangeLog b/common/ChangeLog index cbe0a5a28..986041f59 100644 --- a/common/ChangeLog +++ b/common/ChangeLog @@ -3,6 +3,11 @@ * http.c (do_parse_uri): Properly handle IPv6 literal addresses as per RFC-2732. Adapted from patch by Phil Pennock. +2009-03-12 Werner Koch + + * gettime.c: Include i18n.h. + (dump_isotime): New. + 2009-03-06 Werner Koch * sexputil.c (make_canon_sexp): New. diff --git a/common/gettime.c b/common/gettime.c index c4a9d4844..1b4e435a1 100644 --- a/common/gettime.c +++ b/common/gettime.c @@ -26,6 +26,7 @@ #endif #include "util.h" +#include "i18n.h" static unsigned long timewarp; static enum { NORMAL = 0, FROZEN, FUTURE, PAST } timemode; @@ -495,6 +496,16 @@ check_isotime (const gnupg_isotime_t atime) } +void +dump_isotime (const gnupg_isotime_t t) +{ + if (!t || !*t) + log_printf (_("[none]")); + else + log_printf ("%.4s-%.2s-%.2s %.2s:%.2s:%s", + t, t+4, t+6, t+9, t+11, t+13); +} + /* Add SECONDS to ATIME. SECONDS may not be negative and is limited to about the equivalent of 62 years which should be more then diff --git a/common/util.h b/common/util.h index d117f86bf..3c664cec7 100644 --- a/common/util.h +++ b/common/util.h @@ -119,6 +119,7 @@ const char *asctimestamp (u32 stamp); /* localized */ gpg_error_t add_seconds_to_isotime (gnupg_isotime_t atime, int nseconds); gpg_error_t add_days_to_isotime (gnupg_isotime_t atime, int ndays); gpg_error_t check_isotime (const gnupg_isotime_t atime); +void dump_isotime (const gnupg_isotime_t atime); /* Copy one ISO date to another, this is inline so that we can do a minimal sanity check. A null date (empty string) is allowed. */ diff --git a/sm/ChangeLog b/sm/ChangeLog index 4d98dc50e..03fa60c98 100644 --- a/sm/ChangeLog +++ b/sm/ChangeLog @@ -1,3 +1,9 @@ +2009-03-12 Werner Koch + + * certdump.c (gpgsm_dump_time): Remove. + * certdump.c, verify.c, certchain.c + * gpgsm.c: s/gpgsm_dump_time/dump_isotime/. + 2009-03-06 Werner Koch * call-agent.c (gpgsm_agent_keyinfo, keyinfo_status_cb): New. diff --git a/sm/certchain.c b/sm/certchain.c index fbff7c001..ddf4ece8f 100644 --- a/sm/certchain.c +++ b/sm/certchain.c @@ -979,7 +979,7 @@ check_validity_period (ksba_isotime_t current_time, if (!listmode) { log_info (" (valid from "); - gpgsm_dump_time (not_before); + dump_isotime (not_before); log_printf (")\n"); } return gpg_error (GPG_ERR_CERT_TOO_YOUNG); @@ -994,7 +994,7 @@ check_validity_period (ksba_isotime_t current_time, if (!listmode) { log_info (" (expired at "); - gpgsm_dump_time (not_after); + dump_isotime (not_after); log_printf (")\n"); } if (opt.ignore_expiration) @@ -1043,9 +1043,9 @@ check_validity_period_cm (ksba_isotime_t current_time, do_list (1, listmode, listfp, _("certificate with invalid validity")); log_info (" (valid from "); - gpgsm_dump_time (not_before); + dump_isotime (not_before); log_printf (" expired at "); - gpgsm_dump_time (not_after); + dump_isotime (not_after); log_printf (")\n"); return gpg_error (GPG_ERR_BAD_CERT); } @@ -1064,7 +1064,7 @@ check_validity_period_cm (ksba_isotime_t current_time, if (!listmode) { log_info (" (valid from "); - gpgsm_dump_time (not_before); + dump_isotime (not_before); log_printf (")\n"); } return gpg_error (GPG_ERR_CERT_TOO_YOUNG); @@ -1087,13 +1087,13 @@ check_validity_period_cm (ksba_isotime_t current_time, { log_info (depth== 0? _(" ( signature created at ") : /* */ _(" (certificate created at ") ); - gpgsm_dump_time (check_time); + dump_isotime (check_time); log_printf (")\n"); log_info (depth==0? _(" (certificate valid from ") : /* */ _(" ( issuer valid from ") ); - gpgsm_dump_time (not_before); + dump_isotime (not_before); log_info (" to "); - gpgsm_dump_time (not_after); + dump_isotime (not_after); log_printf (")\n"); } if (opt.ignore_expiration) diff --git a/sm/certdump.c b/sm/certdump.c index 71907d188..c8854054b 100644 --- a/sm/certdump.c +++ b/sm/certdump.c @@ -147,19 +147,6 @@ gpgsm_print_time (estream_t fp, ksba_isotime_t t) } -void -gpgsm_dump_time (ksba_isotime_t t) -{ - if (!t || !*t) - log_printf (_("[none]")); - else - log_printf ("%.4s-%.2s-%.2s %.2s:%.2s:%s", - t, t+4, t+6, t+9, t+11, t+13); -} - - - - void gpgsm_dump_string (const char *string) { @@ -207,11 +194,11 @@ gpgsm_dump_cert (const char *text, ksba_cert_t cert) ksba_cert_get_validity (cert, 0, t); log_debug (" notBefore: "); - gpgsm_dump_time (t); + dump_isotime (t); log_printf ("\n"); ksba_cert_get_validity (cert, 1, t); log_debug (" notAfter: "); - gpgsm_dump_time (t); + dump_isotime (t); log_printf ("\n"); dn = ksba_cert_get_issuer (cert, 0); diff --git a/sm/gpgsm.c b/sm/gpgsm.c index 94826ce79..fe9ebf302 100644 --- a/sm/gpgsm.c +++ b/sm/gpgsm.c @@ -1405,7 +1405,7 @@ main ( int argc, char **argv) log_info (_("WARNING: running with faked system time: ")); gnupg_get_isotime (tbuf); - gpgsm_dump_time (tbuf); + dump_isotime (tbuf); log_printf ("\n"); } diff --git a/sm/verify.c b/sm/verify.c index 8ce5affb8..11f147db5 100644 --- a/sm/verify.c +++ b/sm/verify.c @@ -446,7 +446,7 @@ gpgsm_verify (ctrl_t ctrl, int in_fd, int data_fd, FILE *out_fp) log_info (_("Signature made ")); if (*sigtime) - gpgsm_dump_time (sigtime); + dump_isotime (sigtime); else log_printf (_("[date not given]")); log_printf (_(" using certificate ID 0x%08lX\n"),