After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 651826 - GMimeGpgContext: provide a way to ask gpg to use the gpg-agent
GMimeGpgContext: provide a way to ask gpg to use the gpg-agent
Status: RESOLVED FIXED
Product: gmime
Classification: Other
Component: general
2.4.x
Other Linux
: Normal normal
: ---
Assigned To: Jeffrey Stedfast
Jeffrey Stedfast
Depends on:
Blocks:
 
 
Reported: 2011-06-03 23:32 UTC by Daniel Kahn Gillmor
Modified: 2011-06-08 16:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed (but untested) patch for adding use_agent flag (3.95 KB, patch)
2011-06-04 00:46 UTC, Daniel Kahn Gillmor
none Details | Review

Description Daniel Kahn Gillmor 2011-06-03 23:32:07 UTC
It would be nice to have something like g_mime_gpg_context_{set,get}_use_agent; this could be used to indicate that the calling process expects to be used in an environment with gpg-agent running.
Comment 1 Daniel Kahn Gillmor 2011-06-04 00:46:36 UTC
Created attachment 189193 [details] [review]
proposed (but untested) patch for adding use_agent flag

This patch against gmime 2.4 is untested as i appear to be unable to build from source at the moment.

I'm also not sure if it introduces an incompatible ABI change due to the modification of the _GMimeGpgContext struct (does the leading underscore mean it it's a private definition despite being in a public header file?) -- if it's an ABI bump, that's clearly a no-go for the stable branch.

i'd be happy to see this on the 2.5 branch as well, of course.

I note that one oddity here is that FALSE simply means "don't supply an additional --use-agent flag" -- so if the user still has use-agent set in ~/.gnupg/gpg.conf, they will still talk to the agent.

The proposed patch has no way to indicate "supply --no-use-agent as an argument", which would actually allow the gmime invocation to explicitly prohibit gpg from talking to any running agent.

I actually think this asymmetry is fine, since i don't see a good argument for avoiding talking to an agent if one is present (and the upcoming gpg 2.1 actually requires the use of an agent, so --no-use-agent would be crippling for any crypto invocation that needed access to secret credentials).
Comment 2 Jeffrey Stedfast 2011-06-08 16:29:44 UTC
I agree about the --no-use-agent thing.

As far as ABI breakage, yes, unfortunately it breaks ABI :(

struct _GMimeGpgContext gets typedef'd to GMimeGpgContext, so it is public.

I've modified the patch a bit. It was only setting use_agent for sign+encrypt but not sign nor decrypt, so I made it pass that option along for those modes as well.

I also ported your patch to 2.5.x and committed it there.