diff options
author | Werner Koch <[email protected]> | 2014-01-06 16:16:52 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2014-01-06 16:16:52 +0000 |
commit | 6564e5e78e8c6e5a120675a5699b5b75248cfbc7 (patch) | |
tree | f60419297debdcd94c12f9c05dc7918b759c2200 /src/dirinfo.c | |
parent | Locate engine names only at runtime and prefer GnuPG-2. (diff) | |
download | gpgme-6564e5e78e8c6e5a120675a5699b5b75248cfbc7.tar.gz gpgme-6564e5e78e8c6e5a120675a5699b5b75248cfbc7.zip |
Add global flags disable-gpgconf, gpgconf-name, and gpg-name.
* src/gpgme.c (gpgme_set_global_flag): Add names "disable-gpgconf",
"gpgconf-name", and "gpg-name".
* src/dirinfo.c (_gpgme_dirinfo_disable_gpgconf): New.
(get_gpgconf_item): Minor debug info change.
* src/posix-util.c (default_gpg_name, default_gpgconf_name): Add vars.
(_gpgme_set_default_gpg_name): New.
(_gpgme_set_default_gpgconf_name): New.
(_gpgme_get_gpg_path, _gpgme_get_gpgconf_path): Use new vars.
(walk_path): Add debug output on failure.
* src/w32-util.c (default_gpg_name, default_gpgconf_name): Add vars.
(replace_slashes): New.
(get_basename): New.
(_gpgme_set_default_gpg_name): New.
(_gpgme_set_default_gpgconf_name): New.
(_gpgme_get_gpg_path, _gpgme_get_gpgconf_path): Use new vars.
* tests/t-engine-info.c (main): Add --verbose and --set-global-flag
options.
--
Note that the Windows part has not been tested.
Diffstat (limited to '')
-rw-r--r-- | src/dirinfo.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/src/dirinfo.c b/src/dirinfo.c index 2e387fa1..eb29c6bd 100644 --- a/src/dirinfo.c +++ b/src/dirinfo.c @@ -48,6 +48,7 @@ enum /* Values retrieved via gpgconf and cached here. */ static struct { int valid; /* Cached information is valid. */ + int disable_gpgconf; char *homedir; char *agent_socket; char *gpgconf_name; @@ -58,6 +59,15 @@ static struct { } dirinfo; + +/* Helper function to be used only by gpgme_set_global_flag. */ +void +_gpgme_dirinfo_disable_gpgconf (void) +{ + dirinfo.disable_gpgconf = 1; +} + + /* Parse the output of "gpgconf --list-dirs". This function expects that DIRINFO_LOCK is held by the caller. If COMPONENTS is set, the output of --list-components is expected. */ @@ -198,16 +208,16 @@ get_gpgconf_item (int what) { char *pgmname; - pgmname = _gpgme_get_gpgconf_path (); + pgmname = dirinfo.disable_gpgconf? NULL : _gpgme_get_gpgconf_path (); if (pgmname && access (pgmname, F_OK)) { _gpgme_debug (DEBUG_INIT, - "gpgme_dinfo: gpgconf='%s' [not installed]\n", pgmname); + "gpgme-dinfo: gpgconf='%s' [not installed]\n", pgmname); free (pgmname); pgmname = NULL; /* Not available. */ } else - _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: gpgconf='%s'\n", + _gpgme_debug (DEBUG_INIT, "gpgme-dinfo: gpgconf='%s'\n", pgmname? pgmname : "[null]"); if (!pgmname) { @@ -231,22 +241,22 @@ get_gpgconf_item (int what) allocated. */ dirinfo.valid = 1; if (dirinfo.gpg_name) - _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: gpg='%s'\n", + _gpgme_debug (DEBUG_INIT, "gpgme-dinfo: gpg='%s'\n", dirinfo.gpg_name); if (dirinfo.g13_name) - _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: g13='%s'\n", + _gpgme_debug (DEBUG_INIT, "gpgme-dinfo: g13='%s'\n", dirinfo.g13_name); if (dirinfo.gpgsm_name) - _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: gpgsm='%s'\n", + _gpgme_debug (DEBUG_INIT, "gpgme-dinfo: gpgsm='%s'\n", dirinfo.gpgsm_name); if (dirinfo.homedir) - _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: homedir='%s'\n", + _gpgme_debug (DEBUG_INIT, "gpgme-dinfo: homedir='%s'\n", dirinfo.homedir); if (dirinfo.agent_socket) - _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: agent='%s'\n", + _gpgme_debug (DEBUG_INIT, "gpgme-dinfo: agent='%s'\n", dirinfo.agent_socket); if (dirinfo.uisrv_socket) - _gpgme_debug (DEBUG_INIT, "gpgme_dinfo: uisrv='%s'\n", + _gpgme_debug (DEBUG_INIT, "gpgme-dinfo: uisrv='%s'\n", dirinfo.uisrv_socket); } switch (what) |