summaryrefslogtreecommitdiffstats
path: root/g10/card-util.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2015-05-07 12:01:12 +0200
committerWerner Koch <wk@gnupg.org>2015-05-07 12:12:41 +0200
commit874ef16e70ab750db7b153f17a7e859a0db6a2f1 (patch)
tree6dd9d2fba7ba5be68ee547a6ae5699ae9e4e941f /g10/card-util.c
parentgpg: Fix regression not displaying the card serial number (diff)
downloadgnupg2-874ef16e70ab750db7b153f17a7e859a0db6a2f1.tar.xz
gnupg2-874ef16e70ab750db7b153f17a7e859a0db6a2f1.zip
gpg: Improve 'General key info' line of --card-status.
* g10/keylist.c (print_pubkey_info): Print either "pub" or "sub". * g10/getkey.c (get_pubkey_byfprint): Add optional arg R_KEYBLOCK. * g10/keyid.c (keyid_from_fingerprint): Adjust for change. * g10/revoke.c (gen_desig_revoke): Adjust for change. * g10/card-util.c (card_status): Simplify by using new arg. Align card-no string. * g10/card-util.c (card_status): Remove not used GnuPG-1 code. -- This now prints "sub" if the first used card key is actually a subkey. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'g10/card-util.c')
-rw-r--r--g10/card-util.c31
1 files changed, 4 insertions, 27 deletions
diff --git a/g10/card-util.c b/g10/card-util.c
index a291a075b..dbd530eab 100644
--- a/g10/card-util.c
+++ b/g10/card-util.c
@@ -366,6 +366,7 @@ card_status (estream_t fp, char *serialno, size_t serialnobuflen)
{
struct agent_card_info_s info;
PKT_public_key *pk = xcalloc (1, sizeof *pk);
+ kbnode_t keyblock = NULL;
int rc;
unsigned int uval;
const unsigned char *thefpr;
@@ -587,41 +588,17 @@ card_status (estream_t fp, char *serialno, size_t serialnobuflen)
/* If the fingerprint is all 0xff, the key has no asssociated
OpenPGP certificate. */
if ( thefpr && !fpr_is_ff (thefpr)
- && !get_pubkey_byfprint (pk, thefpr, 20))
+ && !get_pubkey_byfprint (pk, &keyblock, thefpr, 20))
{
- kbnode_t keyblock = NULL;
-
print_pubkey_info (fp, pk);
-
-#if GNUPG_MAJOR_VERSION == 1
- if ( !get_seckeyblock_byfprint (&keyblock, thefpr, 20) )
+ if (keyblock)
print_card_key_info (fp, keyblock);
- else if ( !get_keyblock_byfprint (&keyblock, thefpr, 20) )
- {
- release_kbnode (keyblock);
- keyblock = NULL;
-
- if (!auto_create_card_key_stub (info.serialno,
- info.fpr1valid? info.fpr1:NULL,
- info.fpr2valid? info.fpr2:NULL,
- info.fpr3valid? info.fpr3:NULL))
- {
- if ( !get_seckeyblock_byfprint (&keyblock, thefpr, 20) )
- print_card_key_info (fp, keyblock);
- }
- }
-
-#else /* GNUPG_MAJOR_VERSION != 1 */
- if (!get_keyblock_byfprint (&keyblock, thefpr, 20))
- print_card_key_info (fp, keyblock);
-#endif /* GNUPG_MAJOR_VERSION != 1 */
-
- release_kbnode (keyblock);
}
else
tty_fprintf (fp, "[none]\n");
}
+ release_kbnode (keyblock);
free_public_key (pk);
agent_release_card_info (&info);
}