[svn] gpgme - r1372 - in trunk: . src tests tests/gpg

svn author wk cvs at cvs.gnupg.org
Tue Jun 9 18:01:02 CEST 2009


Author: wk
Date: 2009-06-09 18:01:02 +0200 (Tue, 09 Jun 2009)
New Revision: 1372

Modified:
   trunk/NEWS
   trunk/src/ChangeLog
   trunk/src/gpgme.c
   trunk/src/gpgme.def
   trunk/src/gpgme.h.in
   trunk/src/libgpgme.vers
   trunk/src/version.c
   trunk/tests/ChangeLog
   trunk/tests/gpg/Makefile.am
   trunk/tests/gpg/mkdemodirs.in
   trunk/tests/gpg/t-edit.c
Log:
Add gpgme_io_write and gpgme_io_read.
Minor cleanups.


Modified: trunk/src/ChangeLog
===================================================================
--- trunk/src/ChangeLog	2009-06-09 12:44:35 UTC (rev 1371)
+++ trunk/src/ChangeLog	2009-06-09 16:01:02 UTC (rev 1372)
@@ -1,5 +1,12 @@
 2009-06-09  Werner Koch  <wk at g10code.com>
 
+	* version.c (gpgme_check_version_internal): Make result const.
+
+	* gpgme.c: Include priv-io.h.
+	(gpgme_io_read, gpgme_io_write): New.
+	* libgpgme.vers (GPGME_1.1): Add them. 
+	* gpgme.def: Ditto.
+
 	* Makefile.am (main_sources): Remove gpgme.h.
 	(include_HEADERS): Rename to nodist_include_HEADERS so that a
 	VPATH build won't use the distributed one.

Modified: trunk/tests/ChangeLog
===================================================================
--- trunk/tests/ChangeLog	2009-06-09 12:44:35 UTC (rev 1371)
+++ trunk/tests/ChangeLog	2009-06-09 16:01:02 UTC (rev 1372)
@@ -1,3 +1,12 @@
+2009-06-09  Werner Koch  <wk at g10code.com>
+
+	* gpg/Makefile.am (./pubring.gpg): Ignore errors in case of
+	already imported keys.  Add --no-permission-warning and remove
+	obsolete --allow-secret-key-import.
+	* gpg/mkdemodirs.in (GPG): Add --no-permission-warning.
+
+	* gpg/t-edit.c (edit_fnc): Use gpgme_io_write.
+
 2009-04-19  Moritz  <moritz at gnu.org>
 
 	* gpg/Makefile.am (EXTRA_DIST): Replaced mkdemodirs with mkdemodirs.in.

Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2009-06-09 12:44:35 UTC (rev 1371)
+++ trunk/NEWS	2009-06-09 16:01:02 UTC (rev 1372)
@@ -8,6 +8,10 @@
    selftest failed (for example, if -mms-bitfields was not used on
    MingW32 targets).
 
+ * New functions gpgme_io_read and gpgme_io_write for use with
+   gpgme_passphrase_cb_t and gpgme_edit_cb_t functions.
+
+
  * Interface changes relative to the 1.1.7 release:
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  GPGME_KEYLIST_MODE_EPHEMERAL   NEW.
@@ -22,6 +26,8 @@
  GPGME_ENCRYPT_NO_ENCRYPT_TO    NEW.
  gpgme_check_version            CHANGED: Is now a macro.
  gpgme_new                      EXTENDED: More failure codes.
+ gpgme_io_read                  NEW.
+ gpgme_io_write                 NEW.
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 

Modified: trunk/src/gpgme.c
===================================================================
--- trunk/src/gpgme.c	2009-06-09 12:44:35 UTC (rev 1371)
+++ trunk/src/gpgme.c	2009-06-09 16:01:02 UTC (rev 1372)
@@ -34,6 +34,7 @@
 #include "ops.h"
 #include "wait.h"
 #include "debug.h"
+#include "priv-io.h"
 
 
 /* The default locale.  */
@@ -428,6 +429,33 @@
 }
 
 
+/* This function provides access to the internal read function; it is
+   normally not used. */
+ssize_t
+gpgme_io_read (int fd, void *buffer, size_t count)
+{
+  int ret;
+
+  ret = _gpgme_io_read (fd, buffer, count);
+
+  return ret;
+}
+
+
+/* This function provides access to the internal write function.  It
+   is to be used by user callbacks to return data to gpgme.  See
+   gpgme_passphrase_cb_t and gpgme_edit_cb_t.  */
+ssize_t
+gpgme_io_write (int fd, const void *buffer, size_t count)
+{
+  int ret;
+
+  ret = _gpgme_io_write (fd, buffer, count);
+
+  return ret;
+}
+
+
 /* This function returns the callback function for I/O.  */
 void
 gpgme_get_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs)

Modified: trunk/src/gpgme.def
===================================================================
--- trunk/src/gpgme.def	2009-06-09 12:44:35 UTC (rev 1371)
+++ trunk/src/gpgme.def	2009-06-09 16:01:02 UTC (rev 1372)
@@ -173,6 +173,10 @@
     gpgme_op_assuan_transact              @134
 
     gpgme_check_version_internal	  @135
+    
+    gpgme_io_read                         @136
+    gpgme_io_write                        @137
 
+
 ; END
 

Modified: trunk/src/gpgme.h.in
===================================================================
--- trunk/src/gpgme.h.in	2009-06-09 12:44:35 UTC (rev 1371)
+++ trunk/src/gpgme.h.in	2009-06-09 16:01:02 UTC (rev 1372)
@@ -961,6 +961,11 @@
 /* Get the current I/O callback functions.  */
 void gpgme_get_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs);
 
+/* Wrappers around the internal I/O functions for use with
+   gpgme_passphrase_cb_t and gpgme_edit_cb_t.  */
+ssize_t gpgme_io_read (int fd, void *buffer, size_t count);
+ssize_t gpgme_io_write (int fd, const void *buffer, size_t count);
+
 /* Process the pending operation and, if HANG is non-zero, wait for
    the pending operation to finish.  */
 gpgme_ctx_t gpgme_wait (gpgme_ctx_t ctx, gpgme_error_t *status, int hang);

Modified: trunk/src/libgpgme.vers
===================================================================
--- trunk/src/libgpgme.vers	2009-06-09 12:44:35 UTC (rev 1371)
+++ trunk/src/libgpgme.vers	2009-06-09 16:01:02 UTC (rev 1372)
@@ -53,6 +53,10 @@
     gpgme_op_assuan_transact_start;    
 
     gpgme_check_version_internal;
+
+    gpgme_io_read;
+    gpgme_io_write;
+    
 };
 
 

Modified: trunk/src/version.c
===================================================================
--- trunk/src/version.c	2009-06-09 12:44:35 UTC (rev 1371)
+++ trunk/src/version.c	2009-06-09 16:01:02 UTC (rev 1372)
@@ -213,7 +213,7 @@
 gpgme_check_version_internal (const char *req_version,
 			      size_t offset_sig_validity)
 {
-  char *result;
+  const char *result;
 
   TRACE2 (DEBUG_INIT, "gpgme_check_version_internal: ", 0,
 	  "req_version=%s, offset_sig_validity=%i",

Modified: trunk/tests/gpg/Makefile.am
===================================================================
--- trunk/tests/gpg/Makefile.am	2009-06-09 12:44:35 UTC (rev 1371)
+++ trunk/tests/gpg/Makefile.am	2009-06-09 16:01:02 UTC (rev 1372)
@@ -63,8 +63,9 @@
 all-local: ./pubring.gpg ./gpg.conf ./gpg-agent.conf
 
 ./pubring.gpg: $(srcdir)/pubdemo.asc ./Alpha/Secret.gpg 
-	$(GPG) --homedir . --import $(srcdir)/pubdemo.asc
-	$(GPG) --homedir . --allow-secret-key-import \
+	-$(GPG) --homedir . --no-permission-warning \
+                --import $(srcdir)/pubdemo.asc
+	-$(GPG) --homedir . --no-permission-warning \
 		--import Alpha/Secret.gpg Zulu/Secret.gpg
 
 ./Alpha/Secret.gpg: mkdemodirs secdemo.asc 

Modified: trunk/tests/gpg/mkdemodirs.in
===================================================================
--- trunk/tests/gpg/mkdemodirs.in	2009-06-09 12:44:35 UTC (rev 1371)
+++ trunk/tests/gpg/mkdemodirs.in	2009-06-09 16:01:02 UTC (rev 1372)
@@ -19,7 +19,7 @@
 
 set -e
 
-GPG="@GPG@ --batch --quiet --no-secmem-warning"
+GPG="@GPG@ --batch --quiet --no-secmem-warning --no-permission-warning"
 NAMES='Alpha Bravo Charlie Delta Echo Foxtrot Golf Hotel India
        Juliet Kilo Lima Mike November Oscar Papa Quebec Romeo
        Sierra Tango Uniform Victor Whisky XRay Yankee Zulu'
@@ -45,7 +45,7 @@
     [ -d $name ] && rm -r $name
     mkdir $name
     $GPGDEMO --export-secret-key -o - $name > $name/Secret.gpg
-    $GPG --homedir $name --allow-secret-key-import --import $name/Secret.gpg
+    $GPG --homedir $name --import $name/Secret.gpg
     $GPGDEMO --export -o - $name > $name/Public.gpg
     $GPG --homedir $name --import $name/Public.gpg
     [ -f $name/pubring.gpg~ ] && rm $name/pubring.gpg~

Modified: trunk/tests/gpg/t-edit.c
===================================================================
--- trunk/tests/gpg/t-edit.c	2009-06-09 12:44:35 UTC (rev 1371)
+++ trunk/tests/gpg/t-edit.c	2009-06-09 16:01:02 UTC (rev 1372)
@@ -103,8 +103,8 @@
 
   if (result)
     {
-      write (fd, result, strlen (result));
-      write (fd, "\n", 1);
+      gpgme_io_write (fd, result, strlen (result));
+      gpgme_io_write (fd, "\n", 1);
     }
   return 0;
 }




More information about the Gnupg-commits mailing list