mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-22 19:08:09 +01:00
cli: crypto: tell gmime to use gpg-agent
For decryption, we expect there to be a functioning gpg-agent, and we want gpg to talk to it for any needed credentials. There's a gmime function to declare that: g_mime_gpg_context_set_use_agent() [1], [2]. Start using it. I had gpg-agent running, but gpg "use-agent" configuration option disabled. This resulted in an error message from 'notmuch show': Failed to decrypt part: Canceled. and json had this: "encstatus" : [ { "status" : "bad" } ] One could argue the "use-agent" option should be enabled, but I'd like to use the agent only as a last resort. I think that's irrelevant though. There's a gmime function to declare what we expect, so we should use it. Conveniently it also fixes the problem in a user friendly way. [1] http://git.gnome.org/browse/gmime/commit/?id=ed985397843a9da3745a8b5de3d1d652acd24724 [2] https://bugzilla.gnome.org/show_bug.cgi?id=651826
This commit is contained in:
parent
11858e2457
commit
c5c5770b22
1 changed files with 3 additions and 0 deletions
3
crypto.c
3
crypto.c
|
@ -45,6 +45,9 @@ notmuch_crypto_get_context (notmuch_crypto_t *crypto, const char *protocol)
|
||||||
g_object_unref (session);
|
g_object_unref (session);
|
||||||
#endif
|
#endif
|
||||||
if (crypto->gpgctx) {
|
if (crypto->gpgctx) {
|
||||||
|
#ifdef GMIME_ATLEAST_26
|
||||||
|
g_mime_gpg_context_set_use_agent ((GMimeGpgContext*) crypto->gpgctx, TRUE);
|
||||||
|
#endif
|
||||||
g_mime_gpg_context_set_always_trust ((GMimeGpgContext*) crypto->gpgctx, FALSE);
|
g_mime_gpg_context_set_always_trust ((GMimeGpgContext*) crypto->gpgctx, FALSE);
|
||||||
} else {
|
} else {
|
||||||
fprintf (stderr, "Failed to construct gpg context.\n");
|
fprintf (stderr, "Failed to construct gpg context.\n");
|
||||||
|
|
Loading…
Reference in a new issue