1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-08 12:44:23 +01:00

gpg: Keep the integrity of the code for KEYINFO command.

* g10/call-agent.c (struct keyinfo_data_parm_s): Remove CARD_AVAILABLE
field.
(keyinfo_status_cb): Don't touch CARD_AVAILABLE field.
(agent_probe_secret_key); Don't check CARD_AVAILABLE field.
* g10/import.c (do_transfer): Check if it's card key or not.

--

In 2.2 branch, gpg-agent doesn't have a capability to report if card
is available or not by KEYINFO command.  Thus, this clean up.

GnuPG-bug-id: 3456
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2023-09-26 10:05:05 +09:00
parent ff42ed0d69
commit 8e3d4f5b63
No known key found for this signature in database
GPG Key ID: 640114AF89DE6054
2 changed files with 1 additions and 7 deletions

View File

@ -1788,7 +1788,6 @@ struct keyinfo_data_parm_s
int is_smartcard;
int passphrase_cached;
int cleartext;
int card_available;
};
@ -1818,8 +1817,6 @@ keyinfo_status_cb (void *opaque, const char *line)
data->passphrase_cached = (fields[4][0] == '1');
/* 'P' for protected, 'C' for clear */
data->cleartext = (fields[5][0] == 'C');
/* 'A' for card is available */
data->card_available = (fields[8][0] == 'A');
}
}
return 0;
@ -1856,9 +1853,6 @@ agent_probe_secret_key (ctrl_t ctrl, PKT_public_key *pk)
if (err)
return 0;
if (keyinfo.card_available)
return 4;
if (keyinfo.passphrase_cached)
return 3;

View File

@ -2839,7 +2839,7 @@ do_transfer (ctrl_t ctrl, kbnode_t keyblock, PKT_public_key *pk,
int force = 0;
int already_exist = agent_probe_secret_key (ctrl, pk);
if (already_exist == 2 || already_exist == 4)
if (already_exist == 2)
{
if (!opt.quiet)
log_info (_("key %s: card reference is overridden by key material\n"),