2009-01-26 10:21:10 +00:00
|
|
|
|
/* dirinfo.c - Get directory information
|
2013-08-02 13:25:23 +00:00
|
|
|
|
* Copyright (C) 2009, 2013 g10 Code GmbH
|
2009-01-26 10:21:10 +00:00
|
|
|
|
*
|
|
|
|
|
* This file is part of GPGME.
|
|
|
|
|
*
|
|
|
|
|
* GPGME is free software; you can redistribute it and/or modify it
|
|
|
|
|
* under the terms of the GNU Lesser General Public License as
|
|
|
|
|
* published by the Free Software Foundation; either version 2.1 of
|
|
|
|
|
* the License, or (at your option) any later version.
|
2012-09-25 13:29:49 +00:00
|
|
|
|
*
|
2009-01-26 10:21:10 +00:00
|
|
|
|
* GPGME is distributed in the hope that it will be useful, but
|
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* Lesser General Public License for more details.
|
2012-09-25 13:29:49 +00:00
|
|
|
|
*
|
2009-01-26 10:21:10 +00:00
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2018-11-16 12:27:33 +00:00
|
|
|
|
* License along with this program; if not, see <https://gnu.org/licenses/>.
|
|
|
|
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
2009-01-26 10:21:10 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#if HAVE_CONFIG_H
|
|
|
|
|
#include <config.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
|
|
#include "gpgme.h"
|
|
|
|
|
#include "util.h"
|
|
|
|
|
#include "priv-io.h"
|
|
|
|
|
#include "debug.h"
|
|
|
|
|
#include "sema.h"
|
2013-08-02 13:25:23 +00:00
|
|
|
|
#include "sys-util.h"
|
2009-01-26 10:21:10 +00:00
|
|
|
|
|
|
|
|
|
DEFINE_STATIC_LOCK (dirinfo_lock);
|
|
|
|
|
|
|
|
|
|
/* Constants used internally to select the data. */
|
2012-09-25 13:29:49 +00:00
|
|
|
|
enum
|
2009-01-26 10:21:10 +00:00
|
|
|
|
{
|
|
|
|
|
WANT_HOMEDIR,
|
core: Add new items for gpgme_get_dirinfo.
* src/dirinfo.c (WANT_SYSCONFDIR, WANT_LIBEXECDIR, WANT_LIBDIR): New.
(WANT_DATADIR, WANT_LCOALEDIR, WANT_AGENT_SSH_SOCKET): New
(WANT_DIRMNGR_SOCKET): New.
(dirinfo): Add fields 'sysconfdir', 'bindir', 'libexecdir', 'libdir',
'datadir', 'localedir', 'agent_ssh_socket', and 'dirmngr_socket'.
(parse_output): Set these fields.
(get_gpgconf_item): Return them.
(gpgme_get_dirinfo): Likewise.
Signed-off-by: Werner Koch <wk@gnupg.org>
2016-08-22 14:57:51 +00:00
|
|
|
|
WANT_SYSCONFDIR,
|
|
|
|
|
WANT_BINDIR,
|
|
|
|
|
WANT_LIBEXECDIR,
|
|
|
|
|
WANT_LIBDIR,
|
|
|
|
|
WANT_DATADIR,
|
|
|
|
|
WANT_LOCALEDIR,
|
2021-09-22 08:18:30 +00:00
|
|
|
|
WANT_SOCKETDIR,
|
2013-08-02 13:25:23 +00:00
|
|
|
|
WANT_AGENT_SOCKET,
|
core: Add new items for gpgme_get_dirinfo.
* src/dirinfo.c (WANT_SYSCONFDIR, WANT_LIBEXECDIR, WANT_LIBDIR): New.
(WANT_DATADIR, WANT_LCOALEDIR, WANT_AGENT_SSH_SOCKET): New
(WANT_DIRMNGR_SOCKET): New.
(dirinfo): Add fields 'sysconfdir', 'bindir', 'libexecdir', 'libdir',
'datadir', 'localedir', 'agent_ssh_socket', and 'dirmngr_socket'.
(parse_output): Set these fields.
(get_gpgconf_item): Return them.
(gpgme_get_dirinfo): Likewise.
Signed-off-by: Werner Koch <wk@gnupg.org>
2016-08-22 14:57:51 +00:00
|
|
|
|
WANT_AGENT_SSH_SOCKET,
|
|
|
|
|
WANT_DIRMNGR_SOCKET,
|
|
|
|
|
WANT_UISRV_SOCKET,
|
2013-12-27 15:08:20 +00:00
|
|
|
|
WANT_GPGCONF_NAME,
|
2013-08-02 13:25:23 +00:00
|
|
|
|
WANT_GPG_NAME,
|
|
|
|
|
WANT_GPGSM_NAME,
|
|
|
|
|
WANT_G13_NAME,
|
core: Support all components with dirinfo()
* src/dirinfo.c (WANT_KEYBOXD_NAME, WANT_AGENT_NAME, WANT_SCDAEMON_NAME,
WANT_DIRMNGR_NAME, WANT_PINENTRY_NAME): New.
(dirinfo): Add fields keyboxd_name, agent_name, scdaemon_name,
dirmngr_name, pinentry_name.
(parse_output): Support "keyboxd", "gpg-agent", "scdaemon", "dirmngr",
"pinentry".
(get_gpgconf_item): Return new components.
tests/t-engine-info.c (main): Add new components to the output.
--
GnuPG-bug-id: 5727
2021-12-10 11:04:05 +00:00
|
|
|
|
WANT_KEYBOXD_NAME,
|
|
|
|
|
WANT_AGENT_NAME,
|
|
|
|
|
WANT_SCDAEMON_NAME,
|
|
|
|
|
WANT_DIRMNGR_NAME,
|
|
|
|
|
WANT_PINENTRY_NAME,
|
2017-03-21 10:16:16 +00:00
|
|
|
|
WANT_GPG_WKS_CLIENT_NAME,
|
2023-01-18 09:30:17 +00:00
|
|
|
|
WANT_GPGTAR_NAME,
|
2014-02-21 10:22:45 +00:00
|
|
|
|
WANT_GPG_ONE_MODE
|
2009-01-26 10:21:10 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Values retrieved via gpgconf and cached here. */
|
|
|
|
|
static struct {
|
|
|
|
|
int valid; /* Cached information is valid. */
|
2014-01-06 16:16:52 +00:00
|
|
|
|
int disable_gpgconf;
|
2009-01-26 10:21:10 +00:00
|
|
|
|
char *homedir;
|
core: Add new items for gpgme_get_dirinfo.
* src/dirinfo.c (WANT_SYSCONFDIR, WANT_LIBEXECDIR, WANT_LIBDIR): New.
(WANT_DATADIR, WANT_LCOALEDIR, WANT_AGENT_SSH_SOCKET): New
(WANT_DIRMNGR_SOCKET): New.
(dirinfo): Add fields 'sysconfdir', 'bindir', 'libexecdir', 'libdir',
'datadir', 'localedir', 'agent_ssh_socket', and 'dirmngr_socket'.
(parse_output): Set these fields.
(get_gpgconf_item): Return them.
(gpgme_get_dirinfo): Likewise.
Signed-off-by: Werner Koch <wk@gnupg.org>
2016-08-22 14:57:51 +00:00
|
|
|
|
char *sysconfdir;
|
|
|
|
|
char *bindir;
|
|
|
|
|
char *libexecdir;
|
|
|
|
|
char *libdir;
|
|
|
|
|
char *datadir;
|
|
|
|
|
char *localedir;
|
2021-09-22 08:18:30 +00:00
|
|
|
|
char *socketdir;
|
2009-01-26 10:21:10 +00:00
|
|
|
|
char *agent_socket;
|
core: Add new items for gpgme_get_dirinfo.
* src/dirinfo.c (WANT_SYSCONFDIR, WANT_LIBEXECDIR, WANT_LIBDIR): New.
(WANT_DATADIR, WANT_LCOALEDIR, WANT_AGENT_SSH_SOCKET): New
(WANT_DIRMNGR_SOCKET): New.
(dirinfo): Add fields 'sysconfdir', 'bindir', 'libexecdir', 'libdir',
'datadir', 'localedir', 'agent_ssh_socket', and 'dirmngr_socket'.
(parse_output): Set these fields.
(get_gpgconf_item): Return them.
(gpgme_get_dirinfo): Likewise.
Signed-off-by: Werner Koch <wk@gnupg.org>
2016-08-22 14:57:51 +00:00
|
|
|
|
char *agent_ssh_socket;
|
|
|
|
|
char *dirmngr_socket;
|
|
|
|
|
char *uisrv_socket;
|
2013-12-27 15:08:20 +00:00
|
|
|
|
char *gpgconf_name;
|
2013-08-02 13:25:23 +00:00
|
|
|
|
char *gpg_name;
|
|
|
|
|
char *gpgsm_name;
|
|
|
|
|
char *g13_name;
|
core: Support all components with dirinfo()
* src/dirinfo.c (WANT_KEYBOXD_NAME, WANT_AGENT_NAME, WANT_SCDAEMON_NAME,
WANT_DIRMNGR_NAME, WANT_PINENTRY_NAME): New.
(dirinfo): Add fields keyboxd_name, agent_name, scdaemon_name,
dirmngr_name, pinentry_name.
(parse_output): Support "keyboxd", "gpg-agent", "scdaemon", "dirmngr",
"pinentry".
(get_gpgconf_item): Return new components.
tests/t-engine-info.c (main): Add new components to the output.
--
GnuPG-bug-id: 5727
2021-12-10 11:04:05 +00:00
|
|
|
|
char *keyboxd_name;
|
|
|
|
|
char *agent_name;
|
|
|
|
|
char *scdaemon_name;
|
|
|
|
|
char *dirmngr_name;
|
|
|
|
|
char *pinentry_name;
|
2017-03-21 10:16:16 +00:00
|
|
|
|
char *gpg_wks_client_name;
|
2023-01-18 09:30:17 +00:00
|
|
|
|
char *gpgtar_name;
|
2014-02-21 10:22:45 +00:00
|
|
|
|
int gpg_one_mode; /* System is in gpg1 mode. */
|
2009-01-26 10:21:10 +00:00
|
|
|
|
} dirinfo;
|
|
|
|
|
|
|
|
|
|
|
2014-01-06 16:16:52 +00:00
|
|
|
|
|
|
|
|
|
/* Helper function to be used only by gpgme_set_global_flag. */
|
|
|
|
|
void
|
|
|
|
|
_gpgme_dirinfo_disable_gpgconf (void)
|
|
|
|
|
{
|
|
|
|
|
dirinfo.disable_gpgconf = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2016-08-22 14:32:14 +00:00
|
|
|
|
/* Return the length of the directory part including the trailing
|
|
|
|
|
* slash of NAME. */
|
|
|
|
|
static size_t
|
|
|
|
|
dirname_len (const char *name)
|
|
|
|
|
{
|
|
|
|
|
return _gpgme_get_basename (name) - name;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-01-26 10:21:10 +00:00
|
|
|
|
/* Parse the output of "gpgconf --list-dirs". This function expects
|
2013-08-02 13:25:23 +00:00
|
|
|
|
that DIRINFO_LOCK is held by the caller. If COMPONENTS is set, the
|
|
|
|
|
output of --list-components is expected. */
|
2009-01-26 10:21:10 +00:00
|
|
|
|
static void
|
2013-08-02 13:25:23 +00:00
|
|
|
|
parse_output (char *line, int components)
|
2009-01-26 10:21:10 +00:00
|
|
|
|
{
|
|
|
|
|
char *value, *p;
|
2016-08-22 14:32:14 +00:00
|
|
|
|
size_t n;
|
2009-01-26 10:21:10 +00:00
|
|
|
|
|
|
|
|
|
value = strchr (line, ':');
|
|
|
|
|
if (!value)
|
|
|
|
|
return;
|
|
|
|
|
*value++ = 0;
|
2013-08-02 13:25:23 +00:00
|
|
|
|
if (components)
|
|
|
|
|
{
|
|
|
|
|
/* Skip the second field. */
|
|
|
|
|
value = strchr (value, ':');
|
|
|
|
|
if (!value)
|
|
|
|
|
return;
|
|
|
|
|
*value++ = 0;
|
|
|
|
|
}
|
2009-01-26 10:21:10 +00:00
|
|
|
|
p = strchr (value, ':');
|
|
|
|
|
if (p)
|
|
|
|
|
*p = 0;
|
|
|
|
|
if (_gpgme_decode_percent_string (value, &value, strlen (value)+1, 0))
|
|
|
|
|
return;
|
|
|
|
|
if (!*value)
|
|
|
|
|
return;
|
2012-09-25 13:29:49 +00:00
|
|
|
|
|
2013-08-02 13:25:23 +00:00
|
|
|
|
if (components)
|
|
|
|
|
{
|
|
|
|
|
if (!strcmp (line, "gpg") && !dirinfo.gpg_name)
|
|
|
|
|
dirinfo.gpg_name = strdup (value);
|
|
|
|
|
else if (!strcmp (line, "gpgsm") && !dirinfo.gpgsm_name)
|
|
|
|
|
dirinfo.gpgsm_name = strdup (value);
|
|
|
|
|
else if (!strcmp (line, "g13") && !dirinfo.g13_name)
|
|
|
|
|
dirinfo.g13_name = strdup (value);
|
core: Support all components with dirinfo()
* src/dirinfo.c (WANT_KEYBOXD_NAME, WANT_AGENT_NAME, WANT_SCDAEMON_NAME,
WANT_DIRMNGR_NAME, WANT_PINENTRY_NAME): New.
(dirinfo): Add fields keyboxd_name, agent_name, scdaemon_name,
dirmngr_name, pinentry_name.
(parse_output): Support "keyboxd", "gpg-agent", "scdaemon", "dirmngr",
"pinentry".
(get_gpgconf_item): Return new components.
tests/t-engine-info.c (main): Add new components to the output.
--
GnuPG-bug-id: 5727
2021-12-10 11:04:05 +00:00
|
|
|
|
else if (!strcmp (line, "keyboxd") && !dirinfo.keyboxd_name)
|
|
|
|
|
dirinfo.keyboxd_name = strdup (value);
|
|
|
|
|
else if (!strcmp (line, "gpg-agent") && !dirinfo.agent_name)
|
|
|
|
|
dirinfo.agent_name = strdup (value);
|
|
|
|
|
else if (!strcmp (line, "scdaemon") && !dirinfo.scdaemon_name)
|
|
|
|
|
dirinfo.scdaemon_name = strdup (value);
|
|
|
|
|
else if (!strcmp (line, "dirmngr") && !dirinfo.dirmngr_name)
|
|
|
|
|
dirinfo.dirmngr_name = strdup (value);
|
|
|
|
|
else if (!strcmp (line, "pinentry") && !dirinfo.pinentry_name)
|
|
|
|
|
dirinfo.pinentry_name = strdup (value);
|
2013-08-02 13:25:23 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (!strcmp (line, "homedir") && !dirinfo.homedir)
|
2016-08-22 14:32:14 +00:00
|
|
|
|
dirinfo.homedir = strdup (value);
|
core: Add new items for gpgme_get_dirinfo.
* src/dirinfo.c (WANT_SYSCONFDIR, WANT_LIBEXECDIR, WANT_LIBDIR): New.
(WANT_DATADIR, WANT_LCOALEDIR, WANT_AGENT_SSH_SOCKET): New
(WANT_DIRMNGR_SOCKET): New.
(dirinfo): Add fields 'sysconfdir', 'bindir', 'libexecdir', 'libdir',
'datadir', 'localedir', 'agent_ssh_socket', and 'dirmngr_socket'.
(parse_output): Set these fields.
(get_gpgconf_item): Return them.
(gpgme_get_dirinfo): Likewise.
Signed-off-by: Werner Koch <wk@gnupg.org>
2016-08-22 14:57:51 +00:00
|
|
|
|
else if (!strcmp (line, "sysconfdir") && !dirinfo.sysconfdir)
|
|
|
|
|
dirinfo.sysconfdir = strdup (value);
|
|
|
|
|
else if (!strcmp (line, "bindir") && !dirinfo.bindir)
|
|
|
|
|
dirinfo.bindir = strdup (value);
|
|
|
|
|
else if (!strcmp (line, "libexecdir") && !dirinfo.libexecdir)
|
|
|
|
|
dirinfo.libexecdir = strdup (value);
|
|
|
|
|
else if (!strcmp (line, "libdir") && !dirinfo.libdir)
|
|
|
|
|
dirinfo.libdir = strdup (value);
|
|
|
|
|
else if (!strcmp (line, "datadir") && !dirinfo.datadir)
|
|
|
|
|
dirinfo.datadir = strdup (value);
|
|
|
|
|
else if (!strcmp (line, "localedir") && !dirinfo.localedir)
|
|
|
|
|
dirinfo.localedir = strdup (value);
|
2021-09-22 08:18:30 +00:00
|
|
|
|
else if (!strcmp (line, "socketdir") && !dirinfo.socketdir)
|
|
|
|
|
dirinfo.socketdir = strdup (value);
|
2016-08-22 14:32:14 +00:00
|
|
|
|
else if (!strcmp (line, "agent-socket") && !dirinfo.agent_socket)
|
2013-08-02 13:25:23 +00:00
|
|
|
|
{
|
|
|
|
|
const char name[] = "S.uiserver";
|
2016-08-22 14:32:14 +00:00
|
|
|
|
char *buffer;
|
2013-08-02 13:25:23 +00:00
|
|
|
|
|
2016-08-22 14:32:14 +00:00
|
|
|
|
dirinfo.agent_socket = strdup (value);
|
|
|
|
|
if (dirinfo.agent_socket)
|
2013-08-02 13:25:23 +00:00
|
|
|
|
{
|
2016-08-22 14:32:14 +00:00
|
|
|
|
n = dirname_len (dirinfo.agent_socket);
|
|
|
|
|
buffer = malloc (n + strlen (name) + 1);
|
|
|
|
|
if (buffer)
|
|
|
|
|
{
|
|
|
|
|
strncpy (buffer, dirinfo.agent_socket, n);
|
|
|
|
|
strcpy (buffer + n, name);
|
|
|
|
|
dirinfo.uisrv_socket = buffer;
|
|
|
|
|
}
|
2013-08-02 13:25:23 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
core: Add new items for gpgme_get_dirinfo.
* src/dirinfo.c (WANT_SYSCONFDIR, WANT_LIBEXECDIR, WANT_LIBDIR): New.
(WANT_DATADIR, WANT_LCOALEDIR, WANT_AGENT_SSH_SOCKET): New
(WANT_DIRMNGR_SOCKET): New.
(dirinfo): Add fields 'sysconfdir', 'bindir', 'libexecdir', 'libdir',
'datadir', 'localedir', 'agent_ssh_socket', and 'dirmngr_socket'.
(parse_output): Set these fields.
(get_gpgconf_item): Return them.
(gpgme_get_dirinfo): Likewise.
Signed-off-by: Werner Koch <wk@gnupg.org>
2016-08-22 14:57:51 +00:00
|
|
|
|
else if (!strcmp (line, "dirmngr-socket") && !dirinfo.dirmngr_socket)
|
|
|
|
|
dirinfo.dirmngr_socket = strdup (value);
|
|
|
|
|
else if (!strcmp (line, "agent-ssh-socket") && !dirinfo.agent_ssh_socket)
|
|
|
|
|
dirinfo.agent_ssh_socket = strdup (value);
|
2013-08-02 13:25:23 +00:00
|
|
|
|
}
|
2009-01-26 10:21:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Read the directory information from gpgconf. This function expects
|
2013-08-02 13:25:23 +00:00
|
|
|
|
that DIRINFO_LOCK is held by the caller. PGNAME is the name of the
|
|
|
|
|
gpgconf binary. If COMPONENTS is set, not the directories bit the
|
|
|
|
|
name of the componeNts are read. */
|
2009-01-26 10:21:10 +00:00
|
|
|
|
static void
|
2013-08-02 13:25:23 +00:00
|
|
|
|
read_gpgconf_dirs (const char *pgmname, int components)
|
2009-01-26 10:21:10 +00:00
|
|
|
|
{
|
|
|
|
|
char linebuf[1024] = {0};
|
|
|
|
|
int linelen = 0;
|
|
|
|
|
char * argv[3];
|
|
|
|
|
int rp[2];
|
|
|
|
|
struct spawn_fd_item_s cfd[] = { {-1, 1 /* STDOUT_FILENO */, -1, 0},
|
|
|
|
|
{-1, -1} };
|
|
|
|
|
int status;
|
|
|
|
|
int nread;
|
|
|
|
|
char *mark = NULL;
|
|
|
|
|
|
|
|
|
|
argv[0] = (char *)pgmname;
|
2016-09-13 18:57:15 +00:00
|
|
|
|
argv[1] = (char*)(components? "--list-components" : "--list-dirs");
|
2009-01-26 10:21:10 +00:00
|
|
|
|
argv[2] = NULL;
|
|
|
|
|
|
|
|
|
|
if (_gpgme_io_pipe (rp, 1) < 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
cfd[0].fd = rp[1];
|
|
|
|
|
|
2014-04-10 09:39:14 +00:00
|
|
|
|
status = _gpgme_io_spawn (pgmname, argv, IOSPAWN_FLAG_DETACHED,
|
|
|
|
|
cfd, NULL, NULL, NULL);
|
2009-01-26 10:21:10 +00:00
|
|
|
|
if (status < 0)
|
|
|
|
|
{
|
|
|
|
|
_gpgme_io_close (rp[0]);
|
|
|
|
|
_gpgme_io_close (rp[1]);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
do
|
|
|
|
|
{
|
2012-09-25 13:29:49 +00:00
|
|
|
|
nread = _gpgme_io_read (rp[0],
|
|
|
|
|
linebuf + linelen,
|
2009-01-26 10:21:10 +00:00
|
|
|
|
sizeof linebuf - linelen - 1);
|
|
|
|
|
if (nread > 0)
|
|
|
|
|
{
|
|
|
|
|
char *line;
|
|
|
|
|
const char *lastmark = NULL;
|
|
|
|
|
size_t nused;
|
|
|
|
|
|
|
|
|
|
linelen += nread;
|
|
|
|
|
linebuf[linelen] = '\0';
|
|
|
|
|
|
|
|
|
|
for (line=linebuf; (mark = strchr (line, '\n')); line = mark+1 )
|
|
|
|
|
{
|
|
|
|
|
lastmark = mark;
|
|
|
|
|
if (mark > line && mark[-1] == '\r')
|
|
|
|
|
mark[-1] = '\0';
|
|
|
|
|
else
|
|
|
|
|
mark[0] = '\0';
|
|
|
|
|
|
2013-08-02 13:25:23 +00:00
|
|
|
|
parse_output (line, components);
|
2009-01-26 10:21:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nused = lastmark? (lastmark + 1 - linebuf) : 0;
|
|
|
|
|
memmove (linebuf, linebuf + nused, linelen - nused);
|
|
|
|
|
linelen -= nused;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
while (nread > 0 && linelen < sizeof linebuf - 1);
|
2012-09-25 13:29:49 +00:00
|
|
|
|
|
2009-01-26 10:21:10 +00:00
|
|
|
|
_gpgme_io_close (rp[0]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static const char *
|
2013-08-02 13:25:23 +00:00
|
|
|
|
get_gpgconf_item (int what)
|
2009-01-26 10:21:10 +00:00
|
|
|
|
{
|
|
|
|
|
const char *result = NULL;
|
|
|
|
|
|
|
|
|
|
LOCK (dirinfo_lock);
|
|
|
|
|
if (!dirinfo.valid)
|
|
|
|
|
{
|
2013-12-27 15:08:20 +00:00
|
|
|
|
char *pgmname;
|
2013-08-02 13:25:23 +00:00
|
|
|
|
|
2014-01-06 16:16:52 +00:00
|
|
|
|
pgmname = dirinfo.disable_gpgconf? NULL : _gpgme_get_gpgconf_path ();
|
2019-04-09 11:42:58 +00:00
|
|
|
|
if (pgmname && _gpgme_access (pgmname, F_OK))
|
2013-08-02 13:25:23 +00:00
|
|
|
|
{
|
2019-06-05 13:48:33 +00:00
|
|
|
|
_gpgme_debug (NULL, DEBUG_INIT, -1, NULL, NULL, NULL,
|
2014-01-06 16:16:52 +00:00
|
|
|
|
"gpgme-dinfo: gpgconf='%s' [not installed]\n", pgmname);
|
2013-12-27 15:08:20 +00:00
|
|
|
|
free (pgmname);
|
2013-08-02 13:25:23 +00:00
|
|
|
|
pgmname = NULL; /* Not available. */
|
|
|
|
|
}
|
|
|
|
|
else
|
2019-06-05 13:48:33 +00:00
|
|
|
|
_gpgme_debug (NULL, DEBUG_INIT, -1, NULL, NULL, NULL,
|
2018-11-16 15:39:26 +00:00
|
|
|
|
"gpgme-dinfo: gpgconf='%s'\n",
|
2013-08-02 13:25:23 +00:00
|
|
|
|
pgmname? pgmname : "[null]");
|
|
|
|
|
if (!pgmname)
|
|
|
|
|
{
|
|
|
|
|
/* Probably gpgconf is not installed. Assume we are using
|
|
|
|
|
GnuPG-1. */
|
2014-02-21 10:22:45 +00:00
|
|
|
|
dirinfo.gpg_one_mode = 1;
|
2013-08-02 13:25:23 +00:00
|
|
|
|
pgmname = _gpgme_get_gpg_path ();
|
|
|
|
|
if (pgmname)
|
2013-12-27 15:08:20 +00:00
|
|
|
|
dirinfo.gpg_name = pgmname;
|
2013-08-02 13:25:23 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-02-21 10:22:45 +00:00
|
|
|
|
dirinfo.gpg_one_mode = 0;
|
2013-08-02 13:25:23 +00:00
|
|
|
|
read_gpgconf_dirs (pgmname, 0);
|
|
|
|
|
read_gpgconf_dirs (pgmname, 1);
|
2013-12-27 15:08:20 +00:00
|
|
|
|
dirinfo.gpgconf_name = pgmname;
|
2013-08-02 13:25:23 +00:00
|
|
|
|
}
|
2009-01-26 10:21:10 +00:00
|
|
|
|
/* Even if the reading of the directories failed (e.g. due to an
|
|
|
|
|
too old version gpgconf or no gpgconf at all), we need to
|
|
|
|
|
mark the entries as valid so that we won't try over and over
|
|
|
|
|
to read them. Note further that we are not able to change
|
|
|
|
|
the read values later because they are practically statically
|
|
|
|
|
allocated. */
|
|
|
|
|
dirinfo.valid = 1;
|
2013-08-02 13:25:23 +00:00
|
|
|
|
if (dirinfo.gpg_name)
|
2019-06-05 13:48:33 +00:00
|
|
|
|
_gpgme_debug (NULL, DEBUG_INIT, -1, NULL, NULL, NULL,
|
2018-11-16 15:39:26 +00:00
|
|
|
|
"gpgme-dinfo: gpg='%s'\n",
|
2013-08-02 13:25:23 +00:00
|
|
|
|
dirinfo.gpg_name);
|
|
|
|
|
if (dirinfo.g13_name)
|
2019-06-05 13:48:33 +00:00
|
|
|
|
_gpgme_debug (NULL, DEBUG_INIT, -1, NULL, NULL, NULL,
|
2018-11-16 15:39:26 +00:00
|
|
|
|
"gpgme-dinfo: g13='%s'\n",
|
2013-08-02 13:25:23 +00:00
|
|
|
|
dirinfo.g13_name);
|
|
|
|
|
if (dirinfo.gpgsm_name)
|
2019-06-05 13:48:33 +00:00
|
|
|
|
_gpgme_debug (NULL, DEBUG_INIT, -1, NULL, NULL, NULL,
|
2018-11-16 15:39:26 +00:00
|
|
|
|
"gpgme-dinfo: gpgsm='%s'\n",
|
2013-08-02 13:25:23 +00:00
|
|
|
|
dirinfo.gpgsm_name);
|
core: Support all components with dirinfo()
* src/dirinfo.c (WANT_KEYBOXD_NAME, WANT_AGENT_NAME, WANT_SCDAEMON_NAME,
WANT_DIRMNGR_NAME, WANT_PINENTRY_NAME): New.
(dirinfo): Add fields keyboxd_name, agent_name, scdaemon_name,
dirmngr_name, pinentry_name.
(parse_output): Support "keyboxd", "gpg-agent", "scdaemon", "dirmngr",
"pinentry".
(get_gpgconf_item): Return new components.
tests/t-engine-info.c (main): Add new components to the output.
--
GnuPG-bug-id: 5727
2021-12-10 11:04:05 +00:00
|
|
|
|
if (dirinfo.keyboxd_name)
|
|
|
|
|
_gpgme_debug (NULL, DEBUG_INIT, -1, NULL, NULL, NULL,
|
|
|
|
|
"gpgme-dinfo: keyboxd='%s'\n",
|
|
|
|
|
dirinfo.keyboxd_name);
|
|
|
|
|
if (dirinfo.agent_name)
|
|
|
|
|
_gpgme_debug (NULL, DEBUG_INIT, -1, NULL, NULL, NULL,
|
|
|
|
|
"gpgme-dinfo: gpg-agent='%s'\n",
|
|
|
|
|
dirinfo.agent_name);
|
|
|
|
|
if (dirinfo.scdaemon_name)
|
|
|
|
|
_gpgme_debug (NULL, DEBUG_INIT, -1, NULL, NULL, NULL,
|
|
|
|
|
"gpgme-dinfo: scdaemon='%s'\n",
|
|
|
|
|
dirinfo.scdaemon_name);
|
|
|
|
|
if (dirinfo.dirmngr_name)
|
|
|
|
|
_gpgme_debug (NULL, DEBUG_INIT, -1, NULL, NULL, NULL,
|
|
|
|
|
"gpgme-dinfo: dirmngr='%s'\n",
|
|
|
|
|
dirinfo.dirmngr_name);
|
|
|
|
|
if (dirinfo.pinentry_name)
|
|
|
|
|
_gpgme_debug (NULL, DEBUG_INIT, -1, NULL, NULL, NULL,
|
|
|
|
|
"gpgme-dinfo: pinentry='%s'\n",
|
|
|
|
|
dirinfo.pinentry_name);
|
2013-08-02 13:25:23 +00:00
|
|
|
|
if (dirinfo.homedir)
|
2019-06-05 13:48:33 +00:00
|
|
|
|
_gpgme_debug (NULL, DEBUG_INIT, -1, NULL, NULL, NULL,
|
2018-11-16 15:39:26 +00:00
|
|
|
|
"gpgme-dinfo: homedir='%s'\n",
|
2013-08-02 13:25:23 +00:00
|
|
|
|
dirinfo.homedir);
|
2021-09-22 08:18:30 +00:00
|
|
|
|
if (dirinfo.socketdir)
|
|
|
|
|
_gpgme_debug (NULL, DEBUG_INIT, -1, NULL, NULL, NULL,
|
|
|
|
|
"gpgme-dinfo: sockdir='%s'\n",
|
|
|
|
|
dirinfo.socketdir);
|
2013-08-02 13:25:23 +00:00
|
|
|
|
if (dirinfo.agent_socket)
|
2019-06-05 13:48:33 +00:00
|
|
|
|
_gpgme_debug (NULL,DEBUG_INIT, -1, NULL, NULL, NULL,
|
2018-11-16 15:39:26 +00:00
|
|
|
|
"gpgme-dinfo: agent='%s'\n",
|
2013-08-02 13:25:23 +00:00
|
|
|
|
dirinfo.agent_socket);
|
core: Add new items for gpgme_get_dirinfo.
* src/dirinfo.c (WANT_SYSCONFDIR, WANT_LIBEXECDIR, WANT_LIBDIR): New.
(WANT_DATADIR, WANT_LCOALEDIR, WANT_AGENT_SSH_SOCKET): New
(WANT_DIRMNGR_SOCKET): New.
(dirinfo): Add fields 'sysconfdir', 'bindir', 'libexecdir', 'libdir',
'datadir', 'localedir', 'agent_ssh_socket', and 'dirmngr_socket'.
(parse_output): Set these fields.
(get_gpgconf_item): Return them.
(gpgme_get_dirinfo): Likewise.
Signed-off-by: Werner Koch <wk@gnupg.org>
2016-08-22 14:57:51 +00:00
|
|
|
|
if (dirinfo.agent_ssh_socket)
|
2019-06-05 13:48:33 +00:00
|
|
|
|
_gpgme_debug (NULL, DEBUG_INIT, -1, NULL, NULL, NULL,
|
2018-11-16 15:39:26 +00:00
|
|
|
|
"gpgme-dinfo: ssh='%s'\n",
|
core: Add new items for gpgme_get_dirinfo.
* src/dirinfo.c (WANT_SYSCONFDIR, WANT_LIBEXECDIR, WANT_LIBDIR): New.
(WANT_DATADIR, WANT_LCOALEDIR, WANT_AGENT_SSH_SOCKET): New
(WANT_DIRMNGR_SOCKET): New.
(dirinfo): Add fields 'sysconfdir', 'bindir', 'libexecdir', 'libdir',
'datadir', 'localedir', 'agent_ssh_socket', and 'dirmngr_socket'.
(parse_output): Set these fields.
(get_gpgconf_item): Return them.
(gpgme_get_dirinfo): Likewise.
Signed-off-by: Werner Koch <wk@gnupg.org>
2016-08-22 14:57:51 +00:00
|
|
|
|
dirinfo.agent_ssh_socket);
|
|
|
|
|
if (dirinfo.dirmngr_socket)
|
2019-06-05 13:48:33 +00:00
|
|
|
|
_gpgme_debug (NULL, DEBUG_INIT, -1, NULL, NULL, NULL,
|
2018-11-16 15:39:26 +00:00
|
|
|
|
"gpgme-dinfo: dirmngr='%s'\n",
|
core: Add new items for gpgme_get_dirinfo.
* src/dirinfo.c (WANT_SYSCONFDIR, WANT_LIBEXECDIR, WANT_LIBDIR): New.
(WANT_DATADIR, WANT_LCOALEDIR, WANT_AGENT_SSH_SOCKET): New
(WANT_DIRMNGR_SOCKET): New.
(dirinfo): Add fields 'sysconfdir', 'bindir', 'libexecdir', 'libdir',
'datadir', 'localedir', 'agent_ssh_socket', and 'dirmngr_socket'.
(parse_output): Set these fields.
(get_gpgconf_item): Return them.
(gpgme_get_dirinfo): Likewise.
Signed-off-by: Werner Koch <wk@gnupg.org>
2016-08-22 14:57:51 +00:00
|
|
|
|
dirinfo.dirmngr_socket);
|
2013-08-02 13:25:23 +00:00
|
|
|
|
if (dirinfo.uisrv_socket)
|
2019-06-05 13:48:33 +00:00
|
|
|
|
_gpgme_debug (NULL, DEBUG_INIT, -1, NULL, NULL, NULL,
|
2018-11-16 15:39:26 +00:00
|
|
|
|
"gpgme-dinfo: uisrv='%s'\n",
|
2013-08-02 13:25:23 +00:00
|
|
|
|
dirinfo.uisrv_socket);
|
2009-01-26 10:21:10 +00:00
|
|
|
|
}
|
|
|
|
|
switch (what)
|
|
|
|
|
{
|
core: Add new items for gpgme_get_dirinfo.
* src/dirinfo.c (WANT_SYSCONFDIR, WANT_LIBEXECDIR, WANT_LIBDIR): New.
(WANT_DATADIR, WANT_LCOALEDIR, WANT_AGENT_SSH_SOCKET): New
(WANT_DIRMNGR_SOCKET): New.
(dirinfo): Add fields 'sysconfdir', 'bindir', 'libexecdir', 'libdir',
'datadir', 'localedir', 'agent_ssh_socket', and 'dirmngr_socket'.
(parse_output): Set these fields.
(get_gpgconf_item): Return them.
(gpgme_get_dirinfo): Likewise.
Signed-off-by: Werner Koch <wk@gnupg.org>
2016-08-22 14:57:51 +00:00
|
|
|
|
case WANT_HOMEDIR: result = dirinfo.homedir; break;
|
|
|
|
|
case WANT_SYSCONFDIR: result = dirinfo.sysconfdir; break;
|
|
|
|
|
case WANT_BINDIR: result = dirinfo.bindir; break;
|
|
|
|
|
case WANT_LIBEXECDIR: result = dirinfo.libexecdir; break;
|
|
|
|
|
case WANT_LIBDIR: result = dirinfo.libdir; break;
|
|
|
|
|
case WANT_DATADIR: result = dirinfo.datadir; break;
|
|
|
|
|
case WANT_LOCALEDIR: result = dirinfo.localedir; break;
|
2021-09-22 08:18:30 +00:00
|
|
|
|
case WANT_SOCKETDIR: result = dirinfo.socketdir; break;
|
2009-01-26 10:21:10 +00:00
|
|
|
|
case WANT_AGENT_SOCKET: result = dirinfo.agent_socket; break;
|
core: Add new items for gpgme_get_dirinfo.
* src/dirinfo.c (WANT_SYSCONFDIR, WANT_LIBEXECDIR, WANT_LIBDIR): New.
(WANT_DATADIR, WANT_LCOALEDIR, WANT_AGENT_SSH_SOCKET): New
(WANT_DIRMNGR_SOCKET): New.
(dirinfo): Add fields 'sysconfdir', 'bindir', 'libexecdir', 'libdir',
'datadir', 'localedir', 'agent_ssh_socket', and 'dirmngr_socket'.
(parse_output): Set these fields.
(get_gpgconf_item): Return them.
(gpgme_get_dirinfo): Likewise.
Signed-off-by: Werner Koch <wk@gnupg.org>
2016-08-22 14:57:51 +00:00
|
|
|
|
case WANT_AGENT_SSH_SOCKET: result = dirinfo.agent_ssh_socket; break;
|
|
|
|
|
case WANT_DIRMNGR_SOCKET: result = dirinfo.dirmngr_socket; break;
|
2013-12-27 15:08:20 +00:00
|
|
|
|
case WANT_GPGCONF_NAME: result = dirinfo.gpgconf_name; break;
|
2013-08-02 13:25:23 +00:00
|
|
|
|
case WANT_GPG_NAME: result = dirinfo.gpg_name; break;
|
|
|
|
|
case WANT_GPGSM_NAME: result = dirinfo.gpgsm_name; break;
|
|
|
|
|
case WANT_G13_NAME: result = dirinfo.g13_name; break;
|
core: Support all components with dirinfo()
* src/dirinfo.c (WANT_KEYBOXD_NAME, WANT_AGENT_NAME, WANT_SCDAEMON_NAME,
WANT_DIRMNGR_NAME, WANT_PINENTRY_NAME): New.
(dirinfo): Add fields keyboxd_name, agent_name, scdaemon_name,
dirmngr_name, pinentry_name.
(parse_output): Support "keyboxd", "gpg-agent", "scdaemon", "dirmngr",
"pinentry".
(get_gpgconf_item): Return new components.
tests/t-engine-info.c (main): Add new components to the output.
--
GnuPG-bug-id: 5727
2021-12-10 11:04:05 +00:00
|
|
|
|
case WANT_KEYBOXD_NAME: result = dirinfo.keyboxd_name; break;
|
|
|
|
|
case WANT_AGENT_NAME: result = dirinfo.agent_name; break;
|
|
|
|
|
case WANT_SCDAEMON_NAME: result = dirinfo.scdaemon_name; break;
|
|
|
|
|
case WANT_DIRMNGR_NAME: result = dirinfo.dirmngr_name; break;
|
|
|
|
|
case WANT_PINENTRY_NAME: result = dirinfo.pinentry_name; break;
|
2013-08-02 13:25:23 +00:00
|
|
|
|
case WANT_UISRV_SOCKET: result = dirinfo.uisrv_socket; break;
|
2014-02-21 10:22:45 +00:00
|
|
|
|
case WANT_GPG_ONE_MODE: result = dirinfo.gpg_one_mode? "1":NULL; break;
|
2017-03-21 10:16:16 +00:00
|
|
|
|
case WANT_GPG_WKS_CLIENT_NAME:
|
|
|
|
|
if (!dirinfo.gpg_wks_client_name && dirinfo.libexecdir)
|
|
|
|
|
dirinfo.gpg_wks_client_name = _gpgme_strconcat (dirinfo.libexecdir,
|
|
|
|
|
"/",
|
|
|
|
|
"gpg-wks-client",
|
|
|
|
|
NULL);
|
|
|
|
|
result = dirinfo.gpg_wks_client_name;
|
|
|
|
|
break;
|
2023-01-18 09:30:17 +00:00
|
|
|
|
case WANT_GPGTAR_NAME:
|
|
|
|
|
if (!dirinfo.gpgtar_name && dirinfo.bindir)
|
|
|
|
|
dirinfo.gpgtar_name = _gpgme_strconcat (dirinfo.bindir,
|
|
|
|
|
"/",
|
|
|
|
|
"gpgtar",
|
|
|
|
|
NULL);
|
|
|
|
|
result = dirinfo.gpgtar_name;
|
|
|
|
|
break;
|
2009-01-26 10:21:10 +00:00
|
|
|
|
}
|
|
|
|
|
UNLOCK (dirinfo_lock);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Return the default home directory. Returns NULL if not known. */
|
|
|
|
|
const char *
|
|
|
|
|
_gpgme_get_default_homedir (void)
|
|
|
|
|
{
|
2013-08-02 13:25:23 +00:00
|
|
|
|
return get_gpgconf_item (WANT_HOMEDIR);
|
2009-01-26 10:21:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return the default gpg-agent socket name. Returns NULL if not known. */
|
|
|
|
|
const char *
|
|
|
|
|
_gpgme_get_default_agent_socket (void)
|
|
|
|
|
{
|
2013-08-02 13:25:23 +00:00
|
|
|
|
return get_gpgconf_item (WANT_AGENT_SOCKET);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return the default gpg file name. Returns NULL if not known. */
|
|
|
|
|
const char *
|
|
|
|
|
_gpgme_get_default_gpg_name (void)
|
|
|
|
|
{
|
|
|
|
|
return get_gpgconf_item (WANT_GPG_NAME);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return the default gpgsm file name. Returns NULL if not known. */
|
|
|
|
|
const char *
|
|
|
|
|
_gpgme_get_default_gpgsm_name (void)
|
|
|
|
|
{
|
|
|
|
|
return get_gpgconf_item (WANT_GPGSM_NAME);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return the default g13 file name. Returns NULL if not known. */
|
|
|
|
|
const char *
|
|
|
|
|
_gpgme_get_default_g13_name (void)
|
|
|
|
|
{
|
|
|
|
|
return get_gpgconf_item (WANT_G13_NAME);
|
2009-01-26 10:21:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-12-27 15:08:20 +00:00
|
|
|
|
/* Return the default gpgconf file name. Returns NULL if not known. */
|
2013-08-02 13:25:23 +00:00
|
|
|
|
const char *
|
|
|
|
|
_gpgme_get_default_gpgconf_name (void)
|
|
|
|
|
{
|
2013-12-27 15:08:20 +00:00
|
|
|
|
return get_gpgconf_item (WANT_GPGCONF_NAME);
|
2013-08-02 13:25:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-01-18 09:30:17 +00:00
|
|
|
|
/* Return the default gpgtar file name. Returns NULL if not known. */
|
|
|
|
|
const char *
|
|
|
|
|
_gpgme_get_default_gpgtar_name (void)
|
|
|
|
|
{
|
|
|
|
|
return get_gpgconf_item (WANT_GPGTAR_NAME);
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-02 13:25:23 +00:00
|
|
|
|
/* Return the default UI-server socket name. Returns NULL if not
|
|
|
|
|
known. */
|
|
|
|
|
const char *
|
|
|
|
|
_gpgme_get_default_uisrv_socket (void)
|
|
|
|
|
{
|
|
|
|
|
return get_gpgconf_item (WANT_UISRV_SOCKET);
|
|
|
|
|
}
|
2014-02-21 10:22:45 +00:00
|
|
|
|
|
|
|
|
|
/* Return true if we are in GnuPG-1 mode - ie. no gpgconf and agent
|
|
|
|
|
being optional. */
|
|
|
|
|
int
|
|
|
|
|
_gpgme_in_gpg_one_mode (void)
|
|
|
|
|
{
|
|
|
|
|
return !!get_gpgconf_item (WANT_GPG_ONE_MODE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Helper function to return the basename of the passed filename. */
|
|
|
|
|
const char *
|
|
|
|
|
_gpgme_get_basename (const char *name)
|
|
|
|
|
{
|
|
|
|
|
const char *s;
|
|
|
|
|
|
|
|
|
|
if (!name || !*name)
|
|
|
|
|
return name;
|
|
|
|
|
for (s = name + strlen (name) -1; s >= name; s--)
|
|
|
|
|
if (*s == '/'
|
|
|
|
|
#ifdef HAVE_W32_SYSTEM
|
|
|
|
|
|| *s == '\\' || *s == ':'
|
|
|
|
|
#endif
|
|
|
|
|
)
|
|
|
|
|
return s+1;
|
|
|
|
|
return name;
|
|
|
|
|
}
|
2014-04-10 09:47:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Return default values for various directories and file names. */
|
|
|
|
|
const char *
|
|
|
|
|
gpgme_get_dirinfo (const char *what)
|
|
|
|
|
{
|
|
|
|
|
if (!what)
|
|
|
|
|
return NULL;
|
|
|
|
|
else if (!strcmp (what, "homedir"))
|
|
|
|
|
return get_gpgconf_item (WANT_HOMEDIR);
|
|
|
|
|
else if (!strcmp (what, "agent-socket"))
|
|
|
|
|
return get_gpgconf_item (WANT_AGENT_SOCKET);
|
|
|
|
|
else if (!strcmp (what, "uiserver-socket"))
|
|
|
|
|
return get_gpgconf_item (WANT_UISRV_SOCKET);
|
|
|
|
|
else if (!strcmp (what, "gpgconf-name"))
|
|
|
|
|
return get_gpgconf_item (WANT_GPGCONF_NAME);
|
|
|
|
|
else if (!strcmp (what, "gpg-name"))
|
|
|
|
|
return get_gpgconf_item (WANT_GPG_NAME);
|
|
|
|
|
else if (!strcmp (what, "gpgsm-name"))
|
|
|
|
|
return get_gpgconf_item (WANT_GPGSM_NAME);
|
|
|
|
|
else if (!strcmp (what, "g13-name"))
|
|
|
|
|
return get_gpgconf_item (WANT_G13_NAME);
|
core: Support all components with dirinfo()
* src/dirinfo.c (WANT_KEYBOXD_NAME, WANT_AGENT_NAME, WANT_SCDAEMON_NAME,
WANT_DIRMNGR_NAME, WANT_PINENTRY_NAME): New.
(dirinfo): Add fields keyboxd_name, agent_name, scdaemon_name,
dirmngr_name, pinentry_name.
(parse_output): Support "keyboxd", "gpg-agent", "scdaemon", "dirmngr",
"pinentry".
(get_gpgconf_item): Return new components.
tests/t-engine-info.c (main): Add new components to the output.
--
GnuPG-bug-id: 5727
2021-12-10 11:04:05 +00:00
|
|
|
|
else if (!strcmp (what, "keyboxd-name"))
|
|
|
|
|
return get_gpgconf_item (WANT_KEYBOXD_NAME);
|
|
|
|
|
else if (!strcmp (what, "agent-name"))
|
|
|
|
|
return get_gpgconf_item (WANT_AGENT_NAME);
|
|
|
|
|
else if (!strcmp (what, "scdaemon-name"))
|
|
|
|
|
return get_gpgconf_item (WANT_SCDAEMON_NAME);
|
|
|
|
|
else if (!strcmp (what, "dirmngr-name"))
|
|
|
|
|
return get_gpgconf_item (WANT_DIRMNGR_NAME);
|
|
|
|
|
else if (!strcmp (what, "pinentry-name"))
|
|
|
|
|
return get_gpgconf_item (WANT_PINENTRY_NAME);
|
2017-03-21 10:16:16 +00:00
|
|
|
|
else if (!strcmp (what, "gpg-wks-client-name"))
|
|
|
|
|
return get_gpgconf_item (WANT_GPG_WKS_CLIENT_NAME);
|
2023-01-18 09:30:17 +00:00
|
|
|
|
else if (!strcmp (what, "gpgtar-name"))
|
|
|
|
|
return get_gpgconf_item (WANT_GPGTAR_NAME);
|
core: Add new items for gpgme_get_dirinfo.
* src/dirinfo.c (WANT_SYSCONFDIR, WANT_LIBEXECDIR, WANT_LIBDIR): New.
(WANT_DATADIR, WANT_LCOALEDIR, WANT_AGENT_SSH_SOCKET): New
(WANT_DIRMNGR_SOCKET): New.
(dirinfo): Add fields 'sysconfdir', 'bindir', 'libexecdir', 'libdir',
'datadir', 'localedir', 'agent_ssh_socket', and 'dirmngr_socket'.
(parse_output): Set these fields.
(get_gpgconf_item): Return them.
(gpgme_get_dirinfo): Likewise.
Signed-off-by: Werner Koch <wk@gnupg.org>
2016-08-22 14:57:51 +00:00
|
|
|
|
else if (!strcmp (what, "agent-ssh-socket"))
|
|
|
|
|
return get_gpgconf_item (WANT_AGENT_SSH_SOCKET);
|
|
|
|
|
else if (!strcmp (what, "dirmngr-socket"))
|
|
|
|
|
return get_gpgconf_item (WANT_DIRMNGR_SOCKET);
|
|
|
|
|
else if (!strcmp (what, "sysconfdir"))
|
|
|
|
|
return get_gpgconf_item (WANT_SYSCONFDIR);
|
|
|
|
|
else if (!strcmp (what, "bindir"))
|
|
|
|
|
return get_gpgconf_item (WANT_BINDIR);
|
|
|
|
|
else if (!strcmp (what, "libexecdir"))
|
|
|
|
|
return get_gpgconf_item (WANT_LIBEXECDIR);
|
|
|
|
|
else if (!strcmp (what, "libdir"))
|
|
|
|
|
return get_gpgconf_item (WANT_LIBDIR);
|
|
|
|
|
else if (!strcmp (what, "datadir"))
|
|
|
|
|
return get_gpgconf_item (WANT_DATADIR);
|
|
|
|
|
else if (!strcmp (what, "localedir"))
|
|
|
|
|
return get_gpgconf_item (WANT_LOCALEDIR);
|
2021-09-22 08:18:30 +00:00
|
|
|
|
else if (!strcmp (what, "socketdir"))
|
|
|
|
|
return get_gpgconf_item (WANT_SOCKETDIR);
|
2014-04-10 09:47:19 +00:00
|
|
|
|
else
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|