diff options
author | Ben Kibbey <[email protected]> | 2011-03-02 01:29:08 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2011-03-02 08:32:35 +0000 |
commit | fa58a834ff994267307a344151bdc344590ecb47 (patch) | |
tree | a19c76f47b61b1b04d51041f0ef6c3c64cdf1f8e | |
parent | Rename Ben's new option. (diff) | |
download | gnupg-fa58a834ff994267307a344151bdc344590ecb47.tar.gz gnupg-fa58a834ff994267307a344151bdc344590ecb47.zip |
Let KEYINFO show the cached status of a key grip.
Diffstat (limited to '')
-rw-r--r-- | agent/command.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/agent/command.c b/agent/command.c index 9533db7c0..ddcb06756 100644 --- a/agent/command.c +++ b/agent/command.c @@ -938,7 +938,7 @@ static const char hlp_keyinfo[] = "available keys are returned. The information is returned as a\n" "status line with this format:\n" "\n" - " KEYINFO <keygrip> <type> <serialno> <idstr>\n" + " KEYINFO <keygrip> <type> <serialno> <idstr> <cached>\n" "\n" "KEYGRIP is the keygrip.\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" " is not known a dash is used instead.\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."; static gpg_error_t 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 *idstr = NULL; const char *keytypestr; + char *cached; + char *pw; err = agent_key_info_from_file (ctrl, grip, &keytype, &shadow_info); if (err) @@ -981,6 +986,10 @@ do_one_keyinfo (ctrl_t ctrl, const unsigned char *grip) else keytypestr = "-"; + pw = agent_get_cache (hexgrip, CACHE_MODE_NORMAL); + cached = pw ? "1" : "-"; + xfree (pw); + if (shadow_info) { err = parse_shadow_info (shadow_info, &serialno, &idstr); @@ -993,6 +1002,7 @@ do_one_keyinfo (ctrl_t ctrl, const unsigned char *grip) keytypestr, serialno? serialno : "-", idstr? idstr : "-", + cached, NULL); leave: xfree (shadow_info); |