From 237f9b152529368270db01b545e2ac4a99ac6e2d 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.3 --- ChangeLog | 17 +++++++ NEWS | 7 +++ VERSION | 2 +- configure | 30 ++++++------- configure.ac | 4 +- doc/Makefile.am | 4 +- doc/Makefile.in | 4 +- doc/gpgme.info | 4 +- doc/gpgme.info-1 | 8 ++-- doc/gpgme.info-2 | 4 +- doc/stamp-vti | 4 +- doc/version.texi | 4 +- gpgme.spec | 2 +- lang/cl/gpgme.asd | 2 +- src/context.h | 2 +- src/export.c | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 16 files changed, 187 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5e49b46..5a598e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2014-12-11 Werner Koch + + Release 1.5.3. + * configure.ac: Set LT version to C24/A13/R2. + +2014-12-08 Werner Koch + + Return an error for some export key operations. + * src/context.h (OPDATA_EXPORT): New. + * src/export.c (op_data_t): New. + (release_op_data): New. + (parse_error): New. + (export_status_handler): New. + (export_start, export_ext_start): Prepare op_data. + (gpgme_op_export_ext, gpgme_op_export_keys): Return an error from the + status handler. + 2014-11-21 Werner Koch Release 1.5.2. diff --git a/NEWS b/NEWS index aed5a29..a429101 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,10 @@ +Noteworthy changes in version 1.5.3 (2014-12-11) [C24/A13/R2] +------------------------------------------------------------- + + * The export key functions do now return an error if used with the + latest GnuPG version. + + Noteworthy changes in version 1.5.2 (2014-11-21) [C24/A13/R1] ------------------------------------------------------------- diff --git a/VERSION b/VERSION index 4cda8f1..8af85be 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.5.2 +1.5.3 diff --git a/configure b/configure index ee8fde6..7fae0be 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.2. +# Generated by GNU Autoconf 2.69 for gpgme 1.5.3. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='gpgme' PACKAGE_TARNAME='gpgme' -PACKAGE_VERSION='1.5.2' -PACKAGE_STRING='gpgme 1.5.2' +PACKAGE_VERSION='1.5.3' +PACKAGE_STRING='gpgme 1.5.3' PACKAGE_BUGREPORT='http://bugs.gnupg.org' PACKAGE_URL='' @@ -1409,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.2 to adapt to many kinds of systems. +\`configure' configures gpgme 1.5.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1479,7 +1479,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of gpgme 1.5.2:";; + short | recursive ) echo "Configuration of gpgme 1.5.3:";; esac cat <<\_ACEOF @@ -1604,7 +1604,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -gpgme configure 1.5.2 +gpgme configure 1.5.3 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2434,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.2, which was +It was created by gpgme $as_me 1.5.3, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2801,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=1 +LIBGPGME_LT_REVISION=2 # If the API is changed in an incompatible way: increment the next counter. GPGME_CONFIG_API_VERSION=1 @@ -3288,7 +3288,7 @@ fi # Define the identity of the package. PACKAGE='gpgme' - VERSION='1.5.2' + VERSION='1.5.3' cat >>confdefs.h <<_ACEOF @@ -6021,7 +6021,7 @@ cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF -VERSION_NUMBER=0x010502 +VERSION_NUMBER=0x010503 # Don't default to build static libs. @@ -17365,7 +17365,7 @@ fi # # Provide information about the build. # -BUILD_REVISION="c62ce32" +BUILD_REVISION="37d927a" cat >>confdefs.h <<_ACEOF @@ -17374,7 +17374,7 @@ _ACEOF BUILD_FILEVERSION=`echo "$PACKAGE_VERSION"|sed 's/\([0-9.]*\).*/\1./;s/\./,/g'` -BUILD_FILEVERSION="${BUILD_FILEVERSION}50732" +BUILD_FILEVERSION="${BUILD_FILEVERSION}14297" BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date` @@ -19615,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.2, which was +This file was extended by gpgme $as_me 1.5.3, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -19681,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.2 +gpgme config.status 1.5.3 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -21975,7 +21975,7 @@ fi echo " GPGME v${VERSION} has been configured as follows: - Revision: c62ce32 (50732) + Revision: 37d927a (14297) Platform: $host UI Server: $uiserver diff --git a/configure.ac b/configure.ac index 0ffe847..70b846f 100644 --- a/configure.ac +++ b/configure.ac @@ -29,7 +29,7 @@ min_automake_version="1.11" # for the LT versions. m4_define(mym4_version_major, [1]) m4_define(mym4_version_minor, [5]) -m4_define(mym4_version_micro, [2]) +m4_define(mym4_version_micro, [3]) # Below is m4 magic to extract and compute the revision number, the # decimalized short revision number, a beta version string, and a flag @@ -59,7 +59,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=1 +LIBGPGME_LT_REVISION=2 # If the API is changed in an incompatible way: increment the next counter. GPGME_CONFIG_API_VERSION=1 diff --git a/doc/Makefile.am b/doc/Makefile.am index 19b8c82..2df35b4 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -31,6 +31,6 @@ online: gpgme.html gpgme.pdf echo "Uploading current manuals to www.gnupg.org ..."; \ user=werner ; \ (cd gpgme.html && rsync -vr --exclude='.svn' . \ - $${user}@cvs.gnupg.org:webspace/manuals/gpgme/ ); \ - rsync -v gpgme.pdf $${user}@cvs.gnupg.org:webspace/manuals/ + $${user}@ftp.gnupg.org:webspace/manuals/gpgme/ ); \ + rsync -v gpgme.pdf $${user}@ftp.gnupg.org:webspace/manuals/ diff --git a/doc/Makefile.in b/doc/Makefile.in index f584fe6..d15b0db 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -767,8 +767,8 @@ online: gpgme.html gpgme.pdf echo "Uploading current manuals to www.gnupg.org ..."; \ user=werner ; \ (cd gpgme.html && rsync -vr --exclude='.svn' . \ - $${user}@cvs.gnupg.org:webspace/manuals/gpgme/ ); \ - rsync -v gpgme.pdf $${user}@cvs.gnupg.org:webspace/manuals/ + $${user}@ftp.gnupg.org:webspace/manuals/gpgme/ ); \ + rsync -v gpgme.pdf $${user}@ftp.gnupg.org:webspace/manuals/ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/doc/gpgme.info b/doc/gpgme.info index ae18cf3..0a7c1c8 100644 --- a/doc/gpgme.info +++ b/doc/gpgme.info @@ -22,8 +22,8 @@ General Public License for more details. This file documents the GPGME library. - This is Edition 1.5.2, last updated 6 November 2014, of `The `GnuPG -Made Easy' Reference Manual', for Version 1.5.2. + This is Edition 1.5.3, last updated 6 November 2014, of `The `GnuPG +Made Easy' Reference Manual', for Version 1.5.3. Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2012, 2013, 2014 g10 Code GmbH. diff --git a/doc/gpgme.info-1 b/doc/gpgme.info-1 index 640f693..5e9afc4 100644 --- a/doc/gpgme.info-1 +++ b/doc/gpgme.info-1 @@ -22,8 +22,8 @@ General Public License for more details. This file documents the GPGME library. - This is Edition 1.5.2, last updated 6 November 2014, of `The `GnuPG -Made Easy' Reference Manual', for Version 1.5.2. + This is Edition 1.5.3, last updated 6 November 2014, of `The `GnuPG +Made Easy' Reference Manual', for Version 1.5.3. Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2012, 2013, 2014 g10 Code GmbH. @@ -45,8 +45,8 @@ File: gpgme.info, Node: Top, Next: Introduction, Up: (dir) Main Menu ********* -This is Edition 1.5.2, last updated 6 November 2014, of `The `GnuPG -Made Easy' Reference Manual', for Version 1.5.2 of the GPGME library. +This is Edition 1.5.3, last updated 6 November 2014, of `The `GnuPG +Made Easy' Reference Manual', for Version 1.5.3 of the GPGME library. * Menu: diff --git a/doc/gpgme.info-2 b/doc/gpgme.info-2 index 50b1271..d5c7874 100644 --- a/doc/gpgme.info-2 +++ b/doc/gpgme.info-2 @@ -22,8 +22,8 @@ General Public License for more details. This file documents the GPGME library. - This is Edition 1.5.2, last updated 6 November 2014, of `The `GnuPG -Made Easy' Reference Manual', for Version 1.5.2. + This is Edition 1.5.3, last updated 6 November 2014, of `The `GnuPG +Made Easy' Reference Manual', for Version 1.5.3. Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2012, 2013, 2014 g10 Code GmbH. diff --git a/doc/stamp-vti b/doc/stamp-vti index d36ed7c..0ae695f 100644 --- a/doc/stamp-vti +++ b/doc/stamp-vti @@ -1,4 +1,4 @@ @set UPDATED 6 November 2014 @set UPDATED-MONTH November 2014 -@set EDITION 1.5.2 -@set VERSION 1.5.2 +@set EDITION 1.5.3 +@set VERSION 1.5.3 diff --git a/doc/version.texi b/doc/version.texi index d36ed7c..0ae695f 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -1,4 +1,4 @@ @set UPDATED 6 November 2014 @set UPDATED-MONTH November 2014 -@set EDITION 1.5.2 -@set VERSION 1.5.2 +@set EDITION 1.5.3 +@set VERSION 1.5.3 diff --git a/gpgme.spec b/gpgme.spec index d7baac1..a63a514 100644 --- a/gpgme.spec +++ b/gpgme.spec @@ -1,7 +1,7 @@ # This is a template. The dist target uses it to create the real file. Summary: GPGME - GnuPG Made Easy Name: gpgme -Version: 1.5.2 +Version: 1.5.3 Release: 1 URL: http://www.gnupg.org/gpgme.html Source: ftp://ftp.gnupg.org/gcrypt/alpha/gpgme/%{name}-%{version}.tar.gz diff --git a/lang/cl/gpgme.asd b/lang/cl/gpgme.asd index f0277c3..62b017d 100644 --- a/lang/cl/gpgme.asd +++ b/lang/cl/gpgme.asd @@ -27,7 +27,7 @@ (defsystem gpgme :description "GnuPG Made Easy." :author "g10 Code GmbH" - :version "1.5.2" + :version "1.5.3" :licence "GPL" :depends-on ("cffi" "gpg-error") :components ((:file "gpgme-package") diff --git a/src/context.h b/src/context.h index e921436..745ffa8 100644 --- a/src/context.h +++ b/src/context.h @@ -38,7 +38,7 @@ typedef enum OPDATA_DECRYPT, OPDATA_SIGN, OPDATA_ENCRYPT, OPDATA_PASSPHRASE, OPDATA_IMPORT, OPDATA_GENKEY, OPDATA_KEYLIST, OPDATA_EDIT, OPDATA_VERIFY, OPDATA_TRUSTLIST, OPDATA_ASSUAN, OPDATA_VFS_MOUNT, - OPDATA_PASSWD + OPDATA_PASSWD, OPDATA_EXPORT } ctx_op_data_id_t; diff --git a/src/export.c b/src/export.c index 81a23b0..8930aa6 100644 --- a/src/export.c +++ b/src/export.c @@ -1,6 +1,6 @@ /* export.c - Export a key. Copyright (C) 2000 Werner Koch (dd9jn) - Copyright (C) 2001, 2002, 2003, 2004, 2010 g10 Code GmbH + Copyright (C) 2001-2004, 2010, 2014 g10 Code GmbH This file is part of GPGME. @@ -31,9 +31,82 @@ #include "ops.h" +/* Local operation data. */ +typedef struct +{ + gpg_error_t err; /* Error encountred during the export. */ +} *op_data_t; + + +static void +release_op_data (void *hook) +{ + op_data_t opd = (op_data_t) hook; + + (void)opd; /* Nothing to release here. */ +} + + +/* Parse an error status line. Return the error location and the + error code. The function may modify ARGS. */ +static char * +parse_error (char *args, gpg_error_t *r_err) +{ + char *where = strchr (args, ' '); + char *which; + + if (where) + { + *where = '\0'; + which = where + 1; + + where = strchr (which, ' '); + if (where) + *where = '\0'; + + where = args; + } + else + { + *r_err = trace_gpg_error (GPG_ERR_INV_ENGINE); + return NULL; + } + + *r_err = atoi (which); + + return where; +} + + static gpgme_error_t export_status_handler (void *priv, gpgme_status_code_t code, char *args) { + gpgme_ctx_t ctx = (gpgme_ctx_t) priv; + gpgme_error_t err; + void *hook; + op_data_t opd; + const char *loc; + + err = _gpgme_op_data_lookup (ctx, OPDATA_EXPORT, &hook, -1, NULL); + opd = hook; + if (err) + return err; + + switch (code) + { + case GPGME_STATUS_ERROR: + loc = parse_error (args, &err); + if (!loc) + return err; + else if (opd->err) + ; /* We only want to report the first error. */ + else if (!strcmp (loc, "keyserver_send")) + opd->err = err; + break; + + default: + break; + } return 0; } @@ -43,6 +116,8 @@ export_start (gpgme_ctx_t ctx, int synchronous, const char *pattern, gpgme_export_mode_t mode, gpgme_data_t keydata) { gpgme_error_t err; + void *hook; + op_data_t opd; if ((mode & ~(GPGME_EXPORT_MODE_EXTERN |GPGME_EXPORT_MODE_MINIMAL))) @@ -64,6 +139,12 @@ export_start (gpgme_ctx_t ctx, int synchronous, const char *pattern, if (err) return err; + err = _gpgme_op_data_lookup (ctx, OPDATA_EXPORT, &hook, + sizeof (*opd), release_op_data); + opd = hook; + if (err) + return err; + _gpgme_engine_set_status_handler (ctx->engine, export_status_handler, ctx); return _gpgme_engine_op_export (ctx->engine, pattern, mode, keydata, @@ -114,6 +195,8 @@ export_ext_start (gpgme_ctx_t ctx, int synchronous, const char *pattern[], gpgme_export_mode_t mode, gpgme_data_t keydata) { gpgme_error_t err; + void *hook; + op_data_t opd; if ((mode & ~(GPGME_EXPORT_MODE_EXTERN |GPGME_EXPORT_MODE_MINIMAL))) @@ -134,6 +217,12 @@ export_ext_start (gpgme_ctx_t ctx, int synchronous, const char *pattern[], if (err) return err; + err = _gpgme_op_data_lookup (ctx, OPDATA_EXPORT, &hook, + sizeof (*opd), release_op_data); + opd = hook; + if (err) + return err; + _gpgme_engine_set_status_handler (ctx->engine, export_status_handler, ctx); return _gpgme_engine_op_export_ext (ctx->engine, pattern, mode, keydata, @@ -196,7 +285,24 @@ gpgme_op_export_ext (gpgme_ctx_t ctx, const char *pattern[], err = export_ext_start (ctx, 1, pattern, mode, keydata); if (!err) - err = _gpgme_wait_one (ctx); + { + err = _gpgme_wait_one (ctx); + if (!err) + { + /* For this synchronous operation we check for operational + errors and return them. For asynchronous operations + there is currently no way to do this - we need to add a + gpgme_op_export_result function to fix that. */ + void *hook; + op_data_t opd; + + err = _gpgme_op_data_lookup (ctx, OPDATA_EXPORT, &hook, -1, NULL); + opd = hook; + if (!err) + err = opd->err; + } + } + return TRACE_ERR (err); } @@ -319,7 +425,24 @@ gpgme_op_export_keys (gpgme_ctx_t ctx, err = export_keys_start (ctx, 1, keys, mode, keydata); if (!err) - err = _gpgme_wait_one (ctx); + { + err = _gpgme_wait_one (ctx); + if (!err) + { + /* For this synchronous operation we check for operational + errors and return them. For asynchronous operations + there is currently no way to do this - we need to add a + gpgme_op_export_result function to fix that. */ + void *hook; + op_data_t opd; + + err = _gpgme_op_data_lookup (ctx, OPDATA_EXPORT, &hook, -1, NULL); + opd = hook; + if (!err) + err = opd->err; + } + } + return TRACE_ERR (err); } -- 2.7.4