summaryrefslogtreecommitdiffstats
path: root/agent
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2021-06-04 06:44:05 +0200
committerNIIBE Yutaka <gniibe@fsij.org>2021-06-04 06:44:05 +0200
commit21ef425e222ddfa460b37dece63adb67ff2e4dd1 (patch)
tree8e073cfeac9a5d6b38b0ad4121a0eec0d0721369 /agent
parentgpg: Support KEYGRIP search with traditional keyring. (diff)
downloadgnupg2-21ef425e222ddfa460b37dece63adb67ff2e4dd1.tar.xz
gnupg2-21ef425e222ddfa460b37dece63adb67ff2e4dd1.zip
agent: Appropriate error code for importing key with no passwd.
* agent/cvt-openpgp.c (convert_from_openpgp_main): Return GPG_ERR_BAD_SECKEY. -- When non-protected case, error at gcry_pk_testkey results GPG_ERR_BAD_PASSPHRASE. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'agent')
-rw-r--r--agent/cvt-openpgp.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/agent/cvt-openpgp.c b/agent/cvt-openpgp.c
index 53c88154b..53d789a6e 100644
--- a/agent/cvt-openpgp.c
+++ b/agent/cvt-openpgp.c
@@ -995,6 +995,8 @@ convert_from_openpgp_main (ctrl_t ctrl, gcry_sexp_t s_pgp, int dontcare_exist,
if (!is_protected)
{
err = try_do_unprotect_cb (pi);
+ if (gpg_err_code (err) == GPG_ERR_BAD_PASSPHRASE)
+ err = gpg_error (GPG_ERR_BAD_SECKEY);
}
else if (cache_nonce)
{