[svn] gpgme - r1222 - in trunk: . assuan gpgme

svn author marcus cvs at cvs.gnupg.org
Sun Jul 8 17:46:42 CEST 2007


Author: marcus
Date: 2007-07-08 17:46:10 +0200 (Sun, 08 Jul 2007)
New Revision: 1222

Modified:
   trunk/ChangeLog
   trunk/assuan/ChangeLog
   trunk/assuan/Makefile.am
   trunk/assuan/assuan-connect.c
   trunk/assuan/assuan-defs.h
   trunk/assuan/assuan.h
   trunk/configure.ac
   trunk/gpgme/ChangeLog
   trunk/gpgme/engine-gpgsm.c
   trunk/gpgme/funopen.c
Log:
2007-07-08  Marcus Brinkmann  <marcus at g10code.de>

	* configure.ac (GPGSM_DEFAULT) [*-mingw32*]: Initialize it.
	(HAVE_ASSUAN_H): Set to 1 if we have it.
	(funopen): Use AC_REPLACE_FUNCS.
	(USE_DESCRIPTOR_PASSING): Define to 1 if we have it.  Do not
	define it at all if we don't.
	(NETLIBS) [have_w32_system]: Add -lws2_32.
	(DIRSEP_C, DIRSEP_S, EXPSEP_C, EXPSEP_S, PATHSEP_S)
	[HAVE_DOSISH_SYSTEM]: Remove definitions.

	* assuan/assuan.h (_assuan_funopen): Define to _gpgme_funopen.
	* assuan/funopen.c: Move to ../gpgme/funopen.c.
	* assuan/Makefile.am (libassuan_la_SOURCES): Remove funopen.c.

assuan/
2007-07-08  Marcus Brinkmann  <marcus at g10code.de>

	* assuan-defs.h (struct assuan_context_s): Have partial peercred
	structure even if HAVE_W32_SYSTEM, and have full peercred
	structure only if HAVE_SO_PEERCRED.
	* assuan-connect.c (assuan_get_peercred) [!HAVE_SO_PEERCRED]: Do
	not try to set PID, UID and GID.

gpgme/
2007-07-08  Marcus Brinkmann  <marcus at g10code.de>

	* engine-gpgsm.c [HAVE_W32_SYSTEM]: Enable the bunch of the file.
	* funopen.c (funopen): Rename to _gpgme_funopen.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-07-04 21:07:27 UTC (rev 1221)
+++ trunk/ChangeLog	2007-07-08 15:46:10 UTC (rev 1222)
@@ -1,3 +1,18 @@
+2007-07-08  Marcus Brinkmann  <marcus at g10code.de>
+
+	* configure.ac (GPGSM_DEFAULT) [*-mingw32*]: Initialize it.
+	(HAVE_ASSUAN_H): Set to 1 if we have it.
+	(funopen): Use AC_REPLACE_FUNCS.
+	(USE_DESCRIPTOR_PASSING): Define to 1 if we have it.  Do not
+	define it at all if we don't.
+	(NETLIBS) [have_w32_system]: Add -lws2_32.
+	(DIRSEP_C, DIRSEP_S, EXPSEP_C, EXPSEP_S, PATHSEP_S)
+	[HAVE_DOSISH_SYSTEM]: Remove definitions.
+
+	* assuan/assuan.h (_assuan_funopen): Define to _gpgme_funopen.
+	* assuan/funopen.c: Move to ../gpgme/funopen.c.
+	* assuan/Makefile.am (libassuan_la_SOURCES): Remove funopen.c.
+
 2007-07-04  Marcus Brinkmann  <marcus at g10code.de>
 
 	* assuan/Makefile.am (INCLUDES): Include $(top_srcdir)/gpgme.  *

Modified: trunk/assuan/ChangeLog
===================================================================
--- trunk/assuan/ChangeLog	2007-07-04 21:07:27 UTC (rev 1221)
+++ trunk/assuan/ChangeLog	2007-07-08 15:46:10 UTC (rev 1222)
@@ -1,3 +1,11 @@
+2007-07-08  Marcus Brinkmann  <marcus at g10code.de>
+
+	* assuan-defs.h (struct assuan_context_s): Have partial peercred
+	structure even if HAVE_W32_SYSTEM, and have full peercred
+	structure only if HAVE_SO_PEERCRED.
+	* assuan-connect.c (assuan_get_peercred) [!HAVE_SO_PEERCRED]: Do
+	not try to set PID, UID and GID.
+
 2007-07-04  Marcus Brinkmann  <marcus at g10code.de>
 
 	Change _WIN32 to HAVE_W32_SYSTEM for consistency.

Modified: trunk/assuan/Makefile.am
===================================================================
--- trunk/assuan/Makefile.am	2007-07-04 21:07:27 UTC (rev 1221)
+++ trunk/assuan/Makefile.am	2007-07-08 15:46:10 UTC (rev 1222)
@@ -45,7 +45,6 @@
 	assuan-pipe-connect.c \
 	assuan-socket-connect.c  \
 	assuan-uds.c \
-	funopen.c \
 	assuan-io.c \
 	assuan-logging.c \
 	assuan-socket.c

Modified: trunk/assuan/assuan-connect.c
===================================================================
--- trunk/assuan/assuan-connect.c	2007-07-04 21:07:27 UTC (rev 1221)
+++ trunk/assuan/assuan-connect.c	2007-07-08 15:46:10 UTC (rev 1222)
@@ -59,10 +59,10 @@
 }
 
 
+#ifndef HAVE_W32_SYSTEM
 /* Return user credentials. PID, UID and GID amy be gived as NULL if
    you are not interested in this value.  For getting the pid of the
    peer the assuan_get_pid is usually better suited. */
-#ifndef HAVE_W32_SYSTEM
 assuan_error_t
 assuan_get_peercred (assuan_context_t ctx, pid_t *pid, uid_t *uid, gid_t *gid)
 {
@@ -70,12 +70,16 @@
     return _assuan_error (ASSUAN_Invalid_Value);
   if (!ctx->peercred.valid)
     return _assuan_error (ASSUAN_General_Error);
+
+#ifdef HAVE_SO_PEERCRED
   if (pid)
     *pid = ctx->peercred.pid;
   if (uid)
     *uid = ctx->peercred.uid;
   if (gid)
     *gid = ctx->peercred.gid;
+#endif
+
   return 0;
 }
 #endif /* HAVE_W32_SYSTEM */

Modified: trunk/assuan/assuan-defs.h
===================================================================
--- trunk/assuan/assuan-defs.h	2007-07-04 21:07:27 UTC (rev 1221)
+++ trunk/assuan/assuan-defs.h	2007-07-08 15:46:10 UTC (rev 1222)
@@ -140,14 +140,14 @@
   int listen_fd;  /* The fd we are listening on (used by socket servers) */
   int connected_fd; /* helper */
 
-#ifndef HAVE_W32_SYSTEM
   struct {
     int valid;   /* Whether this structure has valid information. */
+#ifdef HAVE_SO_PEERCRED
     pid_t pid;     /* The pid of the peer. */
     uid_t uid;     /* The uid of the peer. */
     gid_t gid;     /* The gid of the peer. */
+#endif /* HAVE_SO_PEERCRED */
   } peercred;
-#endif /* HAVE_W32_SYSTEM */
 
   /* Used for Unix domain sockets.  */
   struct sockaddr_un myaddr;

Modified: trunk/assuan/assuan.h
===================================================================
--- trunk/assuan/assuan.h	2007-07-04 21:07:27 UTC (rev 1221)
+++ trunk/assuan/assuan.h	2007-07-08 15:46:10 UTC (rev 1222)
@@ -185,6 +185,7 @@
 #define _assuan_sock_bind _ASSUAN_PREFIX(_assuan_sock_bind)
 #define _assuan_sock_connect _ASSUAN_PREFIX(_assuan_sock_connect)
 
+#define _assuan_funopen _gpgme_funopen
 #endif /*_ASSUAN_EXT_SYM_PREFIX*/
 
 

Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac	2007-07-04 21:07:27 UTC (rev 1221)
+++ trunk/configure.ac	2007-07-08 15:46:10 UTC (rev 1222)
@@ -123,8 +123,7 @@
 	have_dosish_system=yes
         have_w32_system=yes
         GPG_DEFAULT='c:\\gnupg\\gpg.exe'
-	# XXX Assuan is not supported in this configuration.
-	#GPGSM_DEFAULT='c:\\gnupg\\gpgsm.exe'
+	GPGSM_DEFAULT='c:\\gnupg\\gpgsm.exe'
         #component_system='COM+'
         ;;
     *)
@@ -467,18 +466,17 @@
 # FIXME: Only build if supported.
 AM_CONDITIONAL(BUILD_ASSUAN, test "$GPGSM" != "no")
 if test "$GPGSM" != "no"; then
-  AC_DEFINE(HAVE_ASSUAN_H, ,[Defined if we are building with assuan support.])
+  AC_DEFINE(HAVE_ASSUAN_H, 1,
+            [Defined if we are building with assuan support.])
 fi
 
-# The assuan code uses funopen but it will also build without it.  So
-# test for it.  Frankly, this is not required in gpgme, but thats the
-# way we handle it in libassuan.
+# Check for funopen
 AC_CHECK_FUNCS(funopen)
 if test $ac_cv_func_funopen != yes; then
     # No funopen but we can implement that in terms of fopencookie.
     AC_CHECK_FUNCS(fopencookie)
     if test $ac_cv_func_fopencookie = yes; then
-        AC_LIBOBJ([funopen])
+        AC_REPLACE_FUNCS(funopen)
     else
         AC_MSG_WARN([
 ***
@@ -529,13 +527,10 @@
 fi
 
 if test "$use_descriptor_passing" = "yes"; then
-  fd_passing=1
-else
-  fd_passing=0
+AC_DEFINE(USE_DESCRIPTOR_PASSING,1,
+          [Defined if descriptor passing is enabled and supported])
 fi
 
-AC_DEFINE_UNQUOTED(USE_DESCRIPTOR_PASSING, $fd_passing,
-          [Defined if descriptor passing is enabled and supported])
 AM_CONDITIONAL(USE_DESCRIPTOR_PASSING, test "$use_descriptor_passing" = "yes")
 
 # Assuan check for the getsockopt SO_PEERCRED
@@ -554,6 +549,10 @@
             [Defined if SO_PEERCRED is supported (Linux specific)])
 fi
 
+if test "$have_w32_system" = yes; then
+   NETLIBS="-lws2_32 $NETLIBS"
+fi
+
 # End of assuan checks.
 
 AM_CONDITIONAL(BUILD_COMPLUS, test "$component_system" = "COM+")
@@ -581,23 +580,11 @@
 # Add a few constants to help porting to W32
 AH_VERBATIM([SEPCONSTANTS],
 [
-/* Separators as used in file names and $PATH. Please note that the
-   string version must not contain more than one character because
-   the using code assumes strlen()==1 */
+/* Separators as used in $PATH.  */
 #ifdef HAVE_DOSISH_SYSTEM
-#define DIRSEP_C '\\\\'
-#define EXTSEP_C '.'
-#define DIRSEP_S "\\\\"
-#define EXTSEP_S "."
 #define PATHSEP_C ';'
-#define PATHSEP_S ";"
 #else
-#define DIRSEP_C '/'
-#define EXTSEP_C '.'
-#define DIRSEP_S "/"
-#define EXTSEP_S "."
 #define PATHSEP_C ':'
-#define PATHSEP_S ":"
 #endif
 ])
 

Modified: trunk/gpgme/ChangeLog
===================================================================
--- trunk/gpgme/ChangeLog	2007-07-04 21:07:27 UTC (rev 1221)
+++ trunk/gpgme/ChangeLog	2007-07-08 15:46:10 UTC (rev 1222)
@@ -1,3 +1,8 @@
+2007-07-08  Marcus Brinkmann  <marcus at g10code.de>
+
+	* engine-gpgsm.c [HAVE_W32_SYSTEM]: Enable the bunch of the file.
+	* funopen.c (funopen): Rename to _gpgme_funopen.
+
 2007-04-30  Marcus Brinkmann  <marcus at g10code.de>
 
 	* engine-gpgsm.c (gpgsm_new): Fix error handling for ttyname_r.

Modified: trunk/gpgme/engine-gpgsm.c
===================================================================
--- trunk/gpgme/engine-gpgsm.c	2007-07-04 21:07:27 UTC (rev 1221)
+++ trunk/gpgme/engine-gpgsm.c	2007-07-08 15:46:10 UTC (rev 1222)
@@ -23,8 +23,6 @@
 #include <config.h>
 #endif
 
-#ifndef HAVE_W32_SYSTEM
-
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
@@ -1749,5 +1747,3 @@
     gpgsm_io_event,
     gpgsm_cancel
   };
-
-#endif /*!HAVE_W32_SYSTEM*/

Modified: trunk/gpgme/funopen.c
===================================================================
--- trunk/gpgme/funopen.c	2007-07-04 21:07:27 UTC (rev 1221)
+++ trunk/gpgme/funopen.c	2007-07-08 15:46:10 UTC (rev 1222)
@@ -24,19 +24,39 @@
 
 #include <stdio.h>
 
+
+/* Replacement for the *BSD function:
+
+  FILE *funopen (void *cookie,
+                 int (*readfn)(void *, char *, int),
+                 int (*writefn)(void *, const char *, int),
+                 fpos_t (*seekfn)(void *, fpos_t, int),
+                 int (*closefn)(void *));
+
+  The functions to provide my either be NULL if not required or
+  similar to the unistd function with the exception of using the
+  cookie instead of the fiel descripor.
+*/
+
+
 #ifdef HAVE_FOPENCOOKIE
 FILE *
-funopen(const void *cookie, cookie_read_function_t *readfn,
-	cookie_write_function_t *writefn,
-	cookie_seek_function_t *seekfn,
-	cookie_close_function_t *closefn)
+_gpgme_funopen(void *cookie,
+                cookie_read_function_t *readfn,
+                cookie_write_function_t *writefn,
+                cookie_seek_function_t *seekfn,
+                cookie_close_function_t *closefn)
 {
-  cookie_io_functions_t io = { read: readfn, write: writefn, 
-			       seek: seekfn, close: closefn };
+  cookie_io_functions_t io = { NULL };
 
-  return fopencookie ((void *) cookie,
-		      readfn ? (writefn ? "rw" : "r")
-		      : (writefn ? "w" : ""), io);
+  io.read = readfn;
+  io.write = writefn;
+  io.seek = seekfn;
+  io.close = closefn;
+
+  return fopencookie (cookie,
+		      readfn ? ( writefn ? "rw" : "r" )
+		      : ( writefn ? "w" : ""), io);
 }
 #else
 #error No known way to implement funopen.




More information about the Gnupg-commits mailing list