aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32-util.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2013-12-27 15:08:20 +0000
committerWerner Koch <[email protected]>2013-12-27 15:08:20 +0000
commit02ba35c1b6a2cbb3361b2f2ad507c53564b2be0b (patch)
treec2286910441497fa7af0debbeca2da61f61617d0 /src/w32-util.c
parentDocument API change for GPGME_EVENT_DONE from 2009. (diff)
downloadgpgme-02ba35c1b6a2cbb3361b2f2ad507c53564b2be0b.tar.gz
gpgme-02ba35c1b6a2cbb3361b2f2ad507c53564b2be0b.zip
Locate engine names only at runtime and prefer GnuPG-2.
* configure.ac (NEED_GPG_VERSION, NEED_GPGSM_VERSION) (NEED_G13_VERSION, NEED_GPGCONF_VERSION): Remove vars and all related checks. Do not check for any engine version. (HAVE_ASSUAN): Remove AM conditional. * src/Makefile.am: Remove separate component vars and always build all engines but uiserver. * src/dirinfo.c (WANT_GPGCONF_NAME): New. (struct dirinfo): Add field gpgconf_name. (_gpgme_get_default_gpgconf_name): Use WANT_GPGCONF_NAME. (get_gpgconf_item): Set gpgconf name and adjust for _gpgme_get_*_path now returning a malloced string. * src/engine.c (engine_ops): Always init all engines except for uiserver. * src/posix-util.c (_gpgme_get_gpgsm_path, _gpgme_get_g13_path): Remove unused functions. (walk_path): New. (_gpgme_get_gpg_path, _gpgme_get_gpgconf_path ): Re-implement using walk_path. * src/w32-util.c (_gpgme_get_gpgsm_path, _gpgme_get_g13_path): Remove unused functions. (_gpgme_get_gpg_path, _gpgme_get_gpgconf_path): Return a malloced string. * src/engine-g13.c (g13_get_req_version): Use a hardwired string with the required version. This info belongs into this file. * src/engine-gpg.c (gpg_get_req_version): Ditto. * src/engine-gpgconf.c (gpgconf_get_req_version): Ditto. * src/engine-gpgsm.c (gpgsm_get_req_version): Ditto. * tests/t-engine-info.c: Replace now useless test by an info output. * tests/gpg/Makefile.am (GPG, GPG_AGENT): Hardwire gpg and gpg-agent. * tests/gpgsm/Makefile.am (GPGSM): Hardwire gpgsm. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to '')
-rw-r--r--src/w32-util.c74
1 files changed, 19 insertions, 55 deletions
diff --git a/src/w32-util.c b/src/w32-util.c
index 4cee1cb6..31a58bbd 100644
--- a/src/w32-util.c
+++ b/src/w32-util.c
@@ -374,7 +374,7 @@ find_program_in_inst_dir (const char *inst_dir, const char *name)
/* If an installation directory has been passed, this overrides a
location given bu the registry. The idea here is that we prefer
- a a program installed alongside with gpgme. We don't want the
+ a program installed alongside with gpgme. We don't want the
registry to override this to have a better isolation of an gpgme
aware applications for other effects. Note that the "Install
Directory" registry item has been used for ages in Gpg4win and
@@ -424,72 +424,36 @@ find_program_at_standard_place (const char *name)
}
-const char *
+/* Return the full file name of the GPG binary. This function is used
+ if gpgconf was not found and thus it can be assumed that gpg2 is
+ not installed. This function is only called by get_gpgconf_item
+ and may not be called concurrently. */
+char *
_gpgme_get_gpg_path (void)
{
- static char *gpg_program;
+ char *gpg;
const char *inst_dir;
inst_dir = _gpgme_get_inst_dir ();
- LOCK (get_path_lock);
- if (!gpg_program)
- gpg_program = find_program_in_inst_dir (inst_dir, "gpg.exe");
- if (!gpg_program)
- gpg_program = find_program_at_standard_place ("GNU\\GnuPG\\gpg.exe");
- UNLOCK (get_path_lock);
- return gpg_program;
+ gpg = find_program_in_inst_dir (inst_dir, "gpg.exe");
+ if (!gpg)
+ gpg = find_program_at_standard_place ("GNU\\GnuPG\\gpg.exe");
+ return gpg;
}
-
-const char *
-_gpgme_get_gpgsm_path (void)
-{
- static char *gpgsm_program;
- const char *inst_dir;
-
- inst_dir = _gpgme_get_inst_dir ();
- LOCK (get_path_lock);
- if (!gpgsm_program)
- gpgsm_program = find_program_in_inst_dir (inst_dir, "gpgsm.exe");
- if (!gpgsm_program)
- gpgsm_program = find_program_at_standard_place ("GNU\\GnuPG\\gpgsm.exe");
- UNLOCK (get_path_lock);
- return gpgsm_program;
-}
-
-
-const char *
+/* This function is only called by get_gpgconf_item and may not be
+ called concurrently. */
+char *
_gpgme_get_gpgconf_path (void)
{
- static char *gpgconf_program;
- const char *inst_dir;
-
- inst_dir = _gpgme_get_inst_dir ();
- LOCK (get_path_lock);
- if (!gpgconf_program)
- gpgconf_program = find_program_in_inst_dir (inst_dir, "gpgconf.exe");
- if (!gpgconf_program)
- gpgconf_program
- = find_program_at_standard_place ("GNU\\GnuPG\\gpgconf.exe");
- UNLOCK (get_path_lock);
- return gpgconf_program;
-}
-
-
-const char *
-_gpgme_get_g13_path (void)
-{
- static char *g13_program;
+ char *gpgconf;
const char *inst_dir;
inst_dir = _gpgme_get_inst_dir ();
- LOCK (get_path_lock);
- if (!g13_program)
- g13_program = find_program_in_inst_dir (inst_dir, "g13.exe");
- if (!g13_program)
- g13_program = find_program_at_standard_place ("GNU\\GnuPG\\g13.exe");
- UNLOCK (get_path_lock);
- return g13_program;
+ gpgconf = find_program_in_inst_dir (inst_dir, "gpgconf.exe");
+ if (!gpgconf)
+ gpgconf = find_program_at_standard_place ("GNU\\GnuPG\\gpgconf.exe");
+ return gpgconf;
}