mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-08 12:44:23 +01:00
Let KEYINFO show the cached status of a key grip.
This commit is contained in:
parent
528d77a0cc
commit
fa58a834ff
@ -938,7 +938,7 @@ static const char hlp_keyinfo[] =
|
|||||||
"available keys are returned. The information is returned as a\n"
|
"available keys are returned. The information is returned as a\n"
|
||||||
"status line with this format:\n"
|
"status line with this format:\n"
|
||||||
"\n"
|
"\n"
|
||||||
" KEYINFO <keygrip> <type> <serialno> <idstr>\n"
|
" KEYINFO <keygrip> <type> <serialno> <idstr> <cached>\n"
|
||||||
"\n"
|
"\n"
|
||||||
"KEYGRIP is the keygrip.\n"
|
"KEYGRIP is the keygrip.\n"
|
||||||
"\n"
|
"\n"
|
||||||
@ -954,6 +954,9 @@ static const char hlp_keyinfo[] =
|
|||||||
"IDSTR is the IDSTR used to distinguish keys on a smartcard. If it\n"
|
"IDSTR is the IDSTR used to distinguish keys on a smartcard. If it\n"
|
||||||
" is not known a dash is used instead.\n"
|
" is not known a dash is used instead.\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
"CACHED is 1 if the key was found in the key cache. If not, a '-'\n"
|
||||||
|
"is used instead.\n"
|
||||||
|
"\n"
|
||||||
"More information may be added in the future.";
|
"More information may be added in the future.";
|
||||||
static gpg_error_t
|
static gpg_error_t
|
||||||
do_one_keyinfo (ctrl_t ctrl, const unsigned char *grip)
|
do_one_keyinfo (ctrl_t ctrl, const unsigned char *grip)
|
||||||
@ -965,6 +968,8 @@ do_one_keyinfo (ctrl_t ctrl, const unsigned char *grip)
|
|||||||
char *serialno = NULL;
|
char *serialno = NULL;
|
||||||
char *idstr = NULL;
|
char *idstr = NULL;
|
||||||
const char *keytypestr;
|
const char *keytypestr;
|
||||||
|
char *cached;
|
||||||
|
char *pw;
|
||||||
|
|
||||||
err = agent_key_info_from_file (ctrl, grip, &keytype, &shadow_info);
|
err = agent_key_info_from_file (ctrl, grip, &keytype, &shadow_info);
|
||||||
if (err)
|
if (err)
|
||||||
@ -981,6 +986,10 @@ do_one_keyinfo (ctrl_t ctrl, const unsigned char *grip)
|
|||||||
else
|
else
|
||||||
keytypestr = "-";
|
keytypestr = "-";
|
||||||
|
|
||||||
|
pw = agent_get_cache (hexgrip, CACHE_MODE_NORMAL);
|
||||||
|
cached = pw ? "1" : "-";
|
||||||
|
xfree (pw);
|
||||||
|
|
||||||
if (shadow_info)
|
if (shadow_info)
|
||||||
{
|
{
|
||||||
err = parse_shadow_info (shadow_info, &serialno, &idstr);
|
err = parse_shadow_info (shadow_info, &serialno, &idstr);
|
||||||
@ -993,6 +1002,7 @@ do_one_keyinfo (ctrl_t ctrl, const unsigned char *grip)
|
|||||||
keytypestr,
|
keytypestr,
|
||||||
serialno? serialno : "-",
|
serialno? serialno : "-",
|
||||||
idstr? idstr : "-",
|
idstr? idstr : "-",
|
||||||
|
cached,
|
||||||
NULL);
|
NULL);
|
||||||
leave:
|
leave:
|
||||||
xfree (shadow_info);
|
xfree (shadow_info);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user