mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
gpg: Add --list-filter properties key_expires and key_expires_d.
* g10/import.c (impex_filter_getval): Support new filter properties. -- Here is how to list all subkeys expiring in the year 2061: gpg --list-keys --list-filter 'select= sub/key_expires_d -gt 2061-01-01 \ && sub/key_expires_d -lt 2061-12-31' To list all primary key expirations, use the "pub/" prefix and to list all expiration dates use no prefix. GnuPG-bug-id: 6509
This commit is contained in:
parent
207c99567c
commit
c68dd22872
@ -2671,6 +2671,12 @@ The available properties are:
|
||||
created. The second is the same but given as an ISO string,
|
||||
e.g. "2016-08-17". (drop-subkey)
|
||||
|
||||
@item key_expires
|
||||
@itemx key_expires_d
|
||||
The expiration time of a public key or subkey or 0 if it does not
|
||||
expire. The second is the same but given as an ISO date string or
|
||||
an empty string e.g. "2038-01-19".
|
||||
|
||||
@item fpr
|
||||
The hexified fingerprint of the current subkey or primary key.
|
||||
(drop-subkey)
|
||||
|
14
g10/import.c
14
g10/import.c
@ -1564,6 +1564,20 @@ impex_filter_getval (void *cookie, const char *propname)
|
||||
{
|
||||
result = dateonlystr_from_pk (pk);
|
||||
}
|
||||
else if (!strcmp (propname, "key_expires"))
|
||||
{
|
||||
snprintf (numbuf, sizeof numbuf, "%lu", (ulong)pk->expiredate);
|
||||
result = numbuf;
|
||||
}
|
||||
else if (!strcmp (propname, "key_expires_d"))
|
||||
{
|
||||
static char exdatestr[MK_DATESTR_SIZE];
|
||||
|
||||
if (pk->expiredate)
|
||||
result = mk_datestr (exdatestr, sizeof exdatestr, pk->expiredate);
|
||||
else
|
||||
result = "";
|
||||
}
|
||||
else if (!strcmp (propname, "expired"))
|
||||
{
|
||||
result = pk->has_expired? "1":"0";
|
||||
|
Loading…
x
Reference in New Issue
Block a user