diff options
author | Werner Koch <wk@gnupg.org> | 2022-01-26 12:47:56 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2022-01-26 12:47:56 +0100 |
commit | 8fb23094c2f520e346170fe64d8b9b2e27e8dd64 (patch) | |
tree | 2bc16dbabb120ad5d46e80fe4134d39c5b2e5ab0 /tools/gpgconf-comp.c | |
parent | gpgconf: Return --ldapserver and --keyserver from dirmngr. (diff) | |
download | gnupg2-8fb23094c2f520e346170fe64d8b9b2e27e8dd64.tar.xz gnupg2-8fb23094c2f520e346170fe64d8b9b2e27e8dd64.zip |
gpgconf: Fix --list-options for forced options
* tools/gpgconf-comp.c (retrieve_options_from_program): Ignore to to
ignored options. Add failsafe code to avoid calling percent_escape
with NULL.
--
Remember: When using ARGPARSE_FLAG_WITHATTR the ARGPARSE_OPT_IGNORE
flags in the returned type needs to be considered.
GnuPG-bug-id: 5800
Diffstat (limited to '')
-rw-r--r-- | tools/gpgconf-comp.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/gpgconf-comp.c b/tools/gpgconf-comp.c index 5a393732d..b8ed050ce 100644 --- a/tools/gpgconf-comp.c +++ b/tools/gpgconf-comp.c @@ -2071,6 +2071,8 @@ retrieve_options_from_program (gc_component_id_t component, int only_installed) /* pargs.r_type? pargs.r.ret_str: "[cmdline]"); */ continue; } + if ((pargs.r_type & ARGPARSE_OPT_IGNORE)) + continue; /* We only have the short option. Search in the option table * for the long option name. */ @@ -2111,7 +2113,10 @@ retrieve_options_from_program (gc_component_id_t component, int only_installed) opt_value = xasprintf ("%lu", pargs.r.ret_ulong); break; case ARGPARSE_TYPE_STRING: - opt_value = xasprintf ("\"%s", gc_percent_escape (pargs.r.ret_str)); + if (!pargs.r.ret_str) + opt_value = xstrdup ("\"(none)"); /* We should not see this. */ + else + opt_value = xasprintf ("\"%s", gc_percent_escape (pargs.r.ret_str)); break; default: /* ARGPARSE_TYPE_NONE or any unknown type. */ opt_value = xstrdup ("1"); /* Make sure we have some value. */ |