From: Jani Nikula <jani@nikula.org>
To: notmuch@notmuchmail.org
Subject: [PATCH] cli: crypto: tell gmime to use gpg-agent
Date: Wed, 27 Feb 2013 09:40:38 +0200 [thread overview]
Message-ID: <1361950838-22919-1-git-send-email-jani@nikula.org> (raw)
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
---
crypto.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/crypto.c b/crypto.c
index fbe5aeb..cb361e1 100644
--- a/crypto.c
+++ b/crypto.c
@@ -45,6 +45,9 @@ notmuch_crypto_get_context (notmuch_crypto_t *crypto, const char *protocol)
g_object_unref (session);
#endif
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);
} else {
fprintf (stderr, "Failed to construct gpg context.\n");
--
1.7.10.4
next reply other threads:[~2013-02-27 7:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-27 7:40 Jani Nikula [this message]
2013-02-27 8:45 ` [PATCH] cli: crypto: tell gmime to use gpg-agent Tomi Ollila
2013-02-27 16:14 ` Jameson Graef Rollins
2013-02-27 17:11 ` David Bremner
2013-02-27 17:25 ` Jameson Graef Rollins
2013-02-27 22:46 ` Jani Nikula
2013-03-01 0:10 ` Jameson Graef Rollins
2013-03-01 6:12 ` Daniel Kahn Gillmor
2013-03-01 6:52 ` Tomi Ollila
2013-03-01 16:43 ` [PATCH] man: show and reply --decrypt option requires gpg-agent Jani Nikula
2013-03-01 16:56 ` Jameson Graef Rollins
2013-03-02 14:48 ` [PATCH] cli: crypto: tell gmime to use gpg-agent David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1361950838-22919-1-git-send-email-jani@nikula.org \
--to=jani@nikula.org \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).