diff options
author | NIIBE Yutaka <[email protected]> | 2021-06-04 04:44:05 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2021-06-08 00:12:26 +0000 |
commit | 2f98d8a0f92dc991bff406e159690a111202fcb4 (patch) | |
tree | f1afdf8f942ce90a917ad8bfa36efef8ae3df3c0 | |
parent | dirmngr: Remove useless code. (diff) | |
download | gnupg-2f98d8a0f92dc991bff406e159690a111202fcb4.tar.gz gnupg-2f98d8a0f92dc991bff406e159690a111202fcb4.zip |
agent: Appropriate error code for importing key with no passwd.
* agent/cvt-openpgp.c (convert_from_openpgp_main): Return
GPG_ERR_BAD_SECKEY.
--
Backport master commit of:
21ef425e222ddfa460b37dece63adb67ff2e4dd1
When non-protected case, error at gcry_pk_testkey results
GPG_ERR_BAD_PASSPHRASE. Here, it should be converted to
GPG_ERR_BAD_SECKEY, or else, user will be asked passwd even if it's
not protected.
Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r-- | agent/cvt-openpgp.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/agent/cvt-openpgp.c b/agent/cvt-openpgp.c index ff153c358..130468667 100644 --- a/agent/cvt-openpgp.c +++ b/agent/cvt-openpgp.c @@ -946,6 +946,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) { |