gpgme-1-0-branch gpgme (12 files)

cvs user marcus cvs at cvs.gnupg.org
Sat May 28 21:49:56 CEST 2005


    Date: Saturday, May 28, 2005 @ 22:10:38
  Author: marcus
    Path: /cvs/gpgme/gpgme
     Tag: gpgme-1-0-branch

Modified: NEWS THANKS TODO doc/ChangeLog doc/gpgme.texi gpgme/ChangeLog
          gpgme/data-user.c gpgme/engine-gpgsm.c gpgme/gpgme.c
          gpgme/gpgme.h gpgme/w32-io.c gpgme/wait-global.c

Merging bug-fixes from CVS HEAD.


----------------------+
 NEWS                 |   19 ++++++++++++++++++-
 THANKS               |    1 +
 TODO                 |   13 +++++--------
 doc/ChangeLog        |   11 +++++++++++
 doc/gpgme.texi       |    5 ++++-
 gpgme/ChangeLog      |   41 ++++++++++++++++++++++++++++++++++++++++-
 gpgme/data-user.c    |   13 ++++++++++++-
 gpgme/engine-gpgsm.c |   24 ++++++++++++++++--------
 gpgme/gpgme.c        |   10 ++++++----
 gpgme/gpgme.h        |    3 +++
 gpgme/w32-io.c       |    2 +-
 gpgme/wait-global.c  |   18 +++++++++++++-----
 12 files changed, 130 insertions(+), 30 deletions(-)


Index: gpgme/NEWS
diff -u gpgme/NEWS:1.136.2.3 gpgme/NEWS:1.136.2.4
--- gpgme/NEWS:1.136.2.3	Tue Dec 28 12:42:19 2004
+++ gpgme/NEWS	Sat May 28 22:10:38 2005
@@ -1,6 +1,23 @@
-Noteworthy changes in version 1.0.3
+Noteworthy changes in version 1.0.3 (unreleased)
 ------------------------------------------------
 
+ * Previousy, GPGME would use a default "include certs" of 1.  This
+   has been changed.  Now GPGME will use the crypto backend engines
+   default unless you set the value with gpgme_set_include_certs()
+   explicitely.  A new macro GPGME_INCLUDE_CERTS_DEFAULT can be used
+   as a value to explicitely request the new default behaviour.
+
+   Because the default changes, this is a slight change of the API
+   semantics.  We consider it to be a bug fix.
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+gpgme_set_engine_info		NEW
+gpgme_ctx_get_engine_info	NEW
+gpgme_ctx_set_engine_info	NEW
+gpgme_set_include_certs		CHANGED DEFAULT
+GPGME_INCLUDE_CERTS_DEFAULT	NEW
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
 
 Noteworthy changes in version 1.0.2 (2004-12-28)
 ------------------------------------------------
Index: gpgme/THANKS
diff -u gpgme/THANKS:1.7.2.1 gpgme/THANKS:1.7.2.2
--- gpgme/THANKS:1.7.2.1	Tue Dec  7 20:06:42 2004
+++ gpgme/THANKS	Sat May 28 22:10:38 2005
@@ -9,6 +9,7 @@
 Alfons Hoogervorst      alfons at proteus.demon.nl
 Enno Cramer             uebergeek at web.de
 Frank Heckenbach        frank at g-n-u.de
+Igor Belyi		gpgme at katehok.ac93.org
 Jan-Oliver Wagner       jan at intevation.de
 Johannes Poehlmann      jhp at caldera.de
 Jose C. García Sogo     jose at jaimedelamo.eu.org
Index: gpgme/TODO
diff -u gpgme/TODO:1.95.2.1 gpgme/TODO:1.95.2.2
--- gpgme/TODO:1.95.2.1	Tue Dec  7 22:11:52 2004
+++ gpgme/TODO	Sat May 28 22:10:38 2005
@@ -1,7 +1,6 @@
 Hey Emacs, this is -*- outline -*- mode!
 
 * Before release:
-** Switch to LGPL?
 ** Some gpg tests fail with gpg 1.3.4-cvs (gpg/t-keylist-sig)
    The test is currently disabled there and in gpg/t-import.
 ** Add notation data to key signatures.
@@ -9,7 +8,8 @@
 * ABI's to break:
 ** I/O and User Data could be made extensible.  But this can be done
    without breaking the ABI hopefully.
-*  All enums that should be enums need to have a maximum value to ensure	  a certain minimum width for extensibility.
+*  All enums that should be enums need to have a maximum value to ensure
+   a certain minimum width for extensibility.
 ** Compatibility interfaces that can be removed in future versions:
 *** ath compatibility modules.
 *** gpgme_data_new_from_filepart
@@ -28,6 +28,7 @@
 *** gpgme_attr_t
 *** All Gpgme* typedefs.
 
+
 * Thread support:
 ** When GNU Pth supports sendmsg/recvmsg, wrap them properly.
 ** Without timegm (3) support our ISO time parser is not thread safe.
@@ -60,9 +61,6 @@
   This allows us to handle years later than 2037 properly.  With the
   time_t interface they are all mapped to 2037-12-31
 
-* Support
-** gpgme.m4 should check --api-version of gpgme-config.
- 
 * Documentation
 ** Document validity and trust issues.
 
@@ -143,14 +141,13 @@
 
 * Build suite
 ** Make sure everything is cleaned correctly (esp. test area).
-** Configure test for gpg and gpgsm version (as a warning).
 ** Enable AC_CONFIG_MACRO_DIR and bump up autoconf version requirement.
    (To fix "./autogen.sh; ./configure --enable-maintainer-mode; touch
-   configure.ac; make").
+   configure.ac; make").  Currently worked around with ACLOCAL_AMFLAGS???
 
 * Error checking 
 ** engine-gpgsm, with-validation
-  Add error checking some time after releasing a new gpgsm.
+   Add error checking some time after releasing a new gpgsm.
 
 
 Copyright 2004 g10 Code GmbH
Index: gpgme/doc/ChangeLog
diff -u gpgme/doc/ChangeLog:1.131.2.3 gpgme/doc/ChangeLog:1.131.2.4
--- gpgme/doc/ChangeLog:1.131.2.3	Tue Dec  7 22:21:08 2004
+++ gpgme/doc/ChangeLog	Sat May 28 22:10:37 2005
@@ -1,3 +1,14 @@
+2005-05-28  Marcus Brinkmann  <marcus at g10code.de>
+
+	* gpgme.texi (Key Listing Mode): Fix return type of
+	gpgme_set_keylist_mode.
+	Reported by "Sergio" <ml_sergico at virgilio.it>.
+
+2005-04-28  Marcus Brinkmann  <marcus at g10code.de>
+
+	* gpgme.texi (Included Certificates): Document
+	GPGME_INCLUDE_CERTS_DEFAULT.
+
 2004-12-07  Marcus Brinkmann  <marcus at g10code.de>
 
 	* lesser.texi (Library Copying): Change from @appendixsec to
Index: gpgme/doc/gpgme.texi
diff -u gpgme/doc/gpgme.texi:1.133.2.3 gpgme/doc/gpgme.texi:1.133.2.4
--- gpgme/doc/gpgme.texi:1.133.2.3	Tue Dec  7 22:21:08 2004
+++ gpgme/doc/gpgme.texi	Sat May 28 22:10:37 2005
@@ -1944,6 +1944,9 @@
 values of @var{nr_of_certs} are:
 
 @table @code
+ at item GPGME_INCLUDE_CERTS_DEFAULT
+Fall back to the default of the crypto backend.  This is the default
+for GPGME.
 @item -2
 Include all certificates except the root certificate.
 @item -1
@@ -1974,7 +1977,7 @@
 @cindex key listing mode
 @cindex key listing, mode of
 
- at deftypefun void gpgme_set_keylist_mode (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_keylist_mode_t @var{mode}})
+ at deftypefun gpgme_error_t gpgme_set_keylist_mode (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_keylist_mode_t @var{mode}})
 The function @code{gpgme_set_keylist_mode} changes the default
 behaviour of the key listing functions.  The value in @var{mode} is a
 bitwise-or combination of one or multiple of the following bit values:
Index: gpgme/gpgme/ChangeLog
diff -u gpgme/gpgme/ChangeLog:1.386.2.3 gpgme/gpgme/ChangeLog:1.386.2.4
--- gpgme/gpgme/ChangeLog:1.386.2.3	Thu Apr 21 09:12:18 2005
+++ gpgme/gpgme/ChangeLog	Sat May 28 22:10:37 2005
@@ -1,7 +1,46 @@
+2005-05-28  Marcus Brinkmann  <marcus at g10code.de>
+
+	* data-user.c: Include <errno.h>.
+
+2005-05-17  Marcus Brinkmann  <marcus at g10code.de>
+
+	* gpgme.c (gpgme_new): Set the CTX->include_certs default to the
+	default.
+
+2005-05-11  Marcus Brinkmann  <marcus at g10code.de>
+
+	* w32-io.c (_gpgme_io_select): Fix loop increment.
+
+2005-05-05  Marcus Brinkmann  <marcus at g10code.de>
+
+	* data-user.c (user_release): Only call user hook if provided.
+	(user_seek): Return EBADF if no user hook is provided.
+	(user_read): Likewise.
+	(user_write): Likewise.
+
+2005-04-28  Marcus Brinkmann  <marcus at g10code.de>
+
+	* gpgme.h (GPGME_INCLUDE_CERTS_DEFAULT): New macro.
+	* engine-gpgsm.c (gpgsm_sign): Send the include-certs option after
+	the reset, just for cleanliness, and do not sent it at all if the
+	default is requested.
+	* gpgme.c (gpgme_set_include_certs): Allow to use
+	GPGME_INCLUDE_CERTS_DEFAULT.
+
 2005-04-21  Werner Koch  <wk at g10code.com>
 
 	* verify.c (calc_sig_summary): Set the key revoked bit.
 
+2005-04-14  Marcus Brinkmann  <marcus at g10code.de>
+
+	* wait-global.c (gpgme_wait): Use LI->ctx when checking a context
+	in the list, not the user-provided CTX.
+	Reported by Igor Belyi <gpgme at katehok.ac93.org>.
+
+	* wait-global.c (gpgme_wait): If no context is found, and we
+	should not hang, set *status to 0 and return NULL.
+	Reported by Igor Belyi <gpgme at katehok.ac93.org>.
+
 2004-12-11  Marcus Brinkmann  <marcus at g10code.de>
 
 	* util.h [HAVE_CONFIG_H && HAVE_TTYNAME_R] (ttyname_r): Define
@@ -4570,7 +4609,7 @@
 	* data.c (gpgme_data_rewind): Allow to rewind data_type_none.
 
 
- Copyright 2001, 2002, 2003, 2004 g10 Code GmbH
+ Copyright 2001, 2002, 2003, 2004, 2005 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
Index: gpgme/gpgme/data-user.c
diff -u gpgme/gpgme/data-user.c:1.4.2.1 gpgme/gpgme/data-user.c:1.4.2.2
--- gpgme/gpgme/data-user.c:1.4.2.1	Tue Dec  7 22:11:52 2004
+++ gpgme/gpgme/data-user.c	Sat May 28 22:10:37 2005
@@ -23,6 +23,7 @@
 #endif
 
 #include <sys/types.h>
+#include <errno.h>
 
 #include "data.h"
 
@@ -30,6 +31,9 @@
 static ssize_t
 user_read (gpgme_data_t dh, void *buffer, size_t size)
 {
+  if (!dh->data.user.cbs->read)
+    return EBADF;
+
   return (*dh->data.user.cbs->read) (dh->data.user.handle, buffer, size);
 }
 
@@ -37,6 +41,9 @@
 static ssize_t
 user_write (gpgme_data_t dh, const void *buffer, size_t size)
 {
+  if (!dh->data.user.cbs->write)
+    return EBADF;
+
   return (*dh->data.user.cbs->write) (dh->data.user.handle, buffer, size);
 }
 
@@ -44,6 +51,9 @@
 static off_t
 user_seek (gpgme_data_t dh, off_t offset, int whence)
 {
+  if (!dh->data.user.cbs->seek)
+    return EBADF;
+
   return (*dh->data.user.cbs->seek) (dh->data.user.handle, offset, whence);
 }
 
@@ -51,7 +61,8 @@
 static void
 user_release (gpgme_data_t dh)
 {
-  (*dh->data.user.cbs->release) (dh->data.user.handle);
+  if (dh->data.user.cbs->release)
+    (*dh->data.user.cbs->release) (dh->data.user.handle);
 }
 
 
Index: gpgme/gpgme/engine-gpgsm.c
diff -u gpgme/gpgme/engine-gpgsm.c:1.100.2.1 gpgme/gpgme/engine-gpgsm.c:1.100.2.2
--- gpgme/gpgme/engine-gpgsm.c:1.100.2.1	Tue Dec  7 22:11:52 2004
+++ gpgme/gpgme/engine-gpgsm.c	Sat May 28 22:10:37 2005
@@ -1,6 +1,6 @@
 /* engine-gpgsm.c - GpgSM engine.
    Copyright (C) 2000 Werner Koch (dd9jn)
-   Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH
+   Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH
  
    This file is part of GPGME.
 
@@ -1433,19 +1433,27 @@
   if (!gpgsm)
     return gpg_error (GPG_ERR_INV_VALUE);
 
-  if (asprintf (&assuan_cmd, "OPTION include-certs %i", include_certs) < 0)
-    return gpg_error_from_errno (errno);
-  err = gpgsm_assuan_simple_command (gpgsm->assuan_ctx, assuan_cmd, NULL,NULL);
-  free (assuan_cmd);
-  if (err)
-    return err;
-
   /* We must send a reset because we need to reset the list of
      signers.  Note that RESET does not reset OPTION commands. */
   err = gpgsm_assuan_simple_command (gpgsm->assuan_ctx, "RESET", NULL, NULL);
   if (err)
     return err;
 
+  if (include_certs != GPGME_INCLUDE_CERTS_DEFAULT)
+    {
+      /* FIXME: Make sure that if we run multiple operations, that we
+	 can reset any previously set value in case the default is
+	 requested.  */
+
+      if (asprintf (&assuan_cmd, "OPTION include-certs %i", include_certs) < 0)
+	return gpg_error_from_errno (errno);
+      err = gpgsm_assuan_simple_command (gpgsm->assuan_ctx, assuan_cmd,
+					 NULL, NULL);
+      free (assuan_cmd);
+      if (err)
+	return err;
+    }
+
   for (i = 0; (key = gpgme_signers_enum (ctx, i)); i++)
     {
       const char *s = key->subkeys ? key->subkeys->fpr : NULL;
Index: gpgme/gpgme/gpgme.c
diff -u gpgme/gpgme/gpgme.c:1.76.2.1 gpgme/gpgme/gpgme.c:1.76.2.2
--- gpgme/gpgme/gpgme.c:1.76.2.1	Tue Dec  7 22:11:52 2004
+++ gpgme/gpgme/gpgme.c	Sat May 28 22:10:37 2005
@@ -52,7 +52,7 @@
   if (!ctx)
     return gpg_error_from_errno (errno);
   ctx->keylist_mode = GPGME_KEYLIST_MODE_LOCAL;
-  ctx->include_certs = 1;
+  ctx->include_certs = GPGME_INCLUDE_CERTS_DEFAULT;
   ctx->protocol = GPGME_PROTOCOL_OpenPGP;
   _gpgme_fd_table_init (&ctx->fdt);
 
@@ -211,12 +211,14 @@
 
 
 /* Set the number of certifications to include in an S/MIME message.
-   The default is 1 (only the cert of the sender).  -1 means all
-   certs, and -2 means all certs except the root cert.  */
+   The default is GPGME_INCLUDE_CERTS_DEFAULT.  -1 means all certs,
+   and -2 means all certs except the root cert.  */
 void
 gpgme_set_include_certs (gpgme_ctx_t ctx, int nr_of_certs)
 {
-  if (nr_of_certs < -2)
+  if (nr_of_certs == GPGME_INCLUDE_CERTS_DEFAULT)
+    ctx->include_certs = GPGME_INCLUDE_CERTS_DEFAULT;
+  else if (nr_of_certs < -2)
     ctx->include_certs = -2;
   else
     ctx->include_certs = nr_of_certs;
Index: gpgme/gpgme/gpgme.h
diff -u gpgme/gpgme/gpgme.h:1.149.2.3 gpgme/gpgme/gpgme.h:1.149.2.4
--- gpgme/gpgme/gpgme.h:1.149.2.3	Thu Apr 21 09:12:18 2005
+++ gpgme/gpgme/gpgme.h	Sat May 28 22:10:37 2005
@@ -705,6 +705,9 @@
 /* Return non-zero if text mode is set in CTX.  */
 int gpgme_get_textmode (gpgme_ctx_t ctx);
 
+/* Use whatever the default of the backend crypto engine is.  */
+#define GPGME_INCLUDE_CERTS_DEFAULT	-256
+
 /* Include up to NR_OF_CERTS certificates in an S/MIME message.  */
 void gpgme_set_include_certs (gpgme_ctx_t ctx, int nr_of_certs);
 
Index: gpgme/gpgme/w32-io.c
diff -u gpgme/gpgme/w32-io.c:1.29.2.1 gpgme/gpgme/w32-io.c:1.29.2.2
--- gpgme/gpgme/w32-io.c:1.29.2.1	Tue Dec  7 22:11:53 2004
+++ gpgme/gpgme/w32-io.c	Sat May 28 22:10:37 2005
@@ -1085,7 +1085,7 @@
             int k, j = handle_to_fd (waitbuf[i]);
                     
             DEBUG1 ("WFMO invalid handle %d removed\n", j);
-            for (k=0 ; k < nfds; i++ ) {
+            for (k=0 ; k < nfds; k++ ) {
                 if ( fds[k].fd == j ) {
                     fds[k].for_read = fds[k].for_write = 0;
                     goto restart;
Index: gpgme/gpgme/wait-global.c
diff -u gpgme/gpgme/wait-global.c:1.10.2.1 gpgme/gpgme/wait-global.c:1.10.2.2
--- gpgme/gpgme/wait-global.c:1.10.2.1	Tue Dec  7 22:11:53 2004
+++ gpgme/gpgme/wait-global.c	Sat May 28 22:10:37 2005
@@ -1,6 +1,6 @@
 /* wait-global.c 
    Copyright (C) 2000 Werner Koch (dd9jn)
-   Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH
+   Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH
  
    This file is part of GPGME.
  
@@ -331,13 +331,15 @@
       LOCK (ctx_list_lock);
       for (li = ctx_active_list; li; li = li->next)
 	{
-	  for (i = 0; i < ctx->fdt.size; i++)
-	    if (ctx->fdt.fds[i].fd != -1)
+	  gpgme_ctx_t actx = li->ctx;
+
+	  for (i = 0; i < actx->fdt.size; i++)
+	    if (actx->fdt.fds[i].fd != -1)
 	      break;
-	  if (i == ctx->fdt.size)
+	  if (i == actx->fdt.size)
 	    {
 	      gpgme_error_t err = 0;
-	      _gpgme_engine_io_event (ctx->engine, GPGME_EVENT_DONE, &err);
+	      _gpgme_engine_io_event (actx->engine, GPGME_EVENT_DONE, &err);
 	    }
 	}
       UNLOCK (ctx_list_lock);
@@ -350,6 +352,12 @@
 	    ctx = dctx;
 	    hang = 0;
 	  }
+	else if (!hang)
+	  {
+	    ctx = NULL;
+	    if (status)
+	      *status = 0;
+	  }
       }
     }
   while (hang);




More information about the Gnupg-commits mailing list