1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

Add component pinentry as an easy way to figure out the default

pinentry.  Also allows to test whether pinentry is installed.
This commit is contained in:
Werner Koch 2010-08-19 09:53:55 +00:00
parent 34dde96669
commit 77d2908ce4
3 changed files with 46 additions and 7 deletions

View File

@ -399,7 +399,7 @@ This option does nothing yet.
@item --pinentry-program @var{filename}
@opindex pinentry-program
Use program @var{filename} as the PIN entry. The default is installation
dependent and can be shown with the @code{--version} command.
dependent.
@item --pinentry-touch-file @var{filename}
@opindex pinentry-touch-file
@ -415,7 +415,7 @@ modification and access time.
@item --scdaemon-program @var{filename}
@opindex scdaemon-program
Use program @var{filename} as the Smartcard daemon. The default is
installation dependent and can be shown with the @code{--version}
installation dependent and can be shown with the @command{gpgconf}
command.
@item --disable-scdaemon

View File

@ -1,3 +1,10 @@
2010-08-19 Werner Koch <wk@g10code.com>
* gpgconf-comp.c: Add new backend and component for PINENTRY.
(gc_component_check_options): Use --version to test the pinentry.
(gc_component_retrieve_options, gc_component_change_options):
Ignore the pinentry component.
2010-08-16 Werner Koch <wk@g10code.com>
* gpgconf.c (get_outfp): Change to use estream.

View File

@ -133,12 +133,15 @@ typedef enum
/* The GnuPG SCDaemon. */
GC_BACKEND_SCDAEMON,
/* The Aegypten directory manager. */
/* The GnuPG directory manager. */
GC_BACKEND_DIRMNGR,
/* The LDAP server list file for the Aegypten director manager. */
/* The LDAP server list file for the director manager. */
GC_BACKEND_DIRMNGR_LDAP_SERVER_LIST,
/* The Pinentry (not a part of GnuPG, proper). */
GC_BACKEND_PINENTRY,
/* The number of the above entries. */
GC_BACKEND_NR
} gc_backend_t;
@ -158,7 +161,7 @@ static struct
/* The module name (GNUPG_MODULE_NAME_foo) as defined by
../common/util.h. This value is used to get the actual installed
path of the program. 0 is used if no backedn program is
path of the program. 0 is used if no backend program is
available. */
char module_name;
@ -189,6 +192,8 @@ static struct
NULL, "gpgconf-dirmngr.conf" },
{ "DirMngr LDAP Server List", NULL, 0,
NULL, "ldapserverlist-file", "LDAP Server" },
{ "Pinentry", "pinentry", GNUPG_MODULE_NAME_PINENTRY,
NULL, "gpgconf-pinentry.conf" },
};
@ -939,6 +944,19 @@ static gc_option_t gc_options_dirmngr[] =
GC_OPTION_NULL
};
/* The options of the GC_COMPONENT_PINENTRY component. */
static gc_option_t gc_options_pinentry[] =
{
/* A dummy option to allow gc_component_list_components to find the
pinentry backend. Needs to be a conf file. */
{ "gpgconf-pinentry.conf", GC_OPT_FLAG_NONE, GC_LEVEL_INTERNAL,
NULL, NULL, GC_ARG_TYPE_FILENAME, GC_BACKEND_PINENTRY },
GC_OPTION_NULL
};
/* 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
@ -960,6 +978,9 @@ typedef enum
/* The LDAP Directory Manager for CRLs. */
GC_COMPONENT_DIRMNGR,
/* The external Pinentry. */
GC_COMPONENT_PINENTRY,
/* The number of components. */
GC_COMPONENT_NR
} gc_component_t;
@ -988,7 +1009,8 @@ static struct
{ "gpg-agent", NULL, "GPG Agent", gc_options_gpg_agent },
{ "scdaemon", NULL, "Smartcard Daemon", gc_options_scdaemon },
{ "gpgsm", NULL, "GPG for S/MIME", gc_options_gpgsm },
{ "dirmngr", NULL, "Directory Manager", gc_options_dirmngr }
{ "dirmngr", NULL, "Directory Manager", gc_options_dirmngr },
{ "pinentry", NULL, "PIN and Passphrase Entry", gc_options_pinentry }
};
@ -1482,6 +1504,9 @@ gc_component_check_options (int component, estream_t out, const char *conf_file)
argv[i++] = "--options";
argv[i++] = conf_file;
}
if (component == GC_COMPONENT_PINENTRY)
argv[i++] = "--version";
else
argv[i++] = "--gpgconf-test";
argv[i++] = NULL;
@ -1556,6 +1581,7 @@ gc_component_check_options (int component, estream_t out, const char *conf_file)
}
/* Check all components that are available. */
void
gc_check_programs (estream_t out)
@ -2117,6 +2143,9 @@ gc_component_retrieve_options (int component)
gc_backend_t backend;
gc_option_t *option;
if (component == GC_COMPONENT_PINENTRY)
return; /* Dummy module for now. */
for (backend = 0; backend < GC_BACKEND_NR; backend++)
backend_seen[backend] = 0;
@ -2992,6 +3021,9 @@ gc_component_change_options (int component, estream_t in, estream_t out)
size_t line_len = 0;
ssize_t length;
if (component == GC_COMPONENT_PINENTRY)
return; /* Dummy component for now. */
for (backend = 0; backend < GC_BACKEND_NR; backend++)
{
runtime[backend] = 0;