From 47f61df0704485b8165c9cf2a27ad57bcd864239 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 24 Aug 2017 17:17:11 +0200 Subject: core: New context flag "auto-key-retrieve" * src/gpgme.c (gpgme_set_ctx_flag, gpgme_get_ctx_flag): New flag "auto-key-retrieve". * src/context.h (gpgme_context): New field auto_key_retrieve. * src/engine-backend.h (struct engine_ops): Add arg auto_key_retrieve to field 'decrypt'. * src/engine-gpg.c (gpg_decrypt): Add arg auto_key_retrieve and pass option --auto-key-retrieve to gpg. Adjust all callers. (gpg_verify): Ditto. * src/engine-gpgsm.c (gpgsm_decrypt): Add dummy arg auto_key_retrieve. * src/engine-uiserver.c (uiserver_decrypt): Ditto. * tests/run-verify.c (main): Add option --auto-key-retrieve. -- This makes the --auto-key-retrieve option available in the GPGME API. Test plan: Run GPGME_DEBUG=9:out tests/run-verify SIGNEDFILE with and without its new option --auto-key-retrieve and check in the trace stored in "out" whether --auto-key-retrieve was passed to gpg. Signed-off-by: Werner Koch --- src/gpgme.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/gpgme.c') diff --git a/src/gpgme.c b/src/gpgme.c index 2b196a25..d0a5afee 100644 --- a/src/gpgme.c +++ b/src/gpgme.c @@ -531,6 +531,10 @@ gpgme_set_ctx_flag (gpgme_ctx_t ctx, const char *name, const char *value) if (!ctx->override_session_key) err = gpg_error_from_syserror (); } + else if (!strcmp (name, "auto-key-retrieve")) + { + ctx->auto_key_retrieve = abool; + } else err = gpg_error (GPG_ERR_UNKNOWN_NAME); @@ -568,6 +572,10 @@ gpgme_get_ctx_flag (gpgme_ctx_t ctx, const char *name) { return ctx->override_session_key? ctx->override_session_key : ""; } + else if (!strcmp (name, "auto-key-retrieve")) + { + return ctx->auto_key_retrieve? "1":""; + } else return NULL; } -- cgit v1.2.3