diff options
author | NIIBE Yutaka <[email protected]> | 2023-09-26 01:05:05 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2023-09-26 01:05:05 +0000 |
commit | 8e3d4f5b63c15d9a121f568cc61735586f1782a0 (patch) | |
tree | 5f5456b411f5129f41acc8ce8a3bcf3ce69257f5 | |
parent | gpg: Enhance agent_probe_secret_key to return bigger value. (diff) | |
download | gnupg-8e3d4f5b63c15d9a121f568cc61735586f1782a0.tar.gz gnupg-8e3d4f5b63c15d9a121f568cc61735586f1782a0.zip |
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 <[email protected]>
-rw-r--r-- | g10/call-agent.c | 6 | ||||
-rw-r--r-- | g10/import.c | 2 |
2 files changed, 1 insertions, 7 deletions
diff --git a/g10/call-agent.c b/g10/call-agent.c index 03dc54456..3211649e1 100644 --- a/g10/call-agent.c +++ b/g10/call-agent.c @@ -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; diff --git a/g10/import.c b/g10/import.c index 49a363c28..f11dedc8b 100644 --- a/g10/import.c +++ b/g10/import.c @@ -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"), |