2007-07-08 Marcus Brinkmann <marcus@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@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@g10code.de>

	* engine-gpgsm.c [HAVE_W32_SYSTEM]: Enable the bunch of the file.
	* funopen.c (funopen): Rename to _gpgme_funopen.
This commit is contained in:
Marcus Brinkmann 2007-07-08 15:46:10 +00:00
parent 2d7cfe08b0
commit 5b8e76a533
10 changed files with 77 additions and 42 deletions

View File

@ -1,3 +1,18 @@
2007-07-08 Marcus Brinkmann <marcus@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@g10code.de>
* assuan/Makefile.am (INCLUDES): Include $(top_srcdir)/gpgme. *

View File

@ -1,3 +1,11 @@
2007-07-08 Marcus Brinkmann <marcus@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@g10code.de>
Change _WIN32 to HAVE_W32_SYSTEM for consistency.

View File

@ -45,7 +45,6 @@ libassuan_la_SOURCES = \
assuan-pipe-connect.c \
assuan-socket-connect.c \
assuan-uds.c \
funopen.c \
assuan-io.c \
assuan-logging.c \
assuan-socket.c

View File

@ -59,10 +59,10 @@ assuan_get_pid (assuan_context_t ctx)
}
#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 @@ assuan_get_peercred (assuan_context_t ctx, pid_t *pid, uid_t *uid, gid_t *gid)
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 */

View File

@ -140,14 +140,14 @@ struct assuan_context_s
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;

View File

@ -185,6 +185,7 @@ int _gpgme_io_recvmsg (int sock, struct msghdr *msg, int flags);
#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*/

View File

@ -123,8 +123,7 @@ case "${host}" in
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 @@ AM_CONDITIONAL(RUN_GPGSM_TESTS, test "$run_gpgsm_test" = "yes")
# 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 @@ if test "$supports_descriptor_passing" != "yes"; then
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 @@ if test $assuan_cv_sys_so_peercred = yes; then
[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 @@ AC_SUBST(BUILD_FILEVERSION)
# 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
])

View File

@ -1,3 +1,8 @@
2007-07-08 Marcus Brinkmann <marcus@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@g10code.de>
* engine-gpgsm.c (gpgsm_new): Fix error handling for ttyname_r.

View File

@ -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 @@ struct engine_ops _gpgme_engine_ops_gpgsm =
gpgsm_io_event,
gpgsm_cancel
};
#endif /*!HAVE_W32_SYSTEM*/

View File

@ -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.