aboutsummaryrefslogtreecommitdiffstats
path: root/src/engine-gpg.c
diff options
context:
space:
mode:
authorIngo Klöcker <[email protected]>2022-11-04 09:21:25 +0000
committerIngo Klöcker <[email protected]>2022-11-04 09:38:41 +0000
commit4f874ea431ba68ba70cf569741488502b1f61e66 (patch)
tree9b17d35addc0d86ecbb60bbf51a9004932de34b6 /src/engine-gpg.c
parentbuild: Update libassuan.m4. (diff)
downloadgpgme-4f874ea431ba68ba70cf569741488502b1f61e66.tar.gz
gpgme-4f874ea431ba68ba70cf569741488502b1f61e66.zip
core: New context flag "no-auto-check-trustdb"
* src/context.h (gpgme_context): Add field no_auto_check_trustdb. * src/gpgme.c (gpgme_set_ctx_flag, gpgme_get_ctx_flag): Add flag "no-auto-check-trustdb". * src/engine-gpg.c (engine_gpg): Add flags.no_auto_check_trustdb. (gpg_set_engine_flags): Set the flag. (build_argv): Pass option to gpg. * tests/run-keylist.c (show_usage, main): Add option --no-trust-check. -- This makes the --no-auto-check-trustdb option available in the GPGME API to disable the potentially expensive automatic trust database check. GnuPG-bug-id: 6261
Diffstat (limited to 'src/engine-gpg.c')
-rw-r--r--src/engine-gpg.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/engine-gpg.c b/src/engine-gpg.c
index 3bf5223c..9d20f2ba 100644
--- a/src/engine-gpg.c
+++ b/src/engine-gpg.c
@@ -150,6 +150,7 @@ struct engine_gpg
unsigned int ignore_mdc_error : 1;
unsigned int include_key_block : 1;
unsigned int auto_key_import : 1;
+ unsigned int no_auto_check_trustdb : 1;
} flags;
/* NULL or the data object fed to --override_session_key-fd. */
@@ -695,6 +696,8 @@ gpg_set_engine_flags (void *engine, const gpgme_ctx_t ctx)
if (ctx->include_key_block)
gpg->flags.include_key_block = 1;
}
+
+ gpg->flags.no_auto_check_trustdb = !!ctx->no_auto_check_trustdb;
}
@@ -934,6 +937,8 @@ build_argv (engine_gpg_t gpg, const char *pgmname)
argc++;
if (gpg->flags.offline)
argc++;
+ if (gpg->flags.no_auto_check_trustdb)
+ argc++;
if (gpg->pinentry_mode)
argc++;
if (!gpg->cmd.used)
@@ -1070,6 +1075,19 @@ build_argv (engine_gpg_t gpg, const char *pgmname)
argc++;
}
+ if (gpg->flags.no_auto_check_trustdb)
+ {
+ argv[argc] = strdup ("--no-auto-check-trustdb");
+ if (!argv[argc])
+ {
+ int saved_err = gpg_error_from_syserror ();
+ free (fd_data_map);
+ free_argv (argv);
+ return saved_err;
+ }
+ argc++;
+ }
+
if (gpg->pinentry_mode && have_gpg_version (gpg, "2.1.0"))
{
const char *s = NULL;