aboutsummaryrefslogtreecommitdiffstats
path: root/src/engine-gpg.c
diff options
context:
space:
mode:
authorAndre Heinecke <[email protected]>2018-07-03 15:50:23 +0000
committerAndre Heinecke <[email protected]>2018-07-09 08:58:04 +0000
commit7bc5d3c7e41c6e42a583a61a4c9504058fbb2976 (patch)
tree68a40e8c6a2ab8a9a9af69b2e85636d1085cbe1c /src/engine-gpg.c
parentpython bindings: howto examples (diff)
downloadgpgme-7bc5d3c7e41c6e42a583a61a4c9504058fbb2976.tar.gz
gpgme-7bc5d3c7e41c6e42a583a61a4c9504058fbb2976.zip
Add ctx flag for auto-key-locate
* 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. (gpg_release): Free 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 Differential Revision: https://dev.gnupg.org/D463
Diffstat (limited to 'src/engine-gpg.c')
-rw-r--r--src/engine-gpg.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/engine-gpg.c b/src/engine-gpg.c
index f096bcbf..be78957f 100644
--- a/src/engine-gpg.c
+++ b/src/engine-gpg.c
@@ -140,6 +140,7 @@ struct engine_gpg
struct gpgme_io_cbs io_cbs;
gpgme_pinentry_mode_t pinentry_mode;
char request_origin[10];
+ char *auto_key_locate;
struct {
unsigned int no_symkey_cache : 1;
@@ -453,6 +454,7 @@ gpg_release (void *engine)
free_argv (gpg->argv);
if (gpg->cmd.keyword)
free (gpg->cmd.keyword);
+ free (gpg->auto_key_locate);
gpgme_data_release (gpg->override_session_key);
gpgme_data_release (gpg->diagnostics);
@@ -659,6 +661,14 @@ gpg_set_engine_flags (void *engine, const gpgme_ctx_t ctx)
else
*gpg->request_origin = 0;
+ if (ctx->auto_key_locate && have_gpg_version (gpg, "2.1.18"))
+ {
+ if (gpg->auto_key_locate)
+ free (gpg->auto_key_locate);
+ gpg->auto_key_locate = _gpgme_strconcat ("--auto-key-locate=",
+ ctx->auto_key_locate, NULL);
+ }
+
gpg->flags.no_symkey_cache = (ctx->no_symkey_cache
&& have_gpg_version (gpg, "2.2.7"));
gpg->flags.offline = (ctx->offline && have_gpg_version (gpg, "2.1.23"));
@@ -958,6 +968,19 @@ build_argv (engine_gpg_t gpg, const char *pgmname)
argc++;
}
+ if (gpg->auto_key_locate)
+ {
+ argv[argc] = strdup (gpg->auto_key_locate);
+ if (!argv[argc])
+ {
+ int saved_err = gpg_error_from_syserror ();
+ free (fd_data_map);
+ free_argv (argv);
+ return saved_err;
+ }
+ argc++;
+ }
+
if (gpg->flags.no_symkey_cache)
{
argv[argc] = strdup ("--no-symkey-cache");