mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
Remove duplicated code.
This commit is contained in:
parent
91e5544e38
commit
94be7a4341
@ -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 <wk@g10code.com>
|
||||
|
||||
* gettime.c: Include i18n.h.
|
||||
(dump_isotime): New.
|
||||
|
||||
2009-03-06 Werner Koch <wk@g10code.com>
|
||||
|
||||
* sexputil.c (make_canon_sexp): New.
|
||||
|
@ -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
|
||||
|
@ -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. */
|
||||
|
@ -1,3 +1,9 @@
|
||||
2009-03-12 Werner Koch <wk@g10code.com>
|
||||
|
||||
* 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 <wk@g10code.com>
|
||||
|
||||
* call-agent.c (gpgsm_agent_keyinfo, keyinfo_status_cb): New.
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
|
@ -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"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user