summaryrefslogtreecommitdiffstats
path: root/crypt-gpgme.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2018-03-22 09:32:31 -0700
committerKevin McCarthy <kevin@8t8.us>2018-03-22 09:32:31 -0700
commiteeba9a9ba9262d820b448ce680b1e7c9c5c13ff4 (patch)
treea31f6ef7164476857604f55a734290b337d5dedd /crypt-gpgme.c
parent9eeb406b5cea519185bccb9ab0ac65bbec221063 (diff)
Fix s/mime non-detached signature handling.
This fix is based on stbuehler's patch from https://dev.gnupg.org/T2919. Recent versions of gpgme seem to terminate the connection for a protocol error. stbuehler's analysis is that this is actually a gpgme bug, but recreating the context works around the problem.
Diffstat (limited to 'crypt-gpgme.c')
-rw-r--r--crypt-gpgme.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/crypt-gpgme.c b/crypt-gpgme.c
index 7283e109..03cf7f0d 100644
--- a/crypt-gpgme.c
+++ b/crypt-gpgme.c
@@ -1685,9 +1685,9 @@ static BODY *decrypt_part (BODY *a, STATE *s, FILE *fpout, int is_smime,
if (r_is_signed)
*r_is_signed = 0;
+restart:
ctx = create_gpgme_context (is_smime);
- restart:
/* Make a data object from the body, create context etc. */
ciphertext = file_to_data_object (s->fpin, a->offset, a->length);
if (!ciphertext)
@@ -1730,6 +1730,9 @@ static BODY *decrypt_part (BODY *a, STATE *s, FILE *fpout, int is_smime,
{
maybe_signed = 1;
gpgme_data_release (plaintext);
+ /* We release the context because recent versions of gpgme+gpgsm
+ * appear to end the session after an error */
+ gpgme_release (ctx);
goto restart;
}
}