From d6a252124671ea969d85b64567c781a57b322e06 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 26 Jan 2007 12:08:12 +0000 Subject: [PATCH] / * configure.ac: Changed gpg and gpgsm version checks to work with arbitrary names of the gpg binary. New option --disable-gpg-test and --disable-gpgsm-test. gpgme/ * w32-io.c (build_commandline): Fixed stupid quoting bug. * w32-glib-io.c (build_commandline): Ditto. * rungpg.c (gpg_set_locale): Avoid dangling pointer after free. * gpgme-config.in: New options --get-gpg and --get-gpgsm. --- ChangeLog | 11 +++++++--- configure.ac | 47 +++++++++++++++++++++++++------------------ gpgme/ChangeLog | 9 +++++++++ gpgme/gpgme-config.in | 8 ++++++++ gpgme/rungpg.c | 10 +++++++-- gpgme/w32-glib-io.c | 2 +- gpgme/w32-io.c | 2 +- 7 files changed, 62 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8aeb797..52d00d9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,13 @@ +2007-01-26 Werner Koch + + * configure.ac: Changed gpg and gpgsm version checks to work with + arbitrary names of the gpg binary. New option --disable-gpg-test + and --disable-gpgsm-test. + 2007-01-09 Werner Koch - * configure.ac (NEED_GPG_VERSION, - (NEED_GPGSM_VERSION): Must define after it may have been changed - by an option. + * configure.ac (NEED_GPG_VERSION, NEED_GPGSM_VERSION): Must define + after it may have been changed by an option. 2007-01-08 Werner Koch diff --git a/configure.ac b/configure.ac index 09384b8..e3b4e2e 100644 --- a/configure.ac +++ b/configure.ac @@ -324,21 +324,20 @@ else fi fi if test "$ok" = "maybe"; then - AC_MSG_CHECKING(for GnuPG >= $NEED_GPG_VERSION) + 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 | grep ^gpg` - major=`echo $gpg_version | \ - sed 's/^gpg (GnuPG) \([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` - minor=`echo $gpg_version | \ - sed 's/^gpg (GnuPG) \([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` - micro=`echo $gpg_version | \ - sed 's/^gpg (GnuPG) \([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'` - GPG_VERSION=`echo $gpg_version | sed 's/^gpg (GnuPG) //'` + 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 @@ -359,10 +358,14 @@ if test "$ok" = "maybe"; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) - AC_MSG_WARN([GnuPG must be at least version $NEED_GPG_VERSION]) + AC_MSG_WARN([GPG must be at least version $NEED_GPG_VERSION]) fi fi -AM_CONDITIONAL(RUN_GPG_TESTS, test "$ok" = "yes") +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) NO_OVERRIDE=no @@ -424,14 +427,13 @@ if test "$ok" = "maybe"; then 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 | grep ^gpgsm` - major=`echo $gpgsm_version | \ - sed 's/^gpgsm (GnuPG) \([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'` - minor=`echo $gpgsm_version | \ - sed 's/^gpgsm (GnuPG) \([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'` - micro=`echo $gpgsm_version | \ - sed 's/^gpgsm (GnuPG) \([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'` - GPGSM_VERSION=`echo $gpgsm_version | sed 's/^gpgsm (GnuPG) //'` + 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 @@ -455,7 +457,12 @@ if test "$ok" = "maybe"; then AC_MSG_WARN([GPGSM must be at least version $NEED_GPGSM_VERSION]) fi fi -AM_CONDITIONAL(RUN_GPGSM_TESTS, test "$ok" = "yes") +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") + # FIXME: Only build if supported. AM_CONDITIONAL(BUILD_ASSUAN, test "$GPGSM" != "no") diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index 2d04c3c..0d190cd 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,3 +1,12 @@ +2007-01-26 Werner Koch + + * w32-io.c (build_commandline): Fixed stupid quoting bug. + * w32-glib-io.c (build_commandline): Ditto. + + * rungpg.c (gpg_set_locale): Avoid dangling pointer after free. + + * gpgme-config.in: New options --get-gpg and --get-gpgsm. + 2007-01-18 Marcus Brinkmann * data.h (_gpgme_data_get_fd): Add prototype. diff --git a/gpgme/gpgme-config.in b/gpgme/gpgme-config.in index 4b6ddb3..4a67b3f 100644 --- a/gpgme/gpgme-config.in +++ b/gpgme/gpgme-config.in @@ -51,6 +51,8 @@ Options: [--api-version] [--libs] [--cflags] + [--get-gpg] + [--get-gpgsm] EOF exit $1 } @@ -144,6 +146,12 @@ while test $# -gt 0; do usage 1 1>&2 fi ;; + --get-gpg) + output="$output @GPG@" + ;; + --get-gpgsm) + output="$output @GPGSM@" + ;; *) usage 1 1>&2 ;; diff --git a/gpgme/rungpg.c b/gpgme/rungpg.c index 243d0b5..58ab39d 100644 --- a/gpgme/rungpg.c +++ b/gpgme/rungpg.c @@ -517,7 +517,10 @@ gpg_set_locale (void *engine, int category, const char *value) if (category == LC_CTYPE) { if (gpg->lc_ctype) - free (gpg->lc_ctype); + { + free (gpg->lc_ctype); + gpg->lc_ctype = NULL; + } if (value) { gpg->lc_ctype = strdup (value); @@ -529,7 +532,10 @@ gpg_set_locale (void *engine, int category, const char *value) else if (category == LC_MESSAGES) { if (gpg->lc_messages) - free (gpg->lc_messages); + { + free (gpg->lc_messages); + gpg->lc_messages = NULL; + } if (value) { gpg->lc_messages = strdup (value); diff --git a/gpgme/w32-glib-io.c b/gpgme/w32-glib-io.c index 87b65fb..20099ef 100644 --- a/gpgme/w32-glib-io.c +++ b/gpgme/w32-glib-io.c @@ -389,7 +389,7 @@ build_commandline (char **argv) *(p++) = '"'; while (*argvp) { - if (*p == '\\' || *p == '"') + if (*argvp == '\\' || *argvp == '"') *(p++) = '\\'; *(p++) = *(argvp++); } diff --git a/gpgme/w32-io.c b/gpgme/w32-io.c index 6810fd5..fd53a6f 100644 --- a/gpgme/w32-io.c +++ b/gpgme/w32-io.c @@ -841,7 +841,7 @@ build_commandline (char **argv) *(p++) = '"'; while (*argvp) { - if (*p == '\\' || *p == '"') + if (*argvp == '\\' || *argvp == '"') *(p++) = '\\'; *(p++) = *(argvp++); } -- 2.26.2