diff options
| author | NIIBE Yutaka <[email protected]> | 2019-07-05 06:16:08 +0000 |
|---|---|---|
| committer | NIIBE Yutaka <[email protected]> | 2019-07-05 06:16:08 +0000 |
| commit | 6cc4119ec03be61c78189a0bec99372035289b91 (patch) | |
| tree | b58c5b5db6a0afe7ede11f470143a05a686076a0 /g10/mainproc.c | |
| parent | dirmngr: fix handling of HTTPS redirections during HKP (diff) | |
| download | gnupg-6cc4119ec03be61c78189a0bec99372035289b91.tar.gz gnupg-6cc4119ec03be61c78189a0bec99372035289b91.zip | |
gpg: Return the last error for pubkey decryption.
* g10/mainproc.c (proc_encrypted): Check ->result against -1.
When c->dek == NULL, put GPG_ERR_NO_SECKEY only when not set.
* g10/pubkey-enc.c (get_session_key): Set k->result by the result of
get_it.
When no secret key is available for some reasons, return the last
specific error, if any.
GnuPG-bug-id: 4561
Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'g10/mainproc.c')
| -rw-r--r-- | g10/mainproc.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/g10/mainproc.c b/g10/mainproc.c index d99ac4386..ba03de660 100644 --- a/g10/mainproc.c +++ b/g10/mainproc.c @@ -583,7 +583,7 @@ proc_encrypted (CTX c, PACKET *pkt) struct pubkey_enc_list *list; for (list = c->pkenc_list; list; list = list->next) - if (list->result == GPG_ERR_NO_SECKEY) + if (list->result != -1) { char buf[20]; snprintf (buf, sizeof buf, "%08lX%08lX", @@ -668,7 +668,10 @@ proc_encrypted (CTX c, PACKET *pkt) } } else if (!c->dek) - result = GPG_ERR_NO_SECKEY; + { + if (!result) + result = GPG_ERR_NO_SECKEY; + } /* Compute compliance with CO_DE_VS. */ if (!result && is_status_enabled () |
