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 <wk@gnupg.org>
This commit is contained in:
Werner Koch 2013-12-27 16:08:20 +01:00
parent b0aaa3f9ae
commit 02ba35c1b6
18 changed files with 137 additions and 705 deletions

13
NEWS
View File

@ -1,3 +1,16 @@
Noteworthy changes in version 1.5.0 (unreleased)
------------------------------------------------
* On Unices the engine file names are not not anymore hardwired but
located via the envvar PATH. All configuration options to set the
name of the engines for configure run are removed.
* If GPGME find the gpgconf binary it defaults to using gpg2 or
whatever gpgconf tells as name for the OpenPGP engine. If gpgconf
is not found, GPGME looks for an engine named "gpg".
Noteworthy changes in version 1.4.3 (2013-08-12) Noteworthy changes in version 1.4.3 (2013-08-12)
------------------------------------------------ ------------------------------------------------

9
README
View File

@ -41,7 +41,7 @@ See the file INSTALL for generic installation instructions.
Check that you have unmodified sources. See below on how to do this. Check that you have unmodified sources. See below on how to do this.
Don't skip it - this is an important step! Don't skip it - this is an important step!
To build GPGME, you need to install libgpg-error (>= 1.8) and To build GPGME, you need to install libgpg-error (>= 1.11) and
Libassuan (>= 2.0.2). Libassuan (>= 2.0.2).
For support of the OpenPGP protocol (default), you should use the For support of the OpenPGP protocol (default), you should use the
@ -50,13 +50,6 @@ ftp://ftp.gnupg.org/gcrypt/gnupg/
For support of the CMS (Cryptographic Message Syntax) protocol, you For support of the CMS (Cryptographic Message Syntax) protocol, you
need a GnuPG version >= 2.0. need a GnuPG version >= 2.0.
If configure can't find the `gpg' binary in your path, you can specify
the location with the --with-gpg=/path/to/gpg argument to configure.
If configure can't find the `gpgsm' binary in your path, you can
specify the location with the --with-gpgsm=/path/to/gpgsm argument to
configure.
On some platforms GPGME based applications might hang at certain On some platforms GPGME based applications might hang at certain
operations when using GPGME_PROTOCOL_CMS. A workaround for this operations when using GPGME_PROTOCOL_CMS. A workaround for this
problem is to build with the configure option --disable-fd-passing. problem is to build with the configure option --disable-fd-passing.

View File

@ -65,7 +65,7 @@ LIBGPGME_LT_REVISION=0
GPGME_CONFIG_API_VERSION=1 GPGME_CONFIG_API_VERSION=1
############################################## ##############################################
NEED_GPG_ERROR_VERSION=1.8 NEED_GPG_ERROR_VERSION=1.11
NEED_LIBASSUAN_API=2 NEED_LIBASSUAN_API=2
NEED_LIBASSUAN_VERSION=2.0.2 NEED_LIBASSUAN_VERSION=2.0.2
@ -254,7 +254,32 @@ AC_SUBST(BUILD_TIMESTAMP)
AC_DEFINE_UNQUOTED(BUILD_TIMESTAMP, "$BUILD_TIMESTAMP", AC_DEFINE_UNQUOTED(BUILD_TIMESTAMP, "$BUILD_TIMESTAMP",
[The time this package was configured for a build]) [The time this package was configured for a build])
#
# Options to disable some regression tests
#
run_gpgconf_test="yes"
AC_ARG_ENABLE(gpgconf-test,
AC_HELP_STRING([--disable-gpgconf-test], [disable GPGCONF regression test]),
run_gpgconf_test=$enableval)
AM_CONDITIONAL(RUN_GPGCONF_TESTS, test "$run_gpgconf_test" = "yes")
run_gpg_test="yes"
AC_ARG_ENABLE(gpg-test,
AC_HELP_STRING([--disable-gpg-test], [disable GPG regression test]),
run_gpg_test=$enableval)
AM_CONDITIONAL(RUN_GPG_TESTS, test "$run_gpg_test" = "yes")
run_gpgsm_test="yes"
AC_ARG_ENABLE(gpgsm-test,
AC_HELP_STRING([--disable-gpgsm-test], [disable GPGSM regression test]),
run_gpgsm_test=$enableval)
AM_CONDITIONAL(RUN_GPGSM_TESTS, test "$run_gpgsm_test" = "yes")
run_g13_test="yes"
AC_ARG_ENABLE(g13-test,
AC_HELP_STRING([--disable-g13-test], [disable G13 regression test]),
run_g13_test=$enableval)
AM_CONDITIONAL(RUN_G13_TESTS, test "$run_g13_test" = "yes")
# Checks for header files. # Checks for header files.
@ -394,478 +419,6 @@ if test "$have_libassuan" = "yes"; then
AC_DEFINE_UNQUOTED(GPGME_LIBASSUAN_VERSION, "$libassuan_version", AC_DEFINE_UNQUOTED(GPGME_LIBASSUAN_VERSION, "$libassuan_version",
[version of the libassuan library]) [version of the libassuan library])
fi fi
AM_CONDITIONAL(HAVE_ASSUAN, test "$have_libassuan" = "yes")
if test "$have_libassuan" = "yes"; then
AC_DEFINE(ENABLE_ASSUAN,1,[Whether Assuan support is enabled])
fi
# Checks for system services
NEED_GPG_VERSION_DEFAULT=1.4.0
NEED_GPGSM_VERSION_DEFAULT=1.9.6
NEED_GPGCONF_VERSION_DEFAULT=2.0.4
NEED_G13_VERSION_DEFAULT=2.1.0
NEED_GPG_VERSION="$NEED_GPG_VERSION_DEFAULT"
NEED_GPGSM_VERSION="$NEED_GPGSM_VERSION_DEFAULT"
NEED_GPGCONF_VERSION="$NEED_GPGCONF_VERSION_DEFAULT"
NEED_G13_VERSION="$NEED_G13_VERSION_DEFAULT"
AC_ARG_WITH(gpg-version,
AC_HELP_STRING([--with-gpg-version=VER], [require GnuPG version VER]),
NEED_GPG_VERSION=$withval)
if test "$NEED_GPG_VERSION" = "yes"; then
NEED_GPG_VERSION="$NEED_GPG_VERSION_DEFAULT"
fi
if test "$NEED_GPG_VERSION" = "no"; then
NEED_GPG_VERSION=0.0.0
fi
AC_ARG_WITH(gpgsm-version,
AC_HELP_STRING([--with-gpgsm-version=VER], [require GPGSM version VER]),
NEED_GPGSM_VERSION=$withval)
if test "$NEED_GPGSM_VERSION" = "yes"; then
NEED_GPGSM_VERSION="$NEED_GPGSM_VERSION_DEFAULT"
fi
if test "$NEED_GPGSM_VERSION" = "no"; then
NEED_GPGSM_VERSION=0.0.0
fi
AC_ARG_WITH(gpgconf-version,
AC_HELP_STRING([--with-gpgconf-version=VER], [require GPGCONF version VER]),
NEED_GPGCONF_VERSION=$withval)
if test "$NEED_GPGCONF_VERSION" = "yes"; then
NEED_GPGCONF_VERSION="$NEED_GPGCONF_VERSION_DEFAULT"
fi
if test "$NEED_GPGCONF_VERSION" = "no"; then
NEED_GPGCONF_VERSION=0.0.0
fi
AC_ARG_WITH(g13-version,
AC_HELP_STRING([--with-g13-version=VER], [require G13 version VER]),
NEED_G13_VERSION=$withval)
if test "$NEED_G13_VERSION" = "yes"; then
NEED_G13_VERSION="$NEED_G13_VERSION_DEFAULT"
fi
if test "$NEED_G13_VERSION" = "no"; then
NEED_G13_VERSION=0.0.0
fi
AC_DEFINE_UNQUOTED(NEED_GPGCONF_VERSION, "$NEED_GPGCONF_VERSION",
[Min. needed GPGCONF version.])
AC_DEFINE_UNQUOTED(NEED_GPG_VERSION, "$NEED_GPG_VERSION",
[Min. needed GnuPG version.])
AC_DEFINE_UNQUOTED(NEED_GPGSM_VERSION, "$NEED_GPGSM_VERSION",
[Min. needed GPGSM version.])
AC_DEFINE_UNQUOTED(NEED_G13_VERSION, "$NEED_G13_VERSION",
[Min. needed G13 version.])
#
# Check for GPGCONF
#
gpgconf_usable_for_test=no
NO_OVERRIDE=no
AC_ARG_WITH(gpgconf,
AC_HELP_STRING([--with-gpgconf=PATH],
[use gpgconf binary at PATH]),
GPGCONF=$withval, NO_OVERRIDE=yes)
if test "$NO_OVERRIDE" = "yes" || test "$GPGCONF" = "yes"; then
GPGCONF=
NO_OVERRIDE=yes
if test "$cross_compiling" != "yes"; then
AC_PATH_PROG(GPGCONF, gpgconf)
fi
if test -z "$GPGCONF"; then
GPGCONF="$GPGCONF_DEFAULT"
fi
fi
if test "$GPGCONF" = no; then
if test "$NO_OVERRIDE" = "yes"; then
if test "$cross_compiling" != "yes"; then
AC_MSG_WARN([
***
*** Could not find gpgconf, install gpgconf or use --with-gpgconf=PATH to enable it
***])
else
AC_MSG_ERROR([
***
*** Can not determine path to gpgconf when cross-compiling, use --with-gpgconf=PATH
***])
fi
fi
else
AC_DEFINE_UNQUOTED(GPGCONF_PATH, "$GPGCONF", [Path to the GPGCONF binary.])
AC_DEFINE(ENABLE_GPGCONF,1,[Whether GPGCONF support is enabled])
fi
AM_CONDITIONAL(HAVE_GPGCONF, test "$GPGCONF" != "no")
dnl Check for GPGCONF version requirement.
GPGCONF_VERSION=unknown
ok=maybe
if test -z "$GPGCONF" -o "x$GPGCONF" = "xno"; then
ok=no
else
if test "$cross_compiling" = "yes"; then
AC_MSG_WARN([GPGCONF version can not be checked when cross compiling])
ok=no
else
if test ! -x "$GPGCONF"; then
AC_MSG_WARN([GPGCONF not executable, version check disabled])
ok=no
fi
fi
fi
if test "$ok" = "maybe"; then
AC_MSG_CHECKING(for GPGCONF >= $NEED_GPGCONF_VERSION)
req_major=`echo $NEED_GPGCONF_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
req_minor=`echo $NEED_GPGCONF_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
req_micro=`echo $NEED_GPGCONF_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
GPGCONF_VERSION=`$GPGCONF --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
major=`echo $GPGCONF_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
minor=`echo $GPGCONF_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
micro=`echo $GPGCONF_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
if test "$major" -gt "$req_major"; then
ok=yes
else
if test "$major" -eq "$req_major"; then
if test "$minor" -gt "$req_minor"; then
ok=yes
else
if test "$minor" -eq "$req_minor"; then
if test "$micro" -ge "$req_micro"; then
ok=yes
fi
fi
fi
fi
fi
if test "$ok" = "yes"; then
AC_MSG_RESULT(yes)
if test "$cross_compiling" != "yes"; then
gpgconf_usable_for_test=yes
fi
else
AC_MSG_RESULT(no)
AC_MSG_WARN([GPGCONF must be at least version $NEED_GPGCONF_VERSION])
fi
fi
run_gpgconf_test="$ok"
AC_ARG_ENABLE(gpgconf-test,
AC_HELP_STRING([--disable-gpgconf-test], [disable GPGCONF run test]),
run_gpgconf_test=$enableval)
AM_CONDITIONAL(RUN_GPGCONF_TESTS, test "$run_gpgconf_test" = "yes")
#
# Check for GPG
#
NO_OVERRIDE=no
AC_ARG_WITH(gpg,
AC_HELP_STRING([--with-gpg=PATH], [use GnuPG binary at PATH]),
GPG=$withval, NO_OVERRIDE=yes)
if test "$NO_OVERRIDE" = "yes" || test "$GPG" = "yes"; then
GPG=
NO_OVERRIDE=yes
if test "$cross_compiling" != "yes"; then
if test "$gpgconf_usable_for_test" = "yes"; then
GPG="`$GPGCONF --list-components | grep ^gpg: | cut -d: -f 3`"
else
AC_PATH_PROG(GPG, gpg)
fi
fi
if test -z "$GPG"; then
GPG="$GPG_DEFAULT"
fi
fi
if test "$GPG" = no; then
if test "$NO_OVERRIDE" = "yes"; then
if test "$cross_compiling" != "yes"; then
AC_MSG_WARN([
***
*** Could not find GnuPG, install GnuPG or use --with-gpg=PATH to enable it
***])
else
AC_MSG_ERROR([
***
*** Can not determine path to GnuPG when cross-compiling, use --with-gpg=PATH
***])
fi
fi
else
AC_DEFINE_UNQUOTED(GPG_PATH, "$GPG", [Path to the GnuPG binary.])
AC_SUBST(GPG)
fi
dnl Check for GnuPG version requirement.
GPG_VERSION=unknown
ok=maybe
if test -z "$GPG" -o "x$GPG" = "xno"; then
ok=no
else
if test "$cross_compiling" = "yes"; then
AC_MSG_WARN([GnuPG version can not be checked when cross compiling])
ok=no
else
if test ! -x "$GPG"; then
AC_MSG_WARN([GnuPG not executable, version check disabled])
ok=no
fi
fi
fi
if test "$ok" = "maybe"; then
AC_MSG_CHECKING(for GPG >= $NEED_GPG_VERSION)
req_major=`echo $NEED_GPG_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
req_minor=`echo $NEED_GPG_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
req_micro=`echo $NEED_GPG_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
GPG_VERSION=`$GPG --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
major=`echo $GPG_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
minor=`echo $GPG_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
micro=`echo $GPG_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
if test "$major" -gt "$req_major"; then
ok=yes
else
if test "$major" -eq "$req_major"; then
if test "$minor" -gt "$req_minor"; then
ok=yes
else
if test "$minor" -eq "$req_minor"; then
if test "$micro" -ge "$req_micro"; then
ok=yes
fi
fi
fi
fi
fi
if test "$ok" = "yes"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_WARN([GPG must be at least version $NEED_GPG_VERSION])
fi
fi
run_gpg_test="$ok"
AC_ARG_ENABLE(gpg-test,
AC_HELP_STRING([--disable-gpg-test], [disable GPG run test]),
run_gpg_test=$enableval)
AM_CONDITIONAL(RUN_GPG_TESTS, test "$run_gpg_test" = "yes")
AC_SUBST(GPG_PATH)
#
# Check for GPGSM
#
NO_OVERRIDE=no
AC_ARG_WITH(gpgsm,
AC_HELP_STRING([--with-gpgsm=PATH], [use GpgSM binary at PATH]),
GPGSM=$withval, NO_OVERRIDE=yes)
if test "$NO_OVERRIDE" = "yes" || test "$GPGSM" = "yes"; then
GPGSM=
NO_OVERRIDE=yes
if test "$cross_compiling" != "yes"; then
if test "$gpgconf_usable_for_test" = "yes"; then
GPGSM="`$GPGCONF --list-components | grep ^gpgsm: | cut -d: -f 3`"
else
AC_PATH_PROG(GPGSM, gpgsm)
fi
fi
if test -z "$GPGSM"; then
GPGSM="$GPGSM_DEFAULT"
fi
fi
if test "$GPGSM" = no; then
if test "$NO_OVERRIDE" = "yes"; then
if test "$cross_compiling" != "yes"; then
AC_MSG_WARN([
***
*** Could not find GpgSM, install GpgSM or use --with-gpgsm=PATH to enable it
***])
else
AC_MSG_ERROR([
***
*** Can not determine path to GpgSM when cross-compiling, use --with-gpgsm=PATH
***])
fi
fi
else
AC_DEFINE_UNQUOTED(GPGSM_PATH, "$GPGSM", [Path to the GPGSM binary.])
AC_DEFINE(ENABLE_GPGSM,1,[Whether GPGSM support is enabled])
fi
AM_CONDITIONAL(HAVE_GPGSM, test "$GPGSM" != "no")
dnl Check for GPGSM version requirement.
GPGSM_VERSION=unknown
ok=maybe
if test -z "$GPGSM" -o "x$GPGSM" = "xno"; then
ok=no
else
if test "$cross_compiling" = "yes"; then
AC_MSG_WARN([GPGSM version can not be checked when cross compiling])
ok=no
else
if test ! -x "$GPGSM"; then
AC_MSG_WARN([GPGSM not executable, version check disabled])
ok=no
fi
fi
fi
if test "$ok" = "maybe"; then
AC_MSG_CHECKING(for GPGSM >= $NEED_GPGSM_VERSION)
req_major=`echo $NEED_GPGSM_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
req_minor=`echo $NEED_GPGSM_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
req_micro=`echo $NEED_GPGSM_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
GPGSM_VERSION=`$GPGSM --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
major=`echo $GPGSM_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
minor=`echo $GPGSM_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
micro=`echo $GPGSM_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
if test "$major" -gt "$req_major"; then
ok=yes
else
if test "$major" -eq "$req_major"; then
if test "$minor" -gt "$req_minor"; then
ok=yes
else
if test "$minor" -eq "$req_minor"; then
if test "$micro" -ge "$req_micro"; then
ok=yes
fi
fi
fi
fi
fi
if test "$ok" = "yes"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_WARN([GPGSM must be at least version $NEED_GPGSM_VERSION])
fi
fi
run_gpgsm_test="$ok"
AC_ARG_ENABLE(gpgsm-test,
AC_HELP_STRING([--disable-gpgsm-test], [disable GPGSM run test]),
run_gpgsm_test=$enableval)
AM_CONDITIONAL(RUN_GPGSM_TESTS, test "$run_gpgsm_test" = "yes")
#
# Check for G13
#
NO_OVERRIDE=no
AC_ARG_WITH(g13,
AC_HELP_STRING([--with-g13=PATH],
[use g13 binary at PATH]),
G13=$withval, NO_OVERRIDE=yes)
if test "$NO_OVERRIDE" = "yes" || test "$G13" = "yes"; then
G13=
NO_OVERRIDE=yes
if test "$cross_compiling" != "yes"; then
if test "$gpgconf_usable_for_test" = "yes"; then
G13="`$GPGCONF --list-components | grep ^g13: | cut -d: -f 3`"
if test -z "$G13"; then
# Use a hack if gpgconf has no support for g13.
G13="`$GPGCONF --list-dirs | grep ^bindir: | cut -d: -f 2`/g13"
fi
else
AC_PATH_PROG(G13, g13)
fi
fi
if test -z "$G13"; then
G13="$G13_DEFAULT"
fi
fi
if test "$G13" = no; then
if test "$NO_OVERRIDE" = "yes"; then
if test "$cross_compiling" != "yes"; then
AC_MSG_WARN([
***
*** Could not find g13, install g13 or use --with-g13=PATH to enable it
***])
else
AC_MSG_ERROR([
***
*** Can not determine path to g13 when cross-compiling, use --with-g13=PATH
***])
fi
fi
else
AC_DEFINE_UNQUOTED(G13_PATH, "$G13", [Path to the G13 binary.])
AC_DEFINE(ENABLE_G13,1,[Whether G13 support is enabled])
fi
AM_CONDITIONAL(HAVE_G13, test "$G13" != "no")
dnl Check for G13 version requirement.
G13_VERSION=unknown
ok=maybe
if test -z "$G13" -o "x$G13" = "xno"; then
ok=no
else
if test "$cross_compiling" = "yes"; then
AC_MSG_WARN([G13 version can not be checked when cross compiling])
ok=no
else
if test ! -x "$G13"; then
AC_MSG_WARN([G13 not executable, version check disabled])
ok=no
fi
fi
fi
if test "$ok" = "maybe"; then
AC_MSG_CHECKING(for G13 >= $NEED_G13_VERSION)
req_major=`echo $NEED_G13_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
req_minor=`echo $NEED_G13_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
req_micro=`echo $NEED_G13_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
G13_VERSION=`$G13 --version | sed -n '1 s/.*\ \([[0-9]].*\)/\1/p'`
major=`echo $G13_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
minor=`echo $G13_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
micro=`echo $G13_VERSION | \
sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
if test "$major" -gt "$req_major"; then
ok=yes
else
if test "$major" -eq "$req_major"; then
if test "$minor" -gt "$req_minor"; then
ok=yes
else
if test "$minor" -eq "$req_minor"; then
if test "$micro" -ge "$req_micro"; then
ok=yes
fi
fi
fi
fi
fi
if test "$ok" = "yes"; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_WARN([G13 must be at least version $NEED_G13_VERSION])
fi
fi
run_g13_test="$ok"
AC_ARG_ENABLE(g13-test,
AC_HELP_STRING([--disable-g13-test], [disable G13 run test]),
run_g13_test=$enableval)
AM_CONDITIONAL(RUN_G13_TESTS, test "$run_g13_test" = "yes")
# #
@ -1030,7 +583,7 @@ if test "$have_libassuan" = "no"; then
die=yes die=yes
AC_MSG_NOTICE([[ AC_MSG_NOTICE([[
*** ***
*** You need libassuan to build this program with GPGSM support. *** You need libassuan to build this program.
*** This library is for example available at *** This library is for example available at
*** ftp://ftp.gnupg.org/gcrypt/libassuan/ *** ftp://ftp.gnupg.org/gcrypt/libassuan/
*** (at least version $NEED_LIBASSUAN_VERSION (API $NEED_LIBASSUAN_API) is required). *** (at least version $NEED_LIBASSUAN_VERSION (API $NEED_LIBASSUAN_API) is required).
@ -1067,17 +620,6 @@ echo "
Revision: mym4_revision (mym4_revision_dec) Revision: mym4_revision (mym4_revision_dec)
Platform: $host Platform: $host
Gpgconf at: $GPGCONF
Gpgconf version: $GPGCONF_VERSION, min. $NEED_GPGCONF_VERSION
GPG at: $GPG
GPG version: $GPG_VERSION, min. $NEED_GPG_VERSION
Gpgsm at: $GPGSM
Gpgsm version: $GPGSM_VERSION, min. $NEED_GPGSM_VERSION
G13 at: $G13
G13 version: $G13_VERSION, min. $NEED_G13_VERSION
Assuan version: $libassuan_config_version, min. $NEED_LIBASSUAN_VERSION
UI Server: $uiserver UI Server: $uiserver
FD Passing: $use_descriptor_passing FD Passing: $use_descriptor_passing
GPGME Pthread: $have_pthread GPGME Pthread: $have_pthread

View File

@ -66,30 +66,6 @@ if HAVE_W32CE_SYSTEM
system_components += w32-ce.h w32-ce.c system_components += w32-ce.h w32-ce.c
endif endif
if HAVE_GPGSM
gpgsm_components = engine-gpgsm.c
else
gpgsm_components =
endif
if HAVE_ASSUAN
assuan_components = assuan-support.c engine-assuan.c
else
assuan_components =
endif
if HAVE_GPGCONF
gpgconf_components = engine-gpgconf.c
else
gpgconf_components =
endif
if HAVE_G13
g13_components = engine-g13.c
else
g13_components =
endif
if HAVE_UISERVER if HAVE_UISERVER
uiserver_components = engine-uiserver.c uiserver_components = engine-uiserver.c
else else
@ -113,11 +89,11 @@ main_sources = \
sign.c passphrase.c progress.c \ sign.c passphrase.c progress.c \
key.c keylist.c trust-item.c trustlist.c \ key.c keylist.c trust-item.c trustlist.c \
import.c export.c genkey.c delete.c edit.c getauditlog.c \ import.c export.c genkey.c delete.c edit.c getauditlog.c \
opassuan.c passwd.c \ opassuan.c passwd.c assuan-support.c \
engine.h engine-backend.h engine.c engine-gpg.c status-table.c \ engine.h engine-backend.h engine.c engine-gpg.c status-table.c \
$(gpgsm_components) $(assuan_components) $(gpgconf_components) \ engine-gpgsm.c engine-assuan.c engine-gpgconf.c \
$(uiserver_components) \ $(uiserver_components) \
$(g13_components) vfs-mount.c vfs-create.c \ engine-g13.c vfs-mount.c vfs-create.c \
gpgconf.c \ gpgconf.c \
sema.h priv-io.h $(system_components) sys-util.h dirinfo.c \ sema.h priv-io.h $(system_components) sys-util.h dirinfo.c \
debug.c debug.h gpgme.c version.c error.c debug.c debug.h gpgme.c version.c error.c

View File

@ -38,6 +38,7 @@ enum
{ {
WANT_HOMEDIR, WANT_HOMEDIR,
WANT_AGENT_SOCKET, WANT_AGENT_SOCKET,
WANT_GPGCONF_NAME,
WANT_GPG_NAME, WANT_GPG_NAME,
WANT_GPGSM_NAME, WANT_GPGSM_NAME,
WANT_G13_NAME, WANT_G13_NAME,
@ -49,6 +50,7 @@ static struct {
int valid; /* Cached information is valid. */ int valid; /* Cached information is valid. */
char *homedir; char *homedir;
char *agent_socket; char *agent_socket;
char *gpgconf_name;
char *gpg_name; char *gpg_name;
char *gpgsm_name; char *gpgsm_name;
char *g13_name; char *g13_name;
@ -194,13 +196,14 @@ get_gpgconf_item (int what)
LOCK (dirinfo_lock); LOCK (dirinfo_lock);
if (!dirinfo.valid) if (!dirinfo.valid)
{ {
const char *pgmname; char *pgmname;
pgmname = _gpgme_get_gpgconf_path (); pgmname = _gpgme_get_gpgconf_path ();
if (pgmname && access (pgmname, F_OK)) if (pgmname && access (pgmname, F_OK))
{ {
_gpgme_debug (DEBUG_INIT, _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. */ pgmname = NULL; /* Not available. */
} }
else else
@ -212,12 +215,13 @@ get_gpgconf_item (int what)
GnuPG-1. */ GnuPG-1. */
pgmname = _gpgme_get_gpg_path (); pgmname = _gpgme_get_gpg_path ();
if (pgmname) if (pgmname)
dirinfo.gpg_name = strdup (pgmname); dirinfo.gpg_name = pgmname;
} }
else else
{ {
read_gpgconf_dirs (pgmname, 0); read_gpgconf_dirs (pgmname, 0);
read_gpgconf_dirs (pgmname, 1); read_gpgconf_dirs (pgmname, 1);
dirinfo.gpgconf_name = pgmname;
} }
/* Even if the reading of the directories failed (e.g. due to an /* 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 too old version gpgconf or no gpgconf at all), we need to
@ -249,6 +253,7 @@ get_gpgconf_item (int what)
{ {
case WANT_HOMEDIR: result = dirinfo.homedir; break; case WANT_HOMEDIR: result = dirinfo.homedir; break;
case WANT_AGENT_SOCKET: result = dirinfo.agent_socket; break; case WANT_AGENT_SOCKET: result = dirinfo.agent_socket; break;
case WANT_GPGCONF_NAME: result = dirinfo.gpgconf_name; break;
case WANT_GPG_NAME: result = dirinfo.gpg_name; break; case WANT_GPG_NAME: result = dirinfo.gpg_name; break;
case WANT_GPGSM_NAME: result = dirinfo.gpgsm_name; break; case WANT_GPGSM_NAME: result = dirinfo.gpgsm_name; break;
case WANT_G13_NAME: result = dirinfo.g13_name; break; case WANT_G13_NAME: result = dirinfo.g13_name; break;
@ -294,14 +299,11 @@ _gpgme_get_default_g13_name (void)
return get_gpgconf_item (WANT_G13_NAME); return get_gpgconf_item (WANT_G13_NAME);
} }
/* Return the default gpgconf file name. Returns NULL if not known. /* Return the default gpgconf file name. Returns NULL if not known. */
Because gpgconf is the binary used to retrieved all these default
names, this function is merely a simple wrapper around the function
used to locate this binary. */
const char * const char *
_gpgme_get_default_gpgconf_name (void) _gpgme_get_default_gpgconf_name (void)
{ {
return _gpgme_get_gpgconf_path (); return get_gpgconf_item (WANT_GPGCONF_NAME);
} }
/* Return the default UI-server socket name. Returns NULL if not /* Return the default UI-server socket name. Returns NULL if not

View File

@ -128,18 +128,10 @@ struct engine_ops
extern struct engine_ops _gpgme_engine_ops_gpg; /* OpenPGP. */ extern struct engine_ops _gpgme_engine_ops_gpg; /* OpenPGP. */
#ifdef ENABLE_GPGSM
extern struct engine_ops _gpgme_engine_ops_gpgsm; /* CMS. */ extern struct engine_ops _gpgme_engine_ops_gpgsm; /* CMS. */
#endif
#ifdef ENABLE_GPGCONF
extern struct engine_ops _gpgme_engine_ops_gpgconf; /* gpg-conf. */ extern struct engine_ops _gpgme_engine_ops_gpgconf; /* gpg-conf. */
#endif
#ifdef ENABLE_ASSUAN
extern struct engine_ops _gpgme_engine_ops_assuan; /* Low-level Assuan. */ extern struct engine_ops _gpgme_engine_ops_assuan; /* Low-level Assuan. */
#endif
#ifdef ENABLE_G13
extern struct engine_ops _gpgme_engine_ops_g13; /* Crypto VFS. */ extern struct engine_ops _gpgme_engine_ops_g13; /* Crypto VFS. */
#endif
#ifdef ENABLE_UISERVER #ifdef ENABLE_UISERVER
extern struct engine_ops _gpgme_engine_ops_uiserver; extern struct engine_ops _gpgme_engine_ops_uiserver;
#endif #endif

View File

@ -107,7 +107,7 @@ g13_get_version (const char *file_name)
static const char * static const char *
g13_get_req_version (void) g13_get_req_version (void)
{ {
return NEED_G13_VERSION; return "2.1.0";
} }

View File

@ -1,7 +1,7 @@
/* engine-gpg.c - Gpg Engine. /* engine-gpg.c - Gpg Engine.
Copyright (C) 2000 Werner Koch (dd9jn) Copyright (C) 2000 Werner Koch (dd9jn)
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007,
2009, 2010, 2012 g10 Code GmbH 2009, 2010, 2012, 2013 g10 Code GmbH
This file is part of GPGME. This file is part of GPGME.
@ -303,7 +303,7 @@ gpg_get_version (const char *file_name)
static const char * static const char *
gpg_get_req_version (void) gpg_get_req_version (void)
{ {
return NEED_GPG_VERSION; return "1.4.0";
} }

View File

@ -68,7 +68,7 @@ gpgconf_get_version (const char *file_name)
static const char * static const char *
gpgconf_get_req_version (void) gpgconf_get_req_version (void)
{ {
return NEED_GPGCONF_VERSION; return "2.0.4";
} }

View File

@ -127,7 +127,7 @@ gpgsm_get_version (const char *file_name)
static const char * static const char *
gpgsm_get_req_version (void) gpgsm_get_req_version (void)
{ {
return NEED_GPGSM_VERSION; return "2.0.4";
} }

View File

@ -46,26 +46,10 @@ struct engine
static struct engine_ops *engine_ops[] = static struct engine_ops *engine_ops[] =
{ {
&_gpgme_engine_ops_gpg, /* OpenPGP. */ &_gpgme_engine_ops_gpg, /* OpenPGP. */
#ifdef ENABLE_GPGSM
&_gpgme_engine_ops_gpgsm, /* CMS. */ &_gpgme_engine_ops_gpgsm, /* CMS. */
#else
NULL,
#endif
#ifdef ENABLE_GPGCONF
&_gpgme_engine_ops_gpgconf, /* gpg-conf. */ &_gpgme_engine_ops_gpgconf, /* gpg-conf. */
#else
NULL,
#endif
#ifdef ENABLE_ASSUAN
&_gpgme_engine_ops_assuan, /* Low-Level Assuan. */ &_gpgme_engine_ops_assuan, /* Low-Level Assuan. */
#else
NULL,
#endif
#ifdef ENABLE_G13
&_gpgme_engine_ops_g13, /* Crypto VFS. */ &_gpgme_engine_ops_g13, /* Crypto VFS. */
#else
NULL,
#endif
#ifdef ENABLE_UISERVER #ifdef ENABLE_UISERVER
&_gpgme_engine_ops_uiserver /* UI-Server. */ &_gpgme_engine_ops_uiserver /* UI-Server. */
#else #else

View File

@ -30,47 +30,60 @@
#include "util.h" #include "util.h"
#include "sys-util.h" #include "sys-util.h"
const char *
/* Find an executable program PGM along the envvar PATH. */
static char *
walk_path (const char *pgm)
{
const char *path, *s;
char *fname, *p;
path = getenv ("PATH");
if (!path)
path = "/bin:/usr/bin:.";
fname = malloc (strlen (path) + 1 + strlen (pgm) + 1);
if (!fname)
return NULL;
for (;;)
{
for (s=path, p=fname; *s && *s != ':'; s++, p++)
*p = *s;
if (*p != '/')
*p++ = '/';
strcpy (p, pgm);
if (!access (fname, X_OK))
return fname;
if (!*s)
break;
path = s + 1;
}
free (fname);
return NULL;
}
/* 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) _gpgme_get_gpg_path (void)
{ {
#ifdef GPG_PATH return walk_path ("gpg");
return GPG_PATH;
#else
return NULL;
#endif
} }
const char *
_gpgme_get_gpgsm_path (void)
{
#ifdef GPGSM_PATH
return GPGSM_PATH;
#else
return NULL;
#endif
}
const char * /* This function is only called by get_gpgconf_item and may not be
called concurrently. */
char *
_gpgme_get_gpgconf_path (void) _gpgme_get_gpgconf_path (void)
{ {
#ifdef GPGCONF_PATH return walk_path ("gpgconf");
return GPGCONF_PATH;
#else
return NULL;
#endif
} }
const char *
_gpgme_get_g13_path (void)
{
#ifdef G13_PATH
return G13_PATH;
#else
return NULL;
#endif
}
/* See w32-util.c */ /* See w32-util.c */
int int
_gpgme_get_conf_int (const char *key, int *value) _gpgme_get_conf_int (const char *key, int *value)

View File

@ -21,9 +21,7 @@
#define SYS_UTIL_H #define SYS_UTIL_H
/*-- {posix,w32}-util.c --*/ /*-- {posix,w32}-util.c --*/
const char *_gpgme_get_gpg_path (void); char *_gpgme_get_gpg_path (void);
const char *_gpgme_get_gpgsm_path (void); char *_gpgme_get_gpgconf_path (void);
const char *_gpgme_get_gpgconf_path (void);
const char *_gpgme_get_g13_path (void);
#endif /* SYS_UTIL_H */ #endif /* SYS_UTIL_H */

View File

@ -151,25 +151,13 @@ const char *_gpgme_get_w32spawn_path (void);
char *_gpgme_w32ce_get_debug_envvar (void); char *_gpgme_w32ce_get_debug_envvar (void);
#endif /*HAVE_W32CE_SYSTEM*/ #endif /*HAVE_W32CE_SYSTEM*/
/*-- Error codes not yet available in current gpg-error.h. --*/
#ifndef GPG_ERR_UNFINISHED
#define GPG_ERR_UNFINISHED 199
#endif
#ifndef GPG_ERR_NOT_OPERATIONAL
#define GPG_ERR_NOT_OPERATIONAL 176
#endif
#ifndef GPG_ERR_MISSING_ISSUER_CERT
#define GPG_ERR_MISSING_ISSUER_CERT 185
#endif
#ifdef ENABLE_ASSUAN
#include <assuan.h> #include <assuan.h>
/* System hooks for assuan integration. */ /* System hooks for assuan integration. */
extern struct assuan_system_hooks _gpgme_assuan_system_hooks; extern struct assuan_system_hooks _gpgme_assuan_system_hooks;
extern struct assuan_malloc_hooks _gpgme_assuan_malloc_hooks; extern struct assuan_malloc_hooks _gpgme_assuan_malloc_hooks;
int _gpgme_assuan_log_cb (assuan_context_t ctx, void *hook, int _gpgme_assuan_log_cb (assuan_context_t ctx, void *hook,
unsigned int cat, const char *msg); unsigned int cat, const char *msg);
#endif
#endif /* UTIL_H */ #endif /* UTIL_H */

View File

@ -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 /* If an installation directory has been passed, this overrides a
location given bu the registry. The idea here is that we prefer 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 registry to override this to have a better isolation of an gpgme
aware applications for other effects. Note that the "Install aware applications for other effects. Note that the "Install
Directory" registry item has been used for ages in Gpg4win and 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) _gpgme_get_gpg_path (void)
{ {
static char *gpg_program; char *gpg;
const char *inst_dir; const char *inst_dir;
inst_dir = _gpgme_get_inst_dir (); inst_dir = _gpgme_get_inst_dir ();
LOCK (get_path_lock); gpg = find_program_in_inst_dir (inst_dir, "gpg.exe");
if (!gpg_program) if (!gpg)
gpg_program = find_program_in_inst_dir (inst_dir, "gpg.exe"); gpg = find_program_at_standard_place ("GNU\\GnuPG\\gpg.exe");
if (!gpg_program) return gpg;
gpg_program = find_program_at_standard_place ("GNU\\GnuPG\\gpg.exe");
UNLOCK (get_path_lock);
return gpg_program;
} }
/* This function is only called by get_gpgconf_item and may not be
const char * called concurrently. */
_gpgme_get_gpgsm_path (void) char *
{
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 *
_gpgme_get_gpgconf_path (void) _gpgme_get_gpgconf_path (void)
{ {
static char *gpgconf_program; char *gpgconf;
const char *inst_dir; const char *inst_dir;
inst_dir = _gpgme_get_inst_dir (); inst_dir = _gpgme_get_inst_dir ();
LOCK (get_path_lock); gpgconf = find_program_in_inst_dir (inst_dir, "gpgconf.exe");
if (!gpgconf_program) if (!gpgconf)
gpgconf_program = find_program_in_inst_dir (inst_dir, "gpgconf.exe"); gpgconf = find_program_at_standard_place ("GNU\\GnuPG\\gpgconf.exe");
if (!gpgconf_program) return gpgconf;
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;
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;
} }

View File

@ -19,8 +19,8 @@
## Process this file with automake to produce Makefile.in ## Process this file with automake to produce Makefile.in
GPG = @GPG@ GPG = gpg
GPG_AGENT = @GPG_AGENT@ GPG_AGENT = gpg-agent
TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) LC_ALL=C GPG_AGENT_INFO= TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) LC_ALL=C GPG_AGENT_INFO=

View File

@ -19,7 +19,7 @@
## Process this file with automake to produce Makefile.in ## Process this file with automake to produce Makefile.in
GPGSM = @GPGSM@ GPGSM = gpgsm
TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) GPG_AGENT_INFO= TESTS_ENVIRONMENT = GNUPGHOME=$(abs_builddir) GPG_AGENT_INFO=

View File

@ -41,30 +41,6 @@
} \ } \
while (0) while (0)
void
check_engine_info (gpgme_engine_info_t info, gpgme_protocol_t protocol,
const char *file_name, const char *req_version)
{
if (info->protocol != protocol)
{
fprintf (stderr, "Unexpected protocol %i (expected %i instead)\n",
info->protocol, protocol);
exit (1);
}
if (strcmp (info->file_name, file_name))
{
fprintf (stderr, "Unexpected file name to executable %s (expected %s instead)\n",
info->file_name, file_name);
exit (1);
}
if (strcmp (info->req_version, req_version))
{
fprintf (stderr, "Unexpected required version %s (expected %s instead)\n",
info->req_version, req_version);
exit (1);
}
}
int int
@ -77,18 +53,9 @@ main (int argc, char **argv )
err = gpgme_get_engine_info (&info); err = gpgme_get_engine_info (&info);
fail_if_err (err); fail_if_err (err);
check_engine_info (info, GPGME_PROTOCOL_OpenPGP, GPG_PATH, NEED_GPG_VERSION); for (; info; info = info->next)
fprintf (stdout, "protocol=%d engine='%s' v='%s' (min='%s')\n",
info = info->next; info->protocol, info->file_name, info->version, info->req_version);
#ifdef GPGSM_PATH
check_engine_info (info, GPGME_PROTOCOL_CMS, GPGSM_PATH, NEED_GPGSM_VERSION);
#else
if (info)
{
fprintf (stderr, "Unexpected engine info.\n");
exit (1);
}
#endif
return 0; return 0;
} }