diff options
author | Werner Koch <[email protected]> | 2022-12-16 14:24:33 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2023-08-25 13:37:16 +0000 |
commit | 3dc39add6af15bbe5a55f73e125558181669baf0 (patch) | |
tree | a41d90071e5bf0f569d31be9887ee6406aeeafcc | |
parent | dirmngr: Extend the AD_QUERY command. (diff) | |
download | gnupg-3dc39add6af15bbe5a55f73e125558181669baf0.tar.gz gnupg-3dc39add6af15bbe5a55f73e125558181669baf0.zip |
gpg: Do not continue the export after a cancel for the primary key.
* g10/export.c (do_export_one_keyblock): Handle a cancel for the
primary key special.
--
GnuPG-bug-id: 6093
(cherry picked from commit 49d16f4f6edf872babf04ae383974d891871a33b)
-rw-r--r-- | g10/export.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/g10/export.c b/g10/export.c index ddd94cf05..398b1302c 100644 --- a/g10/export.c +++ b/g10/export.c @@ -1827,7 +1827,16 @@ do_export_one_keyblock (ctrl_t ctrl, kbnode_t keyblock, u32 *keyid, hexgrip, pk); if (err) { - if (gpg_err_code (err) == GPG_ERR_FULLY_CANCELED) + /* If we receive a fully canceled error we stop + * immediately. If we receive a cancel for a public + * key we also stop immediately because a + * public/secret key is always required first + * (right, we could instead write a stub key but + * that is also kind of surprising). If we receive + * a subkey we skip to the next subkey. */ + if (gpg_err_code (err) == GPG_ERR_FULLY_CANCELED + || (node->pkt->pkttype == PKT_PUBLIC_KEY + && gpg_err_code (err) == GPG_ERR_CANCELED)) goto leave; write_status_error ("export_keys.secret", err); skip_until_subkey = 1; |