diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2023-04-18 02:53:24 +0200 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2023-04-18 02:53:24 +0200 |
commit | 2c1297055041b4657ea1a927acac978c2b09a483 (patch) | |
tree | 2cb64da76c47abaad3ffb658f58c2fb02a61fce4 | |
parent | gpg: Curvenames may now compared case insensitive. (diff) | |
download | gnupg2-2c1297055041b4657ea1a927acac978c2b09a483.tar.xz gnupg2-2c1297055041b4657ea1a927acac978c2b09a483.zip |
gpg: Allow overridden key import when stub exists.
* g10/import.c (do_transfer): Force importing when it's card
reference.
--
GnuPG-bug-id: 3456
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
-rw-r--r-- | g10/import.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/g10/import.c b/g10/import.c index 1ed40a63c..7b46d8941 100644 --- a/g10/import.c +++ b/g10/import.c @@ -2955,9 +2955,19 @@ do_transfer (ctrl_t ctrl, kbnode_t keyblock, PKT_public_key *pk, { gpg_error_t err; struct import_stats_s subkey_stats = {0}; + int force = 0; + int already_exist = agent_probe_secret_key (ctrl, pk); + + if (already_exist == 2) + { + if (!opt.quiet) + log_info (_("key %s: card reference is overridden by key material\n"), + keystr_from_pk (pk)); + force = 1; + } err = transfer_secret_keys (ctrl, &subkey_stats, keyblock, - batch, 0, only_marked); + batch, force, only_marked); if (gpg_err_code (err) == GPG_ERR_NOT_PROCESSED) { /* TRANSLATORS: For a smartcard, each private key on host has a |