diff options
author | Andre Heinecke <[email protected]> | 2018-09-12 07:42:09 +0000 |
---|---|---|
committer | Andre Heinecke <[email protected]> | 2018-10-09 08:48:58 +0000 |
commit | 85627e58184529e982369cfc00ed7865244c13d6 (patch) | |
tree | 307d51952c0f108f9b80d2635ad989540e9a5fa4 /tests/run-keylist.c | |
parent | cpp: Initialize all gpgme_key_t's in context (diff) | |
download | gpgme-85627e58184529e982369cfc00ed7865244c13d6.tar.gz gpgme-85627e58184529e982369cfc00ed7865244c13d6.zip |
core: Add trust-model flag
* src/context.h (gpgme_context): Extend with trust_model.
* src/engine-gpg.c (engine_gpg): Extend with trust_model.
(gpg_set_engine_flags): Take trust_model from context.
(build_argv): Handle trust_model.
(gpg_release): Free trust_model.
* src/gpgme.c (gpgme_set_ctx_flag): Handle trust-model flag.
(gpgme_release): Release trust-model.
* doc/gpgme.texi: Document new flag for gpgme_set_ctx_flag.
(Context Flags): New subsection for the context flags.
* tests/run-keylist.c (show_usage, main): Add new --trust-model
parameter.
--
This gives a GPGME user fine grained control over the
trust-model.
Changing the trust model for only a single application depends
on:
GnuPG-Bug-Id: T4134
Maniphest Tasks: T4134
Differential Revision: https://dev.gnupg.org/D466
Diffstat (limited to 'tests/run-keylist.c')
-rw-r--r-- | tests/run-keylist.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/run-keylist.c b/tests/run-keylist.c index 9206b50a..08b671dd 100644 --- a/tests/run-keylist.c +++ b/tests/run-keylist.c @@ -60,6 +60,7 @@ show_usage (int ex) " --from-file list all keys in the given file\n" " --from-wkd list key from a web key directory\n" " --require-gnupg required at least the given GnuPG version\n" + " --trust-model use the specified trust-model\n" , stderr); exit (ex); } @@ -104,6 +105,7 @@ main (int argc, char **argv) int from_file = 0; int from_wkd = 0; gpgme_data_t data = NULL; + char *trust_model = NULL; if (argc) @@ -208,6 +210,14 @@ main (int argc, char **argv) mode |= GPGME_KEYLIST_MODE_LOCATE; from_wkd = 1; } + else if (!strcmp (*argv, "--trust-model")) + { + argc--; argv++; + if (!argc) + show_usage (1); + trust_model = strdup (*argv); + argc--; argv++; + } else if (!strncmp (*argv, "--", 2)) show_usage (1); } @@ -227,6 +237,12 @@ main (int argc, char **argv) gpgme_set_offline (ctx, offline); + if (trust_model) + { + err = gpgme_set_ctx_flag (ctx, "trust-model", trust_model); + fail_if_err (err); + } + if (from_wkd) { err = gpgme_set_ctx_flag (ctx, "auto-key-locate", @@ -401,6 +417,8 @@ main (int argc, char **argv) for (keyidx=0; keyarray[keyidx]; keyidx++) gpgme_key_unref (keyarray[keyidx]); + free (trust_model); + gpgme_release (ctx); return 0; } |