Add ctx flag for auto-key-locate
ClosedPublic

Authored by aheinecke on Jul 3 2018, 6:02 PM.

Details

Summary
  • src/context.h (gpgme_context): Add auto_key_locate.
  • src/engine-gpg.c (engine_gpg): Add auto_key_locate.

(gpg_set_engine_flags, build_argv): Handle auto_key_locate.

  • src/gpgme.c (gpgme_release): Free auto_key_locate.

(gpgme_get_ctx_flag, gpgme_set_ctx_flag): Handle auto-key-locate.

  • doc/gpgme.texi: Document auto-key-locate flag.
  • tests/run-keylist.c (show_usage, main): Add --from-wkd option.

This enables users of GPGME to control more fine grained what
auto-key-locate does. Especially for WKD lookups / refreshes
can this be useful.

GnuPG-Bug-Id: T2917

Test Plan

Tested with the run tool

Diff Detail

Repository
rM GPGME
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
aheinecke created this revision.Jul 3 2018, 6:02 PM

I find this better then a new "KEYLIST_MODE_WKD" as it is more flexible and this flexibility with context flags is currently our thing anyway.

Use cases are:

  • Updating a key from WKD
  • Checking for an existing key if it is also available from WKD
  • Showing which keys are in the WKD for a users mail address (e.g. in case a new one is generated).

So I think that I need this.

werner accepted this revision.Jul 5 2018, 5:23 PM
werner added inline comments.
src/engine-gpg.c
673

if you really want the check for a gpg version, I would use 2.1.18 instead.

Instead of allocating a 100 byte array it is easier to

free (gpg->auto_key_locate);
gpg->auto_key_locate = _gpgme_strconcat ("--auto-key-locate=", ctx->auto_key_locate);

and release that in gpg_release. Adding the option to the command line will also be easier.

This revision is now accepted and ready to land.Jul 5 2018, 5:23 PM
This revision was automatically updated to reflect the committed changes.