mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
gpgconf: New option --show-versions.
* tools/gpgconf.c: Include exechelp.h. New option --show-versions. (get_revision_from_blurb): New. (show_version_gnupg): New. (show_version_libgcrypt): New. (show_version_gpgrt): New. (show_versions_via_dirmngr): New. (show_versions): New. * tools/gpgconf-comp.c (GPGNAME): Remove unused macro. * dirmngr/dirmngr.c (main): New internal option --gpgconf-versions. (get_revision_from_blurb): New. (gpgconf_versions): New. -- This option should be helpful to gather information for debugging. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
371228a244
commit
357ad9ae29
3 changed files with 235 additions and 9 deletions
|
@ -99,6 +99,7 @@ enum cmd_and_opt_values {
|
|||
aFlush,
|
||||
aGPGConfList,
|
||||
aGPGConfTest,
|
||||
aGPGConfVersions,
|
||||
|
||||
oOptions,
|
||||
oDebug,
|
||||
|
@ -161,6 +162,7 @@ static gpgrt_opt_t opts[] = {
|
|||
|
||||
ARGPARSE_c (aGPGConfList, "gpgconf-list", "@"),
|
||||
ARGPARSE_c (aGPGConfTest, "gpgconf-test", "@"),
|
||||
ARGPARSE_c (aGPGConfVersions, "gpgconf-versions", "@"),
|
||||
|
||||
ARGPARSE_group (300, N_("@Commands:\n ")),
|
||||
|
||||
|
@ -411,6 +413,8 @@ static ldap_server_t parse_ldapserver_file (const char* filename, int ienoent);
|
|||
static fingerprint_list_t parse_ocsp_signer (const char *string);
|
||||
static void netactivity_action (void);
|
||||
static void handle_connections (assuan_fd_t listen_fd);
|
||||
static void gpgconf_versions (void);
|
||||
|
||||
|
||||
/* NPth wrapper function definitions. */
|
||||
ASSUAN_SYSTEM_NPTH_IMPL;
|
||||
|
@ -1007,6 +1011,7 @@ main (int argc, char **argv)
|
|||
case aFetchCRL:
|
||||
case aGPGConfList:
|
||||
case aGPGConfTest:
|
||||
case aGPGConfVersions:
|
||||
cmd = pargs.r_opt;
|
||||
break;
|
||||
|
||||
|
@ -1116,7 +1121,7 @@ main (int argc, char **argv)
|
|||
* because it will attempt to connect to the tor client and that can
|
||||
* be time consuming. */
|
||||
post_option_parsing ();
|
||||
if (cmd != aGPGConfTest && cmd != aGPGConfList)
|
||||
if (cmd != aGPGConfTest && cmd != aGPGConfList && cmd != aGPGConfVersions)
|
||||
set_tor_mode ();
|
||||
|
||||
/* Get LDAP server list from file. */
|
||||
|
@ -1518,6 +1523,9 @@ main (int argc, char **argv)
|
|||
es_printf ("resolver-timeout:%lu:%u\n",
|
||||
flags | GC_OPT_FLAG_DEFAULT, 0);
|
||||
}
|
||||
else if (cmd == aGPGConfVersions)
|
||||
gpgconf_versions ();
|
||||
|
||||
cleanup ();
|
||||
return !!rc;
|
||||
}
|
||||
|
@ -2327,3 +2335,61 @@ dirmngr_get_current_socket_name (void)
|
|||
else
|
||||
return dirmngr_socket_name ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Parse the revision part from the extended version blurb. */
|
||||
static const char *
|
||||
get_revision_from_blurb (const char *blurb, int *r_len)
|
||||
{
|
||||
const char *s = blurb? blurb : "";
|
||||
int n;
|
||||
|
||||
for (; *s; s++)
|
||||
if (*s == '\n' && s[1] == '(')
|
||||
break;
|
||||
if (s)
|
||||
{
|
||||
s += 2;
|
||||
for (n=0; s[n] && s[n] != ' '; n++)
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
s = "?";
|
||||
n = 1;
|
||||
}
|
||||
*r_len = n;
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
/* Print versions of dirmngr and used libraries. This is used by
|
||||
* "gpgconf --show-versions" so that there is no need to link gpgconf
|
||||
* against all these libraries. This is an internal API and should
|
||||
* not be relied upon. */
|
||||
static void
|
||||
gpgconf_versions (void)
|
||||
{
|
||||
const char *s;
|
||||
int n;
|
||||
|
||||
/* Unfortunately Npth has no way to get the version. */
|
||||
|
||||
s = get_revision_from_blurb (assuan_check_version ("\x01\x01"), &n);
|
||||
es_fprintf (es_stdout, "* Libassuan %s (%.*s)\n\n",
|
||||
assuan_check_version (NULL), n, s);
|
||||
|
||||
es_fprintf (es_stdout, "* KSBA %s \n\n",
|
||||
ksba_check_version (NULL));
|
||||
|
||||
#ifdef HTTP_USE_NTBTLS
|
||||
s = get_revision_from_blurb (ntbtls_check_version ("\x01\x01"), &n);
|
||||
es_fprintf (es_stdout, "* NTBTLS %s (%.*s)\n\n",
|
||||
ntbtls_check_version (NULL), n, s);
|
||||
#elif HTTP_USE_GNUTLS
|
||||
es_fprintf (es_stdout, "* GNUTLS %s\n\n",
|
||||
gnutls_check_version (NULL));
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue