From 89f8f4e0a5b2aa091a5a63b67a97ef4089ae466c Mon Sep 17 00:00:00 2001 From: JinWang An Date: Wed, 1 Dec 2021 16:54:35 +0900 Subject: [PATCH] Imported Upstream version 1.5.2 --- AUTHORS | 12 ++- ChangeLog | 55 +++++++++++ Makefile.in | 3 + NEWS | 10 ++ VERSION | 2 +- configure | 139 ++++++++++++--------------- configure.ac | 14 ++- doc/Makefile.in | 3 + doc/gpgme.info | 228 ++++++++++++++++++++++----------------------- doc/gpgme.info-1 | 43 ++++++--- doc/gpgme.info-2 | 4 +- doc/gpgme.texi | 22 ++++- doc/stamp-vti | 8 +- doc/uiserver.texi | 13 ++- doc/version.texi | 8 +- gpgme.spec | 2 +- lang/Makefile.in | 3 + lang/cl/Makefile.in | 3 + lang/cl/gpgme.asd | 2 +- m4/gpg-error.m4 | 45 +++++++-- src/Makefile.am | 10 +- src/Makefile.in | 116 ++++++++++++++++------- src/debug.h | 4 +- src/engine-gpg.c | 57 +++++++++--- src/gpgme-tool.c | 21 +++-- src/gpgme.m4 | 59 ++++++++++-- src/sign.c | 104 +++++++++++++++------ tests/Makefile.in | 3 + tests/gpg/Makefile.am | 4 +- tests/gpg/Makefile.in | 13 ++- tests/gpgsm/Makefile.am | 3 +- tests/gpgsm/Makefile.in | 12 ++- tests/opassuan/Makefile.in | 3 + 33 files changed, 680 insertions(+), 348 deletions(-) diff --git a/AUTHORS b/AUTHORS index 65e6368..6197416 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,5 +1,7 @@ Package: gpgme Homepage: http://www.gnupg.org/related_software/gpgme/ +Download: ftp://ftp.gnupg.org/gcrypt/gpgme/ +Repository: git://git.gnupg.org/gpgme.git Maintainer: Werner Koch Bug reports: http://bugs.gnupg.org (use category "gpgme") Security related bug reports: security@gnupg.org @@ -12,7 +14,6 @@ FSF - Other from FSF projects: src/setenv.c, src/vasprintf.c, src/stpcpy.c, src/w32-ce.c. - g10 Code GmbH - All stuff since mid march 2001. @@ -23,6 +24,15 @@ Wojciech Polak - gpgme.spec +Authors with a DCO +================== + +Daniel Kahn Gillmor +2014-09-24:878ul9w4j8.fsf@alice.fifthhorseman.net: + + + + Copyright 2001, 2002, 2012, 2013 g10 Code GmbH This file is free software; as a special exception the author gives diff --git a/ChangeLog b/ChangeLog index 9910120..5e49b46 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,58 @@ +2014-11-21 Werner Koch + + Release 1.5.2. + * configure.ac: Set LT version to C24/A13/R1. + + Update the previous commit. + * src/sign.c (gpgme_op_sign_result): Reformat and take care of failed + malloc. + +2014-11-21 Ben Kibbey + + Fix returning new signatures when there are none. + * src/sign.c (gpgme_op_sign_result): Test that invalid and valid + signatures add up to gpgme_signers_count(). + +2014-11-06 Werner Koch + + Improve the debug output a bit. + * src/debug.h (TRACE_ERR): Include the line number in the output. + +2014-10-02 Werner Koch + + build: Implement SYSROOT feature. + * configure.ac: Document SYSROOT. + * m4/gpg-error.m4: Update from libgpg-error master. + * src/gpgme.m4: Implement SYSROOT stuff. + +2014-09-24 Werner Koch + + tests: Delay some test file extraction until "make check". + * tests/gpg/Makefile.am (all-local): Change to check-local. + * tests/gpgsm/Makefile.am (all-local): Ditto. + +2014-09-24 Daniel Kahn Gillmor + + Clean up gpgme's tests/gpg when gpg2.1 is available. + * tests/gpg/Makefile.am: Clean up .gpg-v21-migrated + +2014-08-12 Werner Koch + + gpgme-tool: Print fingerprint and keyid with keyservers. + * src/gpgme-tool.c (cmd_keylist): Print keyid. Print FPR only if + available. + + Handle modern keyserver output which may emit the fingerprint. + * src/engine-gpg.c (read_colon_line): Split preprocessed lines. + (gpg_keylist_preprocess): Limit keyid field and print fingerprint. + + gpgme-tool: Install gpgme-tool. + * src/Makefile.am (bin_PROGRAMS): New. Add gpgme-tools. + (noinst_PROGRAMS): Remove. + + gpgme-tool: Fix segv for external key listing. + * src/gpgme-tool.c (result_xml_escape): Allow for DATA being NULL. + 2014-07-30 Werner Koch Release 1.5.1. diff --git a/Makefile.in b/Makefile.in index 4d860ca..0681c98 100644 --- a/Makefile.in +++ b/Makefile.in @@ -209,6 +209,8 @@ GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@ GPG_ERROR_CFLAGS = @GPG_ERROR_CFLAGS@ GPG_ERROR_CONFIG = @GPG_ERROR_CONFIG@ GPG_ERROR_LIBS = @GPG_ERROR_LIBS@ +GPG_ERROR_MT_CFLAGS = @GPG_ERROR_MT_CFLAGS@ +GPG_ERROR_MT_LIBS = @GPG_ERROR_MT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -257,6 +259,7 @@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +SYSROOT = @SYSROOT@ VERSION = @VERSION@ VERSION_NUMBER = @VERSION_NUMBER@ abs_builddir = @abs_builddir@ diff --git a/NEWS b/NEWS index cffc209..aed5a29 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,13 @@ +Noteworthy changes in version 1.5.2 (2014-11-21) [C24/A13/R1] +------------------------------------------------------------- + + * gpgme-tool is now installed. + + * Fix external listing for modern keyservers. + + * Minor other fixes. + + Noteworthy changes in version 1.5.1 (2014-07-30) [C24/A13/R0] ------------------------------------------------------------- diff --git a/VERSION b/VERSION index 26ca594..4cda8f1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.5.1 +1.5.2 diff --git a/configure b/configure index 753e65b..ee8fde6 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for gpgme 1.5.1. +# Generated by GNU Autoconf 2.69 for gpgme 1.5.2. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='gpgme' PACKAGE_TARNAME='gpgme' -PACKAGE_VERSION='1.5.1' -PACKAGE_STRING='gpgme 1.5.1' +PACKAGE_VERSION='1.5.2' +PACKAGE_STRING='gpgme 1.5.2' PACKAGE_BUGREPORT='http://bugs.gnupg.org' PACKAGE_URL='' @@ -650,6 +650,8 @@ USE_DESCRIPTOR_PASSING_TRUE LIBASSUAN_LIBS LIBASSUAN_CFLAGS LIBASSUAN_CONFIG +GPG_ERROR_MT_LIBS +GPG_ERROR_MT_CFLAGS GPG_ERROR_LIBS GPG_ERROR_CFLAGS GPG_ERROR_CONFIG @@ -749,6 +751,7 @@ CPPFLAGS LDFLAGS CFLAGS CC +SYSROOT AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V @@ -855,6 +858,7 @@ enable_fd_passing ac_precious_vars='build_alias host_alias target_alias +SYSROOT CC CFLAGS LDFLAGS @@ -1405,7 +1409,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures gpgme 1.5.1 to adapt to many kinds of systems. +\`configure' configures gpgme 1.5.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1475,7 +1479,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of gpgme 1.5.1:";; + short | recursive ) echo "Configuration of gpgme 1.5.2:";; esac cat <<\_ACEOF @@ -1521,6 +1525,7 @@ Optional Packages: prefix where LIBASSUAN is installed (optional) Some influential environment variables: + SYSROOT locate config scripts also below that directory CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a @@ -1599,7 +1604,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -gpgme configure 1.5.1 +gpgme configure 1.5.2 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2429,7 +2434,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by gpgme $as_me 1.5.1, which was +It was created by gpgme $as_me 1.5.2, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2796,7 +2801,7 @@ LIBGPGME_LT_CURRENT=24 # Subtract 2 from this value if you want to make the LFS transition an # ABI break. [Note to self: Remove this comment with the next regular break.] LIBGPGME_LT_AGE=13 -LIBGPGME_LT_REVISION=0 +LIBGPGME_LT_REVISION=1 # If the API is changed in an incompatible way: increment the next counter. GPGME_CONFIG_API_VERSION=1 @@ -3283,7 +3288,7 @@ fi # Define the identity of the package. PACKAGE='gpgme' - VERSION='1.5.1' + VERSION='1.5.2' cat >>confdefs.h <<_ACEOF @@ -3457,6 +3462,7 @@ fi AM_BACKSLASH='\' + # Enable GNU extensions on systems that have them. DEPDIR="${am__leading_dot}deps" @@ -6015,7 +6021,7 @@ cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF -VERSION_NUMBER=0x010501 +VERSION_NUMBER=0x010502 # Don't default to build static libs. @@ -17359,7 +17365,7 @@ fi # # Provide information about the build. # -BUILD_REVISION="16835c3" +BUILD_REVISION="c62ce32" cat >>confdefs.h <<_ACEOF @@ -17368,7 +17374,7 @@ _ACEOF BUILD_FILEVERSION=`echo "$PACKAGE_VERSION"|sed 's/\([0-9.]*\).*/\1./;s/\./,/g'` -BUILD_FILEVERSION="${BUILD_FILEVERSION}5763" +BUILD_FILEVERSION="${BUILD_FILEVERSION}50732" BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date` @@ -18356,15 +18362,28 @@ if test "${with_gpg_error_prefix+set}" = set; then : fi - if test x$gpg_error_config_prefix != x ; then - if test x${GPG_ERROR_CONFIG+set} != xset ; then - GPG_ERROR_CONFIG=$gpg_error_config_prefix/bin/gpg-error-config + if test x"${GPG_ERROR_CONFIG}" = x ; then + if test x"${gpg_error_config_prefix}" != x ; then + GPG_ERROR_CONFIG="${gpg_error_config_prefix}/bin/gpg-error-config" + else + case "${SYSROOT}" in + /*) + if test -x "${SYSROOT}/bin/gpg-error-config" ; then + GPG_ERROR_CONFIG="${SYSROOT}/bin/gpg-error-config" + fi + ;; + '') + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring \$SYSROOT as it is not an absolute path." >&5 +$as_echo "$as_me: WARNING: Ignoring \$SYSROOT as it is not an absolute path." >&2;} + ;; + esac fi fi - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gpg-error-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}gpg-error-config; ac_word=$2 + # Extract the first word of "gpg-error-config", so it can be a program name with args. +set dummy gpg-error-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_GPG_ERROR_CONFIG+:} false; then : @@ -18390,6 +18409,7 @@ done done IFS=$as_save_IFS + test -z "$ac_cv_path_GPG_ERROR_CONFIG" && ac_cv_path_GPG_ERROR_CONFIG="no" ;; esac fi @@ -18403,63 +18423,6 @@ $as_echo "no" >&6; } fi -fi -if test -z "$ac_cv_path_GPG_ERROR_CONFIG"; then - ac_pt_GPG_ERROR_CONFIG=$GPG_ERROR_CONFIG - # Extract the first word of "gpg-error-config", so it can be a program name with args. -set dummy gpg-error-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_GPG_ERROR_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $ac_pt_GPG_ERROR_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_GPG_ERROR_CONFIG="$ac_pt_GPG_ERROR_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_GPG_ERROR_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -ac_pt_GPG_ERROR_CONFIG=$ac_cv_path_ac_pt_GPG_ERROR_CONFIG -if test -n "$ac_pt_GPG_ERROR_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_GPG_ERROR_CONFIG" >&5 -$as_echo "$ac_pt_GPG_ERROR_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_pt_GPG_ERROR_CONFIG" = x; then - GPG_ERROR_CONFIG="no" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - GPG_ERROR_CONFIG=$ac_pt_GPG_ERROR_CONFIG - fi -else - GPG_ERROR_CONFIG="$ac_cv_path_GPG_ERROR_CONFIG" -fi - min_gpg_error_version="$NEED_GPG_ERROR_VERSION" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GPG Error - version >= $min_gpg_error_version" >&5 $as_echo_n "checking for GPG Error - version >= $min_gpg_error_version... " >&6; } @@ -18488,6 +18451,8 @@ $as_echo_n "checking for GPG Error - version >= $min_gpg_error_version... " >&6; if test $ok = yes; then GPG_ERROR_CFLAGS=`$GPG_ERROR_CONFIG $gpg_error_config_args --cflags` GPG_ERROR_LIBS=`$GPG_ERROR_CONFIG $gpg_error_config_args --libs` + GPG_ERROR_MT_CFLAGS=`$GPG_ERROR_CONFIG $gpg_error_config_args --mt --cflags 2>/dev/null` + GPG_ERROR_MT_LIBS=`$GPG_ERROR_CONFIG $gpg_error_config_args --mt --libs 2>/dev/null` { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes ($gpg_error_config_version)" >&5 $as_echo "yes ($gpg_error_config_version)" >&6; } have_gpg_error=yes @@ -18500,7 +18465,7 @@ $as_echo "yes ($gpg_error_config_version)" >&6; } *** built for $gpg_error_config_host and thus may not match the *** used host $host. *** You may want to use the configure option --with-gpg-error-prefix -*** to specify a matching config script. +*** to specify a matching config script or use \$SYSROOT. ***" >&5 $as_echo "$as_me: WARNING: *** @@ -18508,13 +18473,16 @@ $as_echo "$as_me: WARNING: *** built for $gpg_error_config_host and thus may not match the *** used host $host. *** You may want to use the configure option --with-gpg-error-prefix -*** to specify a matching config script. +*** to specify a matching config script or use \$SYSROOT. ***" >&2;} + gpg_config_script_warn="$gpg_config_script_warn libgpg-error" fi fi else GPG_ERROR_CFLAGS="" GPG_ERROR_LIBS="" + GPG_ERROR_MT_CFLAGS="" + GPG_ERROR_MT_LIBS="" { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } have_gpg_error=no @@ -18523,6 +18491,8 @@ $as_echo "no" >&6; } + + $as_echo "#define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_GPGME" >>confdefs.h @@ -19645,7 +19615,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by gpgme $as_me 1.5.1, which was +This file was extended by gpgme $as_me 1.5.2, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -19711,7 +19681,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -gpgme config.status 1.5.1 +gpgme config.status 1.5.2 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -22005,10 +21975,19 @@ fi echo " GPGME v${VERSION} has been configured as follows: - Revision: 16835c3 (5763) + Revision: c62ce32 (50732) Platform: $host UI Server: $uiserver FD Passing: $use_descriptor_passing GPGME Pthread: $have_pthread " +if test "x${gpg_config_script_warn}" != x; then +cat <= $min_gpg_error_version) ok=no @@ -64,6 +88,8 @@ AC_DEFUN([AM_PATH_GPG_ERROR], if test $ok = yes; then GPG_ERROR_CFLAGS=`$GPG_ERROR_CONFIG $gpg_error_config_args --cflags` GPG_ERROR_LIBS=`$GPG_ERROR_CONFIG $gpg_error_config_args --libs` + GPG_ERROR_MT_CFLAGS=`$GPG_ERROR_CONFIG $gpg_error_config_args --mt --cflags 2>/dev/null` + GPG_ERROR_MT_LIBS=`$GPG_ERROR_CONFIG $gpg_error_config_args --mt --libs 2>/dev/null` AC_MSG_RESULT([yes ($gpg_error_config_version)]) ifelse([$2], , :, [$2]) gpg_error_config_host=`$GPG_ERROR_CONFIG $gpg_error_config_args --host 2>/dev/null || echo none` @@ -75,16 +101,21 @@ AC_DEFUN([AM_PATH_GPG_ERROR], *** built for $gpg_error_config_host and thus may not match the *** used host $host. *** You may want to use the configure option --with-gpg-error-prefix -*** to specify a matching config script. +*** to specify a matching config script or use \$SYSROOT. ***]]) + gpg_config_script_warn="$gpg_config_script_warn libgpg-error" fi fi else GPG_ERROR_CFLAGS="" GPG_ERROR_LIBS="" + GPG_ERROR_MT_CFLAGS="" + GPG_ERROR_MT_LIBS="" AC_MSG_RESULT(no) ifelse([$3], , :, [$3]) fi AC_SUBST(GPG_ERROR_CFLAGS) AC_SUBST(GPG_ERROR_LIBS) + AC_SUBST(GPG_ERROR_MT_CFLAGS) + AC_SUBST(GPG_ERROR_MT_LIBS) ]) diff --git a/src/Makefile.am b/src/Makefile.am index 82f5327..b7ddbc1 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -18,7 +18,7 @@ ## Process this file with automake to produce Makefile.in -# Note: moc_kdpipeiodevice should actually be a dependcy below. +# Note: moc_kdpipeiodevice should actually be a dependecy below. EXTRA_DIST = gpgme-config.in gpgme.m4 libgpgme.vers ChangeLog-2011 \ gpgme.h.in versioninfo.rc.in gpgme.def moc_kdpipeiodevice.cpp @@ -27,6 +27,8 @@ m4datadir = $(datadir)/aclocal m4data_DATA = gpgme.m4 nodist_include_HEADERS = gpgme.h +bin_PROGRAMS = gpgme-tool + if HAVE_PTHREAD ltlib_gpgme_pthread = libgpgme-pthread.la else @@ -126,6 +128,9 @@ endif AM_CPPFLAGS = @GPG_ERROR_CFLAGS@ @QT4_CORE_CFLAGS@ AM_CFLAGS = @LIBASSUAN_CFLAGS@ @GLIB_CFLAGS@ @QT4_CORE_CFLAGS@ +gpgme_tool_LDADD = libgpgme.la @LIBASSUAN_LIBS@ + + if HAVE_W32_SYSTEM # Windows provides us with an endless stream of Tough Love. To spawn # processes with a controlled set of inherited handles, we need a @@ -201,9 +206,6 @@ libgpgme_qt_la_LIBADD = $(gpgme_res) @LIBASSUAN_LIBS@ @LTLIBOBJS@ \ @GPG_ERROR_LIBS@ @QT4_CORE_LIBS@ endif -noinst_PROGRAMS = gpgme-tool -gpgme_tool_LDADD = libgpgme.la @LIBASSUAN_LIBS@ - install-data-local: install-def-file uninstall-local: uninstall-def-file diff --git a/src/Makefile.in b/src/Makefile.in index cd55a3f..bd5f999 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -73,9 +73,9 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ +bin_PROGRAMS = gpgme-tool$(EXEEXT) @HAVE_W32CE_SYSTEM_TRUE@am__append_1 = w32-ce.h w32-ce.c @HAVE_W32CE_SYSTEM_FALSE@@HAVE_W32_SYSTEM_TRUE@libexec_PROGRAMS = gpgme-w32spawn$(EXEEXT) -noinst_PROGRAMS = gpgme-tool$(EXEEXT) subdir = src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/gpgme-config.in $(srcdir)/gpgme.h.in \ @@ -122,9 +122,9 @@ am__uninstall_files_from_dir = { \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } -am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libexecdir)" \ - "$(DESTDIR)$(bindir)" "$(DESTDIR)$(m4datadir)" \ - "$(DESTDIR)$(includedir)" +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ + "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(bindir)" \ + "$(DESTDIR)$(m4datadir)" "$(DESTDIR)$(includedir)" LTLIBRARIES = $(lib_LTLIBRARIES) @HAVE_W32_SYSTEM_TRUE@am__DEPENDENCIES_1 = versioninfo.lo am__libgpgme_glib_la_SOURCES_DIST = util.h conversion.c get-env.c \ @@ -244,7 +244,7 @@ libgpgme_la_OBJECTS = $(am_libgpgme_la_OBJECTS) libgpgme_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libgpgme_la_LDFLAGS) $(LDFLAGS) -o $@ -PROGRAMS = $(libexec_PROGRAMS) $(noinst_PROGRAMS) +PROGRAMS = $(bin_PROGRAMS) $(libexec_PROGRAMS) gpgme_tool_SOURCES = gpgme-tool.c gpgme_tool_OBJECTS = gpgme-tool.$(OBJEXT) gpgme_tool_DEPENDENCIES = libgpgme.la @@ -358,6 +358,8 @@ GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@ GPG_ERROR_CFLAGS = @GPG_ERROR_CFLAGS@ GPG_ERROR_CONFIG = @GPG_ERROR_CONFIG@ GPG_ERROR_LIBS = @GPG_ERROR_LIBS@ +GPG_ERROR_MT_CFLAGS = @GPG_ERROR_MT_CFLAGS@ +GPG_ERROR_MT_LIBS = @GPG_ERROR_MT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -406,6 +408,7 @@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +SYSROOT = @SYSROOT@ VERSION = @VERSION@ VERSION_NUMBER = @VERSION_NUMBER@ abs_builddir = @abs_builddir@ @@ -465,7 +468,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -# Note: moc_kdpipeiodevice should actually be a dependcy below. +# Note: moc_kdpipeiodevice should actually be a dependecy below. EXTRA_DIST = gpgme-config.in gpgme.m4 libgpgme.vers ChangeLog-2011 \ gpgme.h.in versioninfo.rc.in gpgme.def moc_kdpipeiodevice.cpp @@ -544,6 +547,7 @@ libgpgme_pthread_la_SOURCES = $(main_sources) \ # versions, because then every object file is only compiled once. AM_CPPFLAGS = @GPG_ERROR_CFLAGS@ @QT4_CORE_CFLAGS@ AM_CFLAGS = @LIBASSUAN_CFLAGS@ @GLIB_CFLAGS@ @QT4_CORE_CFLAGS@ +gpgme_tool_LDADD = libgpgme.la @LIBASSUAN_LIBS@ @HAVE_W32_SYSTEM_TRUE@RCCOMPILE = $(RC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) @HAVE_W32_SYSTEM_TRUE@LTRCCOMPILE = $(LIBTOOL) --mode=compile --tag=RC $(RCCOMPILE) @HAVE_W32_SYSTEM_TRUE@SUFFIXES = .rc .lo @@ -589,7 +593,6 @@ libgpgme_pthread_la_LIBADD = $(gpgme_res) @LIBASSUAN_LIBS@ @LTLIBOBJS@ \ @BUILD_W32_QT_TRUE@libgpgme_qt_la_LIBADD = $(gpgme_res) @LIBASSUAN_LIBS@ @LTLIBOBJS@ \ @BUILD_W32_QT_TRUE@ @GPG_ERROR_LIBS@ @QT4_CORE_LIBS@ -gpgme_tool_LDADD = libgpgme.la @LIBASSUAN_LIBS@ all: all-am .SUFFIXES: @@ -670,6 +673,52 @@ libgpgme-qt.la: $(libgpgme_qt_la_OBJECTS) $(libgpgme_qt_la_DEPENDENCIES) $(EXTRA $(AM_V_CXXLD)$(libgpgme_qt_la_LINK) $(am_libgpgme_qt_la_rpath) $(libgpgme_qt_la_OBJECTS) $(libgpgme_qt_la_LIBADD) $(LIBS) libgpgme.la: $(libgpgme_la_OBJECTS) $(libgpgme_la_DEPENDENCIES) $(EXTRA_libgpgme_la_DEPENDENCIES) $(AM_V_CCLD)$(libgpgme_la_LINK) -rpath $(libdir) $(libgpgme_la_OBJECTS) $(libgpgme_la_LIBADD) $(LIBS) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list install-libexecPROGRAMS: $(libexec_PROGRAMS) @$(NORMAL_INSTALL) @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \ @@ -716,15 +765,6 @@ clean-libexecPROGRAMS: list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list - -clean-noinstPROGRAMS: - @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list gpgme-tool$(EXEEXT): $(gpgme_tool_OBJECTS) $(gpgme_tool_DEPENDENCIES) $(EXTRA_gpgme_tool_DEPENDENCIES) @rm -f gpgme-tool$(EXEEXT) $(AM_V_CCLD)$(LINK) $(gpgme_tool_OBJECTS) $(gpgme_tool_LDADD) $(LIBS) @@ -1025,8 +1065,10 @@ check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(DATA) \ $(HEADERS) +install-binPROGRAMS: install-libLTLIBRARIES + installdirs: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(m4datadir)" "$(DESTDIR)$(includedir)"; do \ + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(m4datadir)" "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -1061,8 +1103,8 @@ maintainer-clean-generic: @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-generic clean-libLTLIBRARIES clean-libexecPROGRAMS \ - clean-libtool clean-noinstPROGRAMS mostlyclean-am +clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ + clean-libexecPROGRAMS clean-libtool mostlyclean-am distclean: distclean-am -rm -rf $(DEPDIR) ./$(DEPDIR) @@ -1089,8 +1131,8 @@ install-dvi: install-dvi-am install-dvi-am: -install-exec-am: install-binSCRIPTS install-libLTLIBRARIES \ - install-libexecPROGRAMS +install-exec-am: install-binPROGRAMS install-binSCRIPTS \ + install-libLTLIBRARIES install-libexecPROGRAMS install-html: install-html-am @@ -1130,27 +1172,29 @@ ps: ps-am ps-am: -uninstall-am: uninstall-binSCRIPTS uninstall-libLTLIBRARIES \ - uninstall-libexecPROGRAMS uninstall-local uninstall-m4dataDATA \ +uninstall-am: uninstall-binPROGRAMS uninstall-binSCRIPTS \ + uninstall-libLTLIBRARIES uninstall-libexecPROGRAMS \ + uninstall-local uninstall-m4dataDATA \ uninstall-nodist_includeHEADERS .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ - clean-libLTLIBRARIES clean-libexecPROGRAMS clean-libtool \ - clean-noinstPROGRAMS ctags distclean distclean-compile \ +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libLTLIBRARIES clean-libexecPROGRAMS \ + clean-libtool ctags distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ - install-binSCRIPTS install-data install-data-am \ - install-data-local install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-libLTLIBRARIES install-libexecPROGRAMS \ - install-m4dataDATA install-man install-nodist_includeHEADERS \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ + install-binPROGRAMS install-binSCRIPTS install-data \ + install-data-am install-data-local install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-libLTLIBRARIES \ + install-libexecPROGRAMS install-m4dataDATA install-man \ + install-nodist_includeHEADERS install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-binPROGRAMS \ uninstall-binSCRIPTS uninstall-libLTLIBRARIES \ uninstall-libexecPROGRAMS uninstall-local uninstall-m4dataDATA \ uninstall-nodist_includeHEADERS diff --git a/src/debug.h b/src/debug.h index c99b700..d0db573 100644 --- a/src/debug.h +++ b/src/debug.h @@ -187,8 +187,8 @@ _gpgme_trace_gpgme_error (gpgme_error_t err, const char *file, int line) #define TRACE_ERR(err) \ err == 0 ? (TRACE_SUC ()) : \ - (_gpgme_debug (_gpgme_trace_level, "%s: error: %s <%s>\n", \ - _gpgme_trace_func, gpgme_strerror (err), \ + (_gpgme_debug (_gpgme_trace_level, "%s:%d: error: %s <%s>\n", \ + _gpgme_trace_func, __LINE__, gpgme_strerror (err), \ gpgme_strsource (err)), _gpgme_debug_frame_end (), (err)) /* The cast to void suppresses GCC warnings. */ #define TRACE_SYSRES(res) \ diff --git a/src/engine-gpg.c b/src/engine-gpg.c index 4df0f3e..30c3bfb 100644 --- a/src/engine-gpg.c +++ b/src/engine-gpg.c @@ -779,7 +779,7 @@ build_argv (engine_gpg_t gpg, const char *pgmname) argc++; if (!gpg->cmd.used) argc++; /* --batch */ - argc += 1; /* --no-sk-comment */ + argc += 1; /* --no-sk-comments */ argv = calloc (argc + 1, sizeof *argv); if (!argv) @@ -864,7 +864,7 @@ build_argv (engine_gpg_t gpg, const char *pgmname) } argc++; } - argv[argc] = strdup ("--no-sk-comment"); + argv[argc] = strdup ("--no-sk-comments"); if (!argv[argc]) { int saved_err = gpg_error_from_syserror (); @@ -1242,10 +1242,26 @@ read_colon_line (engine_gpg_t gpg) } assert (gpg->colon.fnc); - gpg->colon.fnc (gpg->colon.fnc_value, line ? line : buffer); - if (line) - free (line); - } + if (line) + { + char *linep = line; + char *endp; + + do + { + endp = strchr (linep, '\n'); + if (endp) + *endp++ = 0; + gpg->colon.fnc (gpg->colon.fnc_value, linep); + linep = endp; + } + while (linep && *linep); + + free (line); + } + else + gpg->colon.fnc (gpg->colon.fnc_value, buffer); + } /* To reuse the buffer for the next line we have to shift the remaining data to the buffer start and @@ -2071,6 +2087,7 @@ gpg_keylist_preprocess (char *line, char **r_line) #define NR_FIELDS 16 char *field[NR_FIELDS]; int fields = 0; + size_t n; *r_line = NULL; @@ -2106,16 +2123,34 @@ gpg_keylist_preprocess (char *line, char **r_line) pub:::::: as defined in 5.2. Machine Readable Indexes of the OpenPGP - HTTP Keyserver Protocol (draft). + HTTP Keyserver Protocol (draft). Modern versions of the SKS + keyserver return the fingerprint instead of the keyid. We + detect this here and use the v4 fingerprint format to convert + it to a key id. We want: pub:o::::::::::::: */ - if (asprintf (r_line, "pub:o%s:%s:%s:%s:%s:%s::::::::", - field[6], field[3], field[2], field[1], - field[4], field[5]) < 0) - return gpg_error_from_syserror (); + n = strlen (field[1]); + if (n > 16) + { + if (asprintf (r_line, + "pub:o%s:%s:%s:%s:%s:%s::::::::\n" + "fpr:::::::::%s:", + field[6], field[3], field[2], field[1] + n - 16, + field[4], field[5], field[1]) < 0) + return gpg_error_from_syserror (); + } + else + { + if (asprintf (r_line, + "pub:o%s:%s:%s:%s:%s:%s::::::::", + field[6], field[3], field[2], field[1], + field[4], field[5]) < 0) + return gpg_error_from_syserror (); + } + return 0; case RT_UID: diff --git a/src/gpgme-tool.c b/src/gpgme-tool.c index f02fffa..d42179b 100644 --- a/src/gpgme-tool.c +++ b/src/gpgme-tool.c @@ -831,14 +831,17 @@ result_xml_escape (const char *data, char **buf) membuf_t mb; init_membuf (&mb, 128); - data_len = strlen (data); - for (i = 0; i < data_len; i++) + if (data) { - r = result_xml_escape_replacement (data[i]); - if (r) - put_membuf (&mb, r, strlen (r)); - else - put_membuf (&mb, data+i, 1); + data_len = strlen (data); + for (i = 0; i < data_len; i++) + { + r = result_xml_escape_replacement (data[i]); + if (r) + put_membuf (&mb, r, strlen (r)); + else + put_membuf (&mb, data+i, 1); + } } put_membuf (&mb, "", 1); *buf = get_membuf (&mb, NULL); @@ -3302,7 +3305,9 @@ cmd_keylist (assuan_context_t ctx, char *line) while (subkey) { result_xml_tag_start (&state, "subkey", NULL); /* FIXME: more data */ - result_add_fpr (&state, "fpr", subkey->fpr); + result_add_keyid (&state, "keyid", subkey->keyid); + if (subkey->fpr) + result_add_fpr (&state, "fpr", subkey->fpr); result_add_value (&state, "secret", subkey->secret); result_add_value (&state, "is_cardkey", subkey->is_cardkey); if (subkey->card_number) diff --git a/src/gpgme.m4 b/src/gpgme.m4 index fe17f21..6c2be44 100644 --- a/src/gpgme.m4 +++ b/src/gpgme.m4 @@ -1,5 +1,5 @@ # gpgme.m4 - autoconf macro to detect GPGME. -# Copyright (C) 2002, 2003, 2004 g10 Code GmbH +# Copyright (C) 2002, 2003, 2004, 2014 g10 Code GmbH # # This file is free software; as a special exception the author gives # unlimited permission to copy and/or distribute it, with or without @@ -8,6 +8,8 @@ # This file is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# Last-changed: 2014-10-02 AC_DEFUN([_AM_PATH_GPGME_CONFIG], @@ -15,9 +17,25 @@ AC_DEFUN([_AM_PATH_GPGME_CONFIG], AC_HELP_STRING([--with-gpgme-prefix=PFX], [prefix where GPGME is installed (optional)]), gpgme_config_prefix="$withval", gpgme_config_prefix="") - if test "x$gpgme_config_prefix" != x ; then - GPGME_CONFIG="$gpgme_config_prefix/bin/gpgme-config" + if test x"${GPGME_CONFIG}" = x ; then + if test x"${gpgme_config_prefix}" != x ; then + GPGME_CONFIG="${gpgme_config_prefix}/bin/gpgme-config" + else + case "${SYSROOT}" in + /*) + if test -x "${SYSROOT}/bin/gpgme-config" ; then + GPGME_CONFIG="${SYSROOT}/bin/gpgme-config" + fi + ;; + '') + ;; + *) + AC_MSG_WARN([Ignoring \$SYSROOT as it is not an absolute path.]) + ;; + esac + fi fi + AC_PATH_PROG(GPGME_CONFIG, gpgme-config, no) if test "$GPGME_CONFIG" != "no" ; then @@ -31,10 +49,35 @@ AC_DEFUN([_AM_PATH_GPGME_CONFIG], sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'` ]) + +AC_DEFUN([_AM_PATH_GPGME_CONFIG_HOST_CHECK], +[ + gpgme_config_host=`$GPGME_CONFIG --host 2>/dev/null || echo none` + if test x"$gpgme_config_host" != xnone ; then + if test x"$gpgme_config_host" != x"$host" ; then + AC_MSG_WARN([[ +*** +*** The config script $GPGME_CONFIG was +*** built for $gpgme_config_host and thus may not match the +*** used host $host. +*** You may want to use the configure option --with-gpgme-prefix +*** to specify a matching config script or use \$SYSROOT. +***]]) + gpg_config_script_warn="$gpg_config_script_warn gpgme" + fi + fi +]) + + dnl AM_PATH_GPGME([MINIMUM-VERSION, dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]]) dnl Test for libgpgme and define GPGME_CFLAGS and GPGME_LIBS. dnl +dnl If a prefix option is not used, the config script is first +dnl searched in $SYSROOT/bin and then along $PATH. If the used +dnl config script does not match the host specification the script +dnl is added to the gpg_config_script_warn variable. +dnl AC_DEFUN([AM_PATH_GPGME], [ AC_REQUIRE([_AM_PATH_GPGME_CONFIG])dnl tmp=ifelse([$1], ,1:0.4.2,$1) @@ -57,7 +100,7 @@ AC_DEFUN([AM_PATH_GPGME], sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` if test "$gpgme_version_major" -gt "$req_major"; then ok=yes - else + else if test "$gpgme_version_major" -eq "$req_major"; then if test "$gpgme_version_minor" -gt "$req_minor"; then ok=yes @@ -88,6 +131,7 @@ AC_DEFUN([AM_PATH_GPGME], GPGME_LIBS=`$GPGME_CONFIG --libs` AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) + _AM_PATH_GPGME_CONFIG_HOST_CHECK else GPGME_CFLAGS="" GPGME_LIBS="" @@ -126,7 +170,7 @@ AC_DEFUN([AM_PATH_GPGME_PTHREAD], sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` if test "$gpgme_version_major" -gt "$req_major"; then ok=yes - else + else if test "$gpgme_version_major" -eq "$req_major"; then if test "$gpgme_version_minor" -gt "$req_minor"; then ok=yes @@ -158,6 +202,7 @@ AC_DEFUN([AM_PATH_GPGME_PTHREAD], GPGME_PTHREAD_LIBS=`$GPGME_CONFIG --thread=pthread --libs` AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) + _AM_PATH_GPGME_CONFIG_HOST_CHECK else GPGME_PTHREAD_CFLAGS="" GPGME_PTHREAD_LIBS="" @@ -195,7 +240,7 @@ AC_DEFUN([AM_PATH_GPGME_GLIB], sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'` if test "$gpgme_version_major" -gt "$req_major"; then ok=yes - else + else if test "$gpgme_version_major" -eq "$req_major"; then if test "$gpgme_version_minor" -gt "$req_minor"; then ok=yes @@ -226,6 +271,7 @@ AC_DEFUN([AM_PATH_GPGME_GLIB], GPGME_GLIB_LIBS=`$GPGME_CONFIG --glib --libs` AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) + _AM_PATH_GPGME_CONFIG_HOST_CHECK else GPGME_GLIB_CFLAGS="" GPGME_GLIB_LIBS="" @@ -235,4 +281,3 @@ AC_DEFUN([AM_PATH_GPGME_GLIB], AC_SUBST(GPGME_GLIB_CFLAGS) AC_SUBST(GPGME_GLIB_LIBS) ]) - diff --git a/src/sign.c b/src/sign.c index c55441d..ffbde56 100644 --- a/src/sign.c +++ b/src/sign.c @@ -55,11 +55,23 @@ typedef struct static void +release_signatures (gpgme_new_signature_t sig) +{ + while (sig) + { + gpgme_new_signature_t next = sig->next; + free (sig->fpr); + free (sig); + sig = next; + } +} + + +static void release_op_data (void *hook) { op_data_t opd = (op_data_t) hook; gpgme_invalid_key_t invalid_signer = opd->result.invalid_signers; - gpgme_new_signature_t sig = opd->result.signatures; while (invalid_signer) { @@ -70,13 +82,7 @@ release_op_data (void *hook) invalid_signer = next; } - while (sig) - { - gpgme_new_signature_t next = sig->next; - free (sig->fpr); - free (sig); - sig = next; - } + release_signatures (opd->result.signatures); } @@ -86,6 +92,10 @@ gpgme_op_sign_result (gpgme_ctx_t ctx) void *hook; op_data_t opd; gpgme_error_t err; + gpgme_invalid_key_t inv_key, key; + gpgme_new_signature_t sig; + unsigned int inv_signers = 0; + unsigned int signatures = 0; TRACE_BEG (DEBUG_CTX, "gpgme_op_sign_result", ctx); @@ -97,49 +107,81 @@ gpgme_op_sign_result (gpgme_ctx_t ctx) return NULL; } - if (_gpgme_debug_trace ()) - { - gpgme_invalid_key_t inv_key = opd->result.invalid_signers; - gpgme_new_signature_t sig = opd->result.signatures; - int inv_signers = 0; - int signatures = 0; + for (inv_key = opd->result.invalid_signers; inv_key; inv_key = inv_key->next) + inv_signers++; + for (sig = opd->result.signatures; sig; sig = sig->next) + signatures++; - while (inv_key) - { - inv_signers++; - inv_key = inv_key->next; - } - while (sig) - { - signatures++; - sig = sig->next; - } + if (gpgme_signers_count (ctx) + && signatures + inv_signers != gpgme_signers_count (ctx)) + { + /* In this case at least one signatures was not created perhaps + due to a bad passphrase etc. Thus the entire message is + broken and should not be used. We add the already created + signatures to the invalid signers list and thus this case can + be detected. */ + TRACE_LOG3 ("result: invalid signers: %u, signatures: %u, count: %u", + inv_signers, signatures, gpgme_signers_count (ctx)); + + for (sig = opd->result.signatures; sig; sig = sig->next) + { + key = calloc (1, sizeof *key); + if (!key) + { + TRACE_SUC0 ("out of core; result=(null)"); + return NULL; + } + if (sig->fpr) + { + key->fpr = strdup (sig->fpr); + if (!key->fpr) + { + free (key); + TRACE_SUC0 ("out of core; result=(null)"); + return NULL; + } + } + key->reason = GPG_ERR_GENERAL; + + inv_key = opd->result.invalid_signers; + if (inv_key) + { + for (; inv_key->next; inv_key = inv_key->next) + ; + inv_key->next = key; + } + else + opd->result.invalid_signers = key; + } + + release_signatures (opd->result.signatures); + opd->result.signatures = NULL; + } + if (_gpgme_debug_trace()) + { TRACE_LOG2 ("result: invalid signers: %i, signatures: %i", inv_signers, signatures); - inv_key = opd->result.invalid_signers; - while (inv_key) + for (inv_key=opd->result.invalid_signers; inv_key; inv_key=inv_key->next) { TRACE_LOG3 ("result: invalid signer: fpr=%s, reason=%s <%s>", inv_key->fpr, gpgme_strerror (inv_key->reason), gpgme_strsource (inv_key->reason)); - inv_key = inv_key->next; } - sig = opd->result.signatures; - while (sig) + for (sig = opd->result.signatures; sig; sig = sig->next) { TRACE_LOG6 ("result: signature: type=%i, pubkey_algo=%i, " "hash_algo=%i, timestamp=%li, fpr=%s, sig_class=%i", sig->type, sig->pubkey_algo, sig->hash_algo, sig->timestamp, sig->fpr, sig->sig_class); - sig = sig->next; } - } + } TRACE_SUC1 ("result=%p", &opd->result); return &opd->result; } + static gpgme_error_t parse_sig_created (char *args, gpgme_new_signature_t *sigp, diff --git a/tests/Makefile.in b/tests/Makefile.in index 90fcb02..e849c26 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -256,6 +256,8 @@ GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@ GPG_ERROR_CFLAGS = @GPG_ERROR_CFLAGS@ GPG_ERROR_CONFIG = @GPG_ERROR_CONFIG@ GPG_ERROR_LIBS = @GPG_ERROR_LIBS@ +GPG_ERROR_MT_CFLAGS = @GPG_ERROR_MT_CFLAGS@ +GPG_ERROR_MT_LIBS = @GPG_ERROR_MT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -304,6 +306,7 @@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +SYSROOT = @SYSROOT@ VERSION = @VERSION@ VERSION_NUMBER = @VERSION_NUMBER@ abs_builddir = @abs_builddir@ diff --git a/tests/gpg/Makefile.am b/tests/gpg/Makefile.am index e72bd49..5c1266e 100644 --- a/tests/gpg/Makefile.am +++ b/tests/gpg/Makefile.am @@ -43,7 +43,7 @@ TESTS = initial.test $(c_tests) final.test CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \ gpg-agent.conf pubring.kbx~ S.gpg-agent gpg.conf pubring.gpg~ \ - random_seed S.gpg-agent + random_seed S.gpg-agent .gpg-v21-migrated private_keys = \ 13CD0F3BDF24BE53FE192D62F18737256FF6E4FD \ @@ -70,7 +70,7 @@ clean-local: -$(srcdir)/start-stop-agent --stop -rm -fR private-keys-v1.d -all-local: ./gpg.conf ./gpg-agent.conf ./pubring.gpg \ +check-local: ./gpg.conf ./gpg-agent.conf ./pubring.gpg \ ./private-keys-v1.d/gpg-sample.stamp export GNUPGHOME := $(abs_builddir) diff --git a/tests/gpg/Makefile.in b/tests/gpg/Makefile.in index 8513d08..4105268 100644 --- a/tests/gpg/Makefile.in +++ b/tests/gpg/Makefile.in @@ -287,6 +287,8 @@ GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@ GPG_ERROR_CFLAGS = @GPG_ERROR_CFLAGS@ GPG_ERROR_CONFIG = @GPG_ERROR_CONFIG@ GPG_ERROR_LIBS = @GPG_ERROR_LIBS@ +GPG_ERROR_MT_CFLAGS = @GPG_ERROR_MT_CFLAGS@ +GPG_ERROR_MT_LIBS = @GPG_ERROR_MT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -335,6 +337,7 @@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +SYSROOT = @SYSROOT@ VERSION = @VERSION@ VERSION_NUMBER = @VERSION_NUMBER@ abs_builddir = @abs_builddir@ @@ -409,7 +412,7 @@ c_tests = \ CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \ gpg-agent.conf pubring.kbx~ S.gpg-agent gpg.conf pubring.gpg~ \ - random_seed S.gpg-agent + random_seed S.gpg-agent .gpg-v21-migrated private_keys = \ 13CD0F3BDF24BE53FE192D62F18737256FF6E4FD \ @@ -768,9 +771,9 @@ distdir: $(DISTFILES) fi; \ done check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-TESTS + $(MAKE) $(AM_MAKEFLAGS) check-TESTS check-local check: check-am -all-am: Makefile $(PROGRAMS) $(HEADERS) all-local +all-am: Makefile $(PROGRAMS) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am @@ -876,7 +879,7 @@ uninstall-am: .MAKE: check-am install-am install-strip -.PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \ +.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am check-local \ clean clean-generic clean-libtool clean-local \ clean-noinstPROGRAMS ctags distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ @@ -895,7 +898,7 @@ clean-local: -$(srcdir)/start-stop-agent --stop -rm -fR private-keys-v1.d -all-local: ./gpg.conf ./gpg-agent.conf ./pubring.gpg \ +check-local: ./gpg.conf ./gpg-agent.conf ./pubring.gpg \ ./private-keys-v1.d/gpg-sample.stamp export GNUPGHOME := $(abs_builddir) diff --git a/tests/gpgsm/Makefile.am b/tests/gpgsm/Makefile.am index 45b3b50..ecc53a6 100644 --- a/tests/gpgsm/Makefile.am +++ b/tests/gpgsm/Makefile.am @@ -47,7 +47,8 @@ clean-local: -gpg-connect-agent KILLAGENT /bye -rm -fR private-keys-v1.d -all-local: ./pubring.kbx ./gpgsm.conf ./private-keys-v1.d/$(key_id).key ./trustlist.txt +check-local: ./pubring.kbx ./gpgsm.conf \ + ./private-keys-v1.d/$(key_id).key ./trustlist.txt export GNUPGHOME := $(abs_builddir) diff --git a/tests/gpgsm/Makefile.in b/tests/gpgsm/Makefile.in index 2aba85f..5626612 100644 --- a/tests/gpgsm/Makefile.in +++ b/tests/gpgsm/Makefile.in @@ -230,6 +230,8 @@ GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@ GPG_ERROR_CFLAGS = @GPG_ERROR_CFLAGS@ GPG_ERROR_CONFIG = @GPG_ERROR_CONFIG@ GPG_ERROR_LIBS = @GPG_ERROR_LIBS@ +GPG_ERROR_MT_CFLAGS = @GPG_ERROR_MT_CFLAGS@ +GPG_ERROR_MT_LIBS = @GPG_ERROR_MT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -278,6 +280,7 @@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +SYSROOT = @SYSROOT@ VERSION = @VERSION@ VERSION_NUMBER = @VERSION_NUMBER@ abs_builddir = @abs_builddir@ @@ -643,9 +646,9 @@ distdir: $(DISTFILES) fi; \ done check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-TESTS + $(MAKE) $(AM_MAKEFLAGS) check-TESTS check-local check: check-am -all-am: Makefile $(PROGRAMS) $(HEADERS) all-local +all-am: Makefile $(PROGRAMS) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am @@ -751,7 +754,7 @@ uninstall-am: .MAKE: check-am install-am install-strip -.PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \ +.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am check-local \ clean clean-generic clean-libtool clean-local \ clean-noinstPROGRAMS ctags distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ @@ -770,7 +773,8 @@ clean-local: -gpg-connect-agent KILLAGENT /bye -rm -fR private-keys-v1.d -all-local: ./pubring.kbx ./gpgsm.conf ./private-keys-v1.d/$(key_id).key ./trustlist.txt +check-local: ./pubring.kbx ./gpgsm.conf \ + ./private-keys-v1.d/$(key_id).key ./trustlist.txt export GNUPGHOME := $(abs_builddir) diff --git a/tests/opassuan/Makefile.in b/tests/opassuan/Makefile.in index bc45cbf..fcb92bc 100644 --- a/tests/opassuan/Makefile.in +++ b/tests/opassuan/Makefile.in @@ -183,6 +183,8 @@ GPGME_CONFIG_LIBS = @GPGME_CONFIG_LIBS@ GPG_ERROR_CFLAGS = @GPG_ERROR_CFLAGS@ GPG_ERROR_CONFIG = @GPG_ERROR_CONFIG@ GPG_ERROR_LIBS = @GPG_ERROR_LIBS@ +GPG_ERROR_MT_CFLAGS = @GPG_ERROR_MT_CFLAGS@ +GPG_ERROR_MT_LIBS = @GPG_ERROR_MT_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -231,6 +233,7 @@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ +SYSROOT = @SYSROOT@ VERSION = @VERSION@ VERSION_NUMBER = @VERSION_NUMBER@ abs_builddir = @abs_builddir@ -- 2.7.4