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.
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)
{
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;
}
}