mirror of
git://git.gnupg.org/gnupg.git
synced 2025-05-19 09:02:22 +02:00
gpg: New option --full-timestrings.
* g10/options.h (opt): Add flags.full_timestrings. * g10/gpg.c (oFullTimestrings): New. (opts): New option. (main): Set new flag. * g10/keyid.c (dateonlystr_from_pk): New. (dateonlystr_from_sig): New. (datestr_from_pk): Divert to isotimestamp if requested. (datestr_from_sig): Ditto. (expirestr_from_pk): Ditto. (expirestr_from_sig): Ditto. (revokestr_from_pk): Ditto. * g10/import.c (impex_filter_getval): Use dateonlystr_from_sig and dateonlystr_from_pk. -- Quite helpful for debugging keys. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
14ac350f86
commit
86312b920a
@ -2942,6 +2942,14 @@ forth to @var{epoch} which is the number of seconds elapsed since the year
|
|||||||
If you suffix @var{epoch} with an exclamation mark (!), the system time
|
If you suffix @var{epoch} with an exclamation mark (!), the system time
|
||||||
will appear to be frozen at the specified time.
|
will appear to be frozen at the specified time.
|
||||||
|
|
||||||
|
@item --full-timestrings
|
||||||
|
@opindex full-timestrings
|
||||||
|
Change the format of printed creation and expiration times from just
|
||||||
|
the date to the date and time. This is in general not useful and the
|
||||||
|
same information is anyway available in @option{--with-colons} mode.
|
||||||
|
These longer strings are also not well aligned with other printed
|
||||||
|
data.
|
||||||
|
|
||||||
@item --enable-progress-filter
|
@item --enable-progress-filter
|
||||||
@opindex enable-progress-filter
|
@opindex enable-progress-filter
|
||||||
Enable certain PROGRESS status outputs. This option allows frontends
|
Enable certain PROGRESS status outputs. This option allows frontends
|
||||||
|
@ -431,6 +431,7 @@ enum cmd_and_opt_values
|
|||||||
oRequestOrigin,
|
oRequestOrigin,
|
||||||
oNoSymkeyCache,
|
oNoSymkeyCache,
|
||||||
oUseOnlyOpenPGPCard,
|
oUseOnlyOpenPGPCard,
|
||||||
|
oFullTimestrings,
|
||||||
|
|
||||||
oNoop
|
oNoop
|
||||||
};
|
};
|
||||||
@ -902,6 +903,7 @@ static ARGPARSE_OPTS opts[] = {
|
|||||||
ARGPARSE_s_n (oNoAutostart, "no-autostart", "@"),
|
ARGPARSE_s_n (oNoAutostart, "no-autostart", "@"),
|
||||||
ARGPARSE_s_n (oNoSymkeyCache, "no-symkey-cache", "@"),
|
ARGPARSE_s_n (oNoSymkeyCache, "no-symkey-cache", "@"),
|
||||||
ARGPARSE_s_n (oUseKeyboxd, "use-keyboxd", "@"),
|
ARGPARSE_s_n (oUseKeyboxd, "use-keyboxd", "@"),
|
||||||
|
ARGPARSE_s_n (oFullTimestrings, "full-timestrings", "@"),
|
||||||
|
|
||||||
/* Options to override new security defaults. */
|
/* Options to override new security defaults. */
|
||||||
ARGPARSE_s_n (oAllowWeakKeySignatures, "allow-weak-key-signatures", "@"),
|
ARGPARSE_s_n (oAllowWeakKeySignatures, "allow-weak-key-signatures", "@"),
|
||||||
@ -3677,6 +3679,10 @@ main (int argc, char **argv)
|
|||||||
opt.flags.use_only_openpgp_card = 1;
|
opt.flags.use_only_openpgp_card = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case oFullTimestrings:
|
||||||
|
opt.flags.full_timestrings = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
case oNoop: break;
|
case oNoop: break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -1411,7 +1411,7 @@ impex_filter_getval (void *cookie, const char *propname)
|
|||||||
}
|
}
|
||||||
else if (!strcmp (propname, "sig_created_d"))
|
else if (!strcmp (propname, "sig_created_d"))
|
||||||
{
|
{
|
||||||
result = datestr_from_sig (sig);
|
result = dateonlystr_from_sig (sig);
|
||||||
}
|
}
|
||||||
else if (!strcmp (propname, "sig_algo"))
|
else if (!strcmp (propname, "sig_algo"))
|
||||||
{
|
{
|
||||||
@ -1454,7 +1454,7 @@ impex_filter_getval (void *cookie, const char *propname)
|
|||||||
}
|
}
|
||||||
else if (!strcmp (propname, "key_created_d"))
|
else if (!strcmp (propname, "key_created_d"))
|
||||||
{
|
{
|
||||||
result = datestr_from_pk (pk);
|
result = dateonlystr_from_pk (pk);
|
||||||
}
|
}
|
||||||
else if (!strcmp (propname, "expired"))
|
else if (!strcmp (propname, "expired"))
|
||||||
{
|
{
|
||||||
|
@ -533,7 +533,9 @@ unsigned nbits_from_pk( PKT_public_key *pk );
|
|||||||
char *mk_datestr (char *buffer, size_t bufsize, u32 timestamp);
|
char *mk_datestr (char *buffer, size_t bufsize, u32 timestamp);
|
||||||
#define MK_DATESTR_SIZE 11
|
#define MK_DATESTR_SIZE 11
|
||||||
|
|
||||||
|
const char *dateonlystr_from_pk (PKT_public_key *pk);
|
||||||
const char *datestr_from_pk( PKT_public_key *pk );
|
const char *datestr_from_pk( PKT_public_key *pk );
|
||||||
|
const char *dateonlystr_from_sig( PKT_signature *sig );
|
||||||
const char *datestr_from_sig( PKT_signature *sig );
|
const char *datestr_from_sig( PKT_signature *sig );
|
||||||
const char *expirestr_from_pk( PKT_public_key *pk );
|
const char *expirestr_from_pk( PKT_public_key *pk );
|
||||||
const char *expirestr_from_sig( PKT_signature *sig );
|
const char *expirestr_from_sig( PKT_signature *sig );
|
||||||
|
38
g10/keyid.c
38
g10/keyid.c
@ -679,7 +679,7 @@ mk_datestr (char *buffer, size_t bufsize, u32 timestamp)
|
|||||||
* Format is: yyyy-mm-dd
|
* Format is: yyyy-mm-dd
|
||||||
*/
|
*/
|
||||||
const char *
|
const char *
|
||||||
datestr_from_pk (PKT_public_key *pk)
|
dateonlystr_from_pk (PKT_public_key *pk)
|
||||||
{
|
{
|
||||||
static char buffer[MK_DATESTR_SIZE];
|
static char buffer[MK_DATESTR_SIZE];
|
||||||
|
|
||||||
@ -687,14 +687,36 @@ datestr_from_pk (PKT_public_key *pk)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Same as dateonlystr_from_pk but with a global option a full iso
|
||||||
|
* timestamp is returned. In this case it shares a static buffer with
|
||||||
|
* isotimestamp(). */
|
||||||
const char *
|
const char *
|
||||||
datestr_from_sig (PKT_signature *sig )
|
datestr_from_pk (PKT_public_key *pk)
|
||||||
|
{
|
||||||
|
if (opt.flags.full_timestrings)
|
||||||
|
return isotimestamp (pk->timestamp);
|
||||||
|
else
|
||||||
|
return dateonlystr_from_pk (pk);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char *
|
||||||
|
dateonlystr_from_sig (PKT_signature *sig )
|
||||||
{
|
{
|
||||||
static char buffer[MK_DATESTR_SIZE];
|
static char buffer[MK_DATESTR_SIZE];
|
||||||
|
|
||||||
return mk_datestr (buffer, sizeof buffer, sig->timestamp);
|
return mk_datestr (buffer, sizeof buffer, sig->timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
datestr_from_sig (PKT_signature *sig )
|
||||||
|
{
|
||||||
|
if (opt.flags.full_timestrings)
|
||||||
|
return isotimestamp (sig->timestamp);
|
||||||
|
else
|
||||||
|
return dateonlystr_from_sig (sig);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
expirestr_from_pk (PKT_public_key *pk)
|
expirestr_from_pk (PKT_public_key *pk)
|
||||||
@ -703,6 +725,10 @@ expirestr_from_pk (PKT_public_key *pk)
|
|||||||
|
|
||||||
if (!pk->expiredate)
|
if (!pk->expiredate)
|
||||||
return _("never ");
|
return _("never ");
|
||||||
|
|
||||||
|
if (opt.flags.full_timestrings)
|
||||||
|
return isotimestamp (pk->expiredate);
|
||||||
|
|
||||||
return mk_datestr (buffer, sizeof buffer, pk->expiredate);
|
return mk_datestr (buffer, sizeof buffer, pk->expiredate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -714,6 +740,10 @@ expirestr_from_sig (PKT_signature *sig)
|
|||||||
|
|
||||||
if (!sig->expiredate)
|
if (!sig->expiredate)
|
||||||
return _("never ");
|
return _("never ");
|
||||||
|
|
||||||
|
if (opt.flags.full_timestrings)
|
||||||
|
return isotimestamp (sig->expiredate);
|
||||||
|
|
||||||
return mk_datestr (buffer, sizeof buffer, sig->expiredate);
|
return mk_datestr (buffer, sizeof buffer, sig->expiredate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -725,6 +755,10 @@ revokestr_from_pk( PKT_public_key *pk )
|
|||||||
|
|
||||||
if(!pk->revoked.date)
|
if(!pk->revoked.date)
|
||||||
return _("never ");
|
return _("never ");
|
||||||
|
|
||||||
|
if (opt.flags.full_timestrings)
|
||||||
|
return isotimestamp (pk->revoked.date);
|
||||||
|
|
||||||
return mk_datestr (buffer, sizeof buffer, pk->revoked.date);
|
return mk_datestr (buffer, sizeof buffer, pk->revoked.date);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,6 +248,7 @@ struct
|
|||||||
/* Force the use of the OpenPGP card and do not allow the use of
|
/* Force the use of the OpenPGP card and do not allow the use of
|
||||||
* another card. */
|
* another card. */
|
||||||
unsigned int use_only_openpgp_card:1;
|
unsigned int use_only_openpgp_card:1;
|
||||||
|
unsigned int full_timestrings:1;
|
||||||
} flags;
|
} flags;
|
||||||
|
|
||||||
/* Linked list of ways to find a key if the key isn't on the local
|
/* Linked list of ways to find a key if the key isn't on the local
|
||||||
|
Loading…
x
Reference in New Issue
Block a user