gpgconf: Rewrite the gpgconf-comp module.

* tools/gpgconf.h (gc_component_t): Change type to ...
(gc_component_id_t): this.
(GC_COMPONENT_ANY): New, so that we can use that in gpgconf-comp.c
directly.
* tools/gpgconf-comp.c: Major rework.
--

The primary reason for this rework is to support the global options.
A second reason is to clean up the code and simplify it so that we do
not anymore need to maintain a list of options in the components _and_
in gpgconf-comp.c.

What we do now is to

 1. Read the option tables directly from the components using
    the new generic --dump-option-table option.  This includes
    the header (group) descriptions.

 2. Read the default values from the components as before using
    --gpgconf-list and update gpgconf's internal tables with
    that info.

 3. Read the options using gpgrt_argparser in the same way as we do
    this in the components.

The changes also do away with the second level notion of backends;
they were only used for dirmngr's extra dirmngr_ldapservers.conf file.
We intend to remove that file and replace it with a regular option so
that it will be similar on how OpenPGP keyservers are specified.

The whole thing will currently be slower than before (in particular on
Windows) but we can optimize that by keeping a cached version of the
option tables and the default values in a per homedir cache file.

There is also some work planned to remove most of the data returned by
--gpgconf-list.  What can also be done is to replace the internal
tables, which list the gpgconf maintainable options, by a configuration
file so that admins are able to maintain the list of these options.

GnuPG-bug-id: 4788
Signed-off-by: Werner Koch <wk@gnupg.org>

This is a backport from master (2.3)
This commit is contained in:
Werner Koch 2020-03-12 10:16:56 +01:00
parent 5f890f417f
commit 7a3a1ef370
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
2 changed files with 668 additions and 1644 deletions

File diff suppressed because it is too large Load Diff

View File

@ -46,9 +46,12 @@ void gpgconf_failure (gpg_error_t err) GPGRT_ATTR_NORETURN;
/* Component system. Each component is a set of options that can be
* configured at the same time. If you change this, don't forget to
* update GC_COMPONENT in gpgconf-comp.c. */
* update gc_component[] in gpgconf-comp.c. */
typedef enum
{
/* Any component, used as a wildcard arg. */
GC_COMPONENT_ANY,
/* The classic GPG for OpenPGP. */
GC_COMPONENT_GPG,
@ -69,7 +72,7 @@ typedef enum
/* The number of components. */
GC_COMPONENT_NR
} gc_component_t;
} gc_component_id_t;
/* Initialize the components. */