From: Kevin McCarthy Date: Thu, 22 Mar 2018 16:32:31 +0000 (-0700) Subject: Fix s/mime non-detached signature handling. X-Git-Tag: mutt-1-9-5-rel~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eeba9a9ba9262d820b448ce680b1e7c9c5c13ff4;p=mutt 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. --- 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; } }