[git] GPGME - branch, master, updated. gpgme-1.8.0-75-gde708e5

by Justus Winter cvs at cvs.gnupg.org
Wed Feb 15 16:47:32 CET 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG Made Easy".

The branch, master has been updated
       via  de708e5934cda380dbc3ae51f587c09041de7562 (commit)
       via  27544d0a74267ab6057dc816ea3311bc9149a200 (commit)
       via  25f0435a0022a70af77660d72d33f17bec2d4e51 (commit)
       via  6df6e01ed5a581765d245bf7303cda4497d0eb22 (commit)
      from  92adc9bbf640eb5d9177d3ba0189e0f6cee4e995 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit de708e5934cda380dbc3ae51f587c09041de7562
Author: Justus Winter <justus at g10code.com>
Date:   Wed Feb 15 16:17:13 2017 +0100

    core: Fix expiration time handling when creating keys.
    
    * NEWS: Update.
    * doc/gpgme.texi (gpgme_op_createkey): Clarify the meaning of the
    'expire' parameter.
    (GPGME_CREATE_NOEXPIRE): Document new flag.
    (gpgme_op_createsubkey): Clarify the meaning of the 'expire'
    parameter.
    * src/engine-gpg.c (gpg_add_algo_usage_expire): Fix handling of the
    expiration time.
    * src/gpgme.h.in (GPGME_CREATE_NOEXPIRE): New macro.
    --
    
    Previously, the documentation stated that the expiration time was an
    absolute timestamp.  However, this value was passed using the
    'seconds=N' syntax to GnuPG which specifies the expiration time in
    seconds relative to the creation time.  Fix the documentation.
    
    Furthermore, the documentation stated that using 0 results in keys
    that do not expire.  This was communicated to GnuPG by using the
    implicit default.  However, as of GnuPG 2.1.17, the default was
    changed to create keys that expire within a reasonable timespan.
    
    Fix this discrepancy by aligning the behavior with recent GnuPG
    versions: 0 means use a reasonable default, and introduce a flag that
    can be used to create keys that do not expire.  Communicate this
    explicitly to GnuPG.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/NEWS b/NEWS
index 0735882..82f403c 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,9 @@ Noteworthy changes in version 1.8.1 (unreleased)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  gpgme_strerror_r            CHANGED: Use gpgme_error_t (compatible type).
  gpgme_data_set_flag         CHANGED: Return gpgme_error_t (compatible type).
+ gpgme_op_createkey          CHANGED: Meaning of 'expire' parameter.
+ gpgme_op_createsubkey       CHANGED: Meaning of 'expire' parameter.
+ GPGME_CREATE_NOEXPIRE       NEW.
  cpp: Context::revUid(const Key&, const char*)      NEW.
  cpp: Context::startRevUid(const Key&, const char*) NEW.
  cpp: Context::addUid(const Key&, const char*)      NEW.
diff --git a/doc/gpgme.texi b/doc/gpgme.texi
index e058fba..c088cfe 100644
--- a/doc/gpgme.texi
+++ b/doc/gpgme.texi
@@ -3612,13 +3612,14 @@ primary key plus a secondary key (subkey).
 
 @var{reserved} must be set to zero.
 
- at var{expires} can be set to the number of seconds since Epoch of the
-desired expiration date in UTC for the new key.   Using 0 does not
-set an expiration date.  Note that this parameter takes an unsigned long
-value and not a @code{time_t} to avoid problems on systems which use a
-signed 32 bit @code{time_t}.  Note further that the OpenPGP protocol
-uses 32 bit values for timestamps and thus can only encode dates up to
-the year 2106.
+ at var{expires} specifies the expiration time in seconds.  If you supply
+0, a reasonable expiration time is chosen.  Use the flag
+ at code{GPGME_CREATE_NOEXPIRE} to create keys that do not expire.  Note
+that this parameter takes an unsigned long value and not a
+ at code{time_t} to avoid problems on systems which use a signed 32 bit
+ at code{time_t}.  Note further that the OpenPGP protocol uses 32 bit
+values for timestamps and thus can only encode dates up to the year
+2106.
 
 @var{extrakey} is currently not used and must be set to @code{NULL}.
 A future version of GPGME may use this parameter to create X.509 keys.
@@ -3660,6 +3661,9 @@ The engine does not allow the creation of a key with a user ID
 already existing in the local key database.  This flag can be used to
 override this check.
 
+ at item GPGME_CREATE_NOEXPIRE
+Request generation of keys that do not expire.
+
 @end table
 
 After the operation completed successfully, information about the
@@ -3719,13 +3723,14 @@ able to already handle such future algorithms.
 
 @var{reserved} must be set to zero.
 
- at var{expires} can be set to the number of seconds since Epoch of the
-desired expiration date in UTC for the new subkey.   Using 0 does not
-set an expiration date.  Note that this parameter takes an unsigned long
-value and not a @code{time_t} to avoid problems on systems which use a
-signed 32 bit @code{time_t}.  Note further that the OpenPGP protocol
-uses 32 bit values for timestamps and thus can only encode dates up to
-the year 2106.
+ at var{expires} specifies the expiration time in seconds.  If you supply
+0, a reasonable expiration time is chosen.  Use the flag
+ at code{GPGME_CREATE_NOEXPIRE} to create keys that do not expire.  Note
+that this parameter takes an unsigned long value and not a
+ at code{time_t} to avoid problems on systems which use a signed 32 bit
+ at code{time_t}.  Note further that the OpenPGP protocol uses 32 bit
+values for timestamps and thus can only encode dates up to the year
+2106.
 
 @var{flags} takes the same values as described above for
 @code{gpgme_op_createkey}.
diff --git a/src/engine-gpg.c b/src/engine-gpg.c
index 21ca02a..3443600 100644
--- a/src/engine-gpg.c
+++ b/src/engine-gpg.c
@@ -2076,7 +2076,8 @@ gpg_add_algo_usage_expire (engine_gpg_t gpg,
   /* This condition is only required to allow the use of gpg < 2.1.16 */
   if (algo
       || (flags & (GPGME_CREATE_SIGN | GPGME_CREATE_ENCR
-                   | GPGME_CREATE_CERT | GPGME_CREATE_AUTH))
+                   | GPGME_CREATE_CERT | GPGME_CREATE_AUTH
+                   | GPGME_CREATE_NOEXPIRE))
       || expires)
     {
       err = add_arg (gpg, algo? algo : "default");
@@ -2090,11 +2091,18 @@ gpg_add_algo_usage_expire (engine_gpg_t gpg,
                     (flags & GPGME_CREATE_AUTH)? " auth":"");
           err = add_arg (gpg, *tmpbuf? tmpbuf : "default");
         }
-      if (!err && expires)
+      if (!err)
         {
-          char tmpbuf[8+20];
-          snprintf (tmpbuf, sizeof tmpbuf, "seconds=%lu", expires);
-          err = add_arg (gpg, tmpbuf);
+          if (flags & GPGME_CREATE_NOEXPIRE)
+            err = add_arg (gpg, "never");
+          else if (expires == 0)
+            err = add_arg (gpg, "-");
+          else
+            {
+              char tmpbuf[8+20];
+              snprintf (tmpbuf, sizeof tmpbuf, "seconds=%lu", expires);
+              err = add_arg (gpg, tmpbuf);
+            }
         }
     }
   else
diff --git a/src/gpgme.h.in b/src/gpgme.h.in
index 7f2d34f..f76689e 100644
--- a/src/gpgme.h.in
+++ b/src/gpgme.h.in
@@ -1637,6 +1637,7 @@ gpgme_error_t gpgme_op_export_keys (gpgme_ctx_t ctx,
 #define GPGME_CREATE_WANTPUB    (1 << 10) /* Return the public key.    */
 #define GPGME_CREATE_WANTSEC    (1 << 11) /* Return the secret key.    */
 #define GPGME_CREATE_FORCE      (1 << 12) /* Force creation.           */
+#define GPGME_CREATE_NOEXPIRE   (1 << 13) /* Create w/o expiration.    */
 
 /* An object to return result from a key generation.
  * This structure shall be considered read-only and an application

commit 27544d0a74267ab6057dc816ea3311bc9149a200
Author: Justus Winter <justus at g10code.com>
Date:   Wed Feb 15 11:31:27 2017 +0100

    python: Fix build system integration.
    
    * lang/python/Makefile.am (copystamp): Also copy the setup script, and
    link the header files.
    (all-local): Use local setup script.
    (sdist): Fix Python source distribution creation.
    (CLEANFILES): Remove now obsolete files.
    (install-exec-local): Use local setup script.
    * lang/python/setup.py.in: Adjust relative paths to in-tree files.
    
    Fixes-commit: fe65a26ab584bd70fad45c7c4d44330e30a748a4
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/lang/python/Makefile.am b/lang/python/Makefile.am
index 908f622..2724d86 100644
--- a/lang/python/Makefile.am
+++ b/lang/python/Makefile.am
@@ -46,47 +46,48 @@ COPY_FILES_GPG = \
 
 # For VPATH builds we need to copy some files because Python's
 # distutils are not VPATH-aware.
-copystamp: $(COPY_FILES) $(COPY_FILES_GPG) data.h config.h
+copystamp: $(COPY_FILES) $(COPY_FILES_GPG)
+	for F in $(COPY_FILES) $(COPY_FILES_GPG) ; do if [ $$F -nt $@ ]; then echo $F ; fi ; done
 	for VERSION in $(PYTHON_VERSIONS); do \
 	  $(MKDIR_P)              python$${VERSION}-gpg/gpg && \
 	  cp -R $(COPY_FILES)     python$${VERSION}-gpg && \
+	  cp setup.py             python$${VERSION}-gpg && \
 	  cp gpg/version.py       python$${VERSION}-gpg/gpg && \
+	  ln -sf "$(abs_top_srcdir)/src/data.h" python$${VERSION}-gpg && \
+	  ln -sf "$(abs_top_builddir)/config.h" python$${VERSION}-gpg && \
 	  cp -R $(COPY_FILES_GPG) python$${VERSION}-gpg/gpg ; \
 	done
 	touch $@
 
-data.h:
-	ln -s "$(top_srcdir)/src/data.h" .
-
-config.h:
-	ln -s "$(top_builddir)/config.h" .
-
 all-local: copystamp
 	set $(PYTHONS); for VERSION in $(PYTHON_VERSIONS); do \
 	  PYTHON="$$1" ; shift ; \
 	  cd python$${VERSION}-gpg && \
 	  CFLAGS="$(CFLAGS)" \
-	    $$PYTHON ../setup.py build --verbose ; \
+	    $$PYTHON setup.py build --verbose ; \
 	  cd .. ; \
 	done
 
-dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc: copystamp
+python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz \
+python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz.asc: copystamp
+	cd python$(PYTHON_VERSION)-gpg && \
 	CFLAGS="$(CFLAGS)" \
 	  $(PYTHON) setup.py sdist --verbose
-	gpg2 --detach-sign --armor dist/gpg-$(VERSION).tar.gz
+	gpg2 --detach-sign --armor python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz
 
 .PHONY: prepare
 prepare: copystamp
 
 .PHONY: sdist
-sdist: dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc
+sdist: python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz \
+       python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz.asc
 
 .PHONY: upload
-upload: dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc
+upload: python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz \
+        python$(PYTHON_VERSION)-gpg/dist/gpg-$(VERSION).tar.gz.asc
 	twine upload $^
 
-CLEANFILES = gpgme.h errors.i gpgme_wrap.c gpg/gpgme.py \
-	  data.h config.h copystamp
+CLEANFILES = copystamp
 
 # Remove the rest.
 #
@@ -104,7 +105,7 @@ install-exec-local:
 	set $(PYTHONS); for VERSION in $(PYTHON_VERSIONS); do \
 	  PYTHON="$$1" ; shift ; \
 	  cd python$${VERSION}-gpg && \
-	  $$PYTHON ../setup.py install \
+	  $$PYTHON setup.py install \
 	  --prefix $(DESTDIR)$(prefix) \
 	  --record files.txt \
 	  --verbose ; \
diff --git a/lang/python/setup.py.in b/lang/python/setup.py.in
index 5b5d5be..e32237d 100755
--- a/lang/python/setup.py.in
+++ b/lang/python/setup.py.in
@@ -34,12 +34,12 @@ in_tree = False
 extra_swig_opts = []
 extra_macros = dict()
 
-if os.path.exists("../../src/gpgme-config"):
+if os.path.exists("../../../src/gpgme-config"):
     # In-tree build.
     in_tree = True
-    gpgme_config = ["../../src/gpgme-config"] + gpgme_config_flags
-    gpgme_h = "../../src/gpgme.h"
-    library_dirs = ["../../src/.libs"] # XXX uses libtool internals
+    gpgme_config = ["../../../src/gpgme-config"] + gpgme_config_flags
+    gpgme_h = "../../../src/gpgme.h"
+    library_dirs = ["../../../src/.libs"] # XXX uses libtool internals
     extra_macros.update(
         HAVE_CONFIG_H=1,
         HAVE_DATA_H=1,

commit 25f0435a0022a70af77660d72d33f17bec2d4e51
Author: Justus Winter <justus at g10code.com>
Date:   Wed Feb 15 11:28:02 2017 +0100

    python: Update lists of functions returning gpgme_error_t.
    
    * lang/python/gpg/core.py (Context._errorcheck): Add instructions how
    to update the list.  Update list.
    (Data._errorcheck): Likewise.
    (Context.set_engine_info): Simplify.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/lang/python/gpg/core.py b/lang/python/gpg/core.py
index 18a7e3a..3a63516 100644
--- a/lang/python/gpg/core.py
+++ b/lang/python/gpg/core.py
@@ -628,22 +628,27 @@ class Context(GpgmeWrapper):
 
     def _errorcheck(self, name):
         """This function should list all functions returning gpgme_error_t"""
+        # The list of functions is created using:
+        #
+        # $ grep '^gpgme_error_t ' obj/lang/python/python3.5-gpg/gpgme.h \
+        #   | grep -v _op_ | awk "/\(gpgme_ctx/ { printf (\"'%s',\\n\", \$2) } "
         return ((name.startswith('gpgme_op_')
                  and not name.endswith('_result'))
                 or name in {
+                    'gpgme_new',
                     'gpgme_set_ctx_flag',
                     'gpgme_set_protocol',
                     'gpgme_set_sub_protocol',
                     'gpgme_set_keylist_mode',
                     'gpgme_set_pinentry_mode',
                     'gpgme_set_locale',
-                    'gpgme_set_engine_info',
+                    'gpgme_ctx_set_engine_info',
                     'gpgme_signers_add',
-                    'gpgme_get_sig_key',
                     'gpgme_sig_notation_add',
+                    'gpgme_set_sender',
                     'gpgme_cancel',
                     'gpgme_cancel_async',
-                    'gpgme_cancel_get_key',
+                    'gpgme_get_key',
                 })
 
     _boolean_properties = {'armor', 'textmode', 'offline'}
@@ -850,8 +855,7 @@ class Context(GpgmeWrapper):
         home_dir	-- configuration directory (unchanged if None)
 
         """
-        errorcheck(gpgme.gpgme_ctx_set_engine_info(
-            self.wrapped, proto, file_name, home_dir))
+        self.ctx_set_engine_info(proto, file_name, home_dir)
 
     def wait(self, hang):
         """Wait for asynchronous call to finish. Wait forever if hang is True.
@@ -905,11 +909,19 @@ class Data(GpgmeWrapper):
 
     def _errorcheck(self, name):
         """This function should list all functions returning gpgme_error_t"""
+        # This list is compiled using
+        #
+        # $ grep -v '^gpgme_error_t ' obj/lang/python/python3.5-gpg/gpgme.h \
+        #   | awk "/\(gpgme_data_t/ { printf (\"'%s',\\n\", \$2) } " | sed "s/'\\*/'/"
         return name not in {
+            'gpgme_data_read',
+            'gpgme_data_write',
+            'gpgme_data_seek',
+            'gpgme_data_release',
             'gpgme_data_release_and_get_mem',
             'gpgme_data_get_encoding',
-            'gpgme_data_seek',
             'gpgme_data_get_file_name',
+            'gpgme_data_identify',
         }
 
     def __init__(self, string=None, file=None, offset=None,

commit 6df6e01ed5a581765d245bf7303cda4497d0eb22
Author: Justus Winter <justus at g10code.com>
Date:   Wed Feb 15 09:45:46 2017 +0100

    core: Fix error types.
    
    * NEWS: Update.
    * src/data.c (gpgme_data_set_flag): Return a 'gpgme_error_t'.
    * src/error.c (gpgme_strerror_r): Fix type of first argument.
    * src/gpgme.h.in (gpgme_strerror_r): Adapt.
    (gpgme_data_set_flag): Likewise.
    --
    Fix for consistency.  This should not pose problems, because typedef
    gpg_error_t gpgme_error_t.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/NEWS b/NEWS
index a974ec7..0735882 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ Noteworthy changes in version 1.8.1 (unreleased)
 
  * Interface changes relative to the 1.8.0 release:
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ gpgme_strerror_r            CHANGED: Use gpgme_error_t (compatible type).
+ gpgme_data_set_flag         CHANGED: Return gpgme_error_t (compatible type).
  cpp: Context::revUid(const Key&, const char*)      NEW.
  cpp: Context::startRevUid(const Key&, const char*) NEW.
  cpp: Context::addUid(const Key&, const char*)      NEW.
diff --git a/src/data.c b/src/data.c
index e4e9ee3..6fe7e71 100644
--- a/src/data.c
+++ b/src/data.c
@@ -259,7 +259,7 @@ gpgme_data_get_file_name (gpgme_data_t dh)
 
 
 /* Set a flag for the data object DH.  See the manual for details.  */
-gpg_error_t
+gpgme_error_t
 gpgme_data_set_flag (gpgme_data_t dh, const char *name, const char *value)
 {
   TRACE_BEG2 (DEBUG_DATA, "gpgme_data_set_flag", dh,
diff --git a/src/error.c b/src/error.c
index a84b867..d9c5fd0 100644
--- a/src/error.c
+++ b/src/error.c
@@ -41,7 +41,7 @@ gpgme_strerror (gpgme_error_t err)
    large enough, ERANGE is returned and BUF contains as much of the
    beginning of the error string as fits into the buffer.  */
 int
-gpgme_strerror_r (gpg_error_t err, char *buf, size_t buflen)
+gpgme_strerror_r (gpgme_error_t err, char *buf, size_t buflen)
 {
   return gpg_strerror_r (err, buf, buflen);
 }
diff --git a/src/gpgme.h.in b/src/gpgme.h.in
index 67c139b..7f2d34f 100644
--- a/src/gpgme.h.in
+++ b/src/gpgme.h.in
@@ -177,7 +177,7 @@ const char *gpgme_strerror (gpgme_error_t err);
    contains the string describing the error.  If the buffer was not
    large enough, ERANGE is returned and BUF contains as much of the
    beginning of the error string as fits into the buffer.  */
-int gpgme_strerror_r (gpg_error_t err, char *buf, size_t buflen);
+int gpgme_strerror_r (gpgme_error_t err, char *buf, size_t buflen);
 
 /* Return a pointer to a string containing a description of the error
    source in the error value ERR.  */
@@ -1161,8 +1161,8 @@ gpgme_error_t gpgme_data_set_file_name (gpgme_data_t dh,
 					const char *file_name);
 
 /* Set a flag for the data object DH.  See the manual for details.  */
-gpg_error_t gpgme_data_set_flag (gpgme_data_t dh,
-                                 const char *name, const char *value);
+gpgme_error_t gpgme_data_set_flag (gpgme_data_t dh,
+                                   const char *name, const char *value);
 
 /* Try to identify the type of the data in DH.  */
 gpgme_data_type_t gpgme_data_identify (gpgme_data_t dh, int reserved);

-----------------------------------------------------------------------

Summary of changes:
 NEWS                    |  5 +++++
 doc/gpgme.texi          | 33 +++++++++++++++++++--------------
 lang/python/Makefile.am | 31 ++++++++++++++++---------------
 lang/python/gpg/core.py | 24 ++++++++++++++++++------
 lang/python/setup.py.in |  8 ++++----
 src/data.c              |  2 +-
 src/engine-gpg.c        | 18 +++++++++++++-----
 src/error.c             |  2 +-
 src/gpgme.h.in          |  7 ++++---
 9 files changed, 81 insertions(+), 49 deletions(-)


hooks/post-receive
-- 
GnuPG Made Easy
http://git.gnupg.org




More information about the Gnupg-commits mailing list