From: Marcus Brinkmann Date: Sun, 8 Jul 2007 15:46:10 +0000 (+0000) Subject: 2007-07-08 Marcus Brinkmann X-Git-Tag: gpgme-1.2.0@1385~162 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3e8e05d2734b7d52d9eab063c991c6ebe18d4045;p=gpgme.git 2007-07-08 Marcus Brinkmann * 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 * 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 * engine-gpgsm.c [HAVE_W32_SYSTEM]: Enable the bunch of the file. * funopen.c (funopen): Rename to _gpgme_funopen. --- diff --git a/trunk/ChangeLog b/trunk/ChangeLog index 9e05294..94007a2 100644 --- a/trunk/ChangeLog +++ b/trunk/ChangeLog @@ -1,3 +1,18 @@ +2007-07-08 Marcus Brinkmann + + * 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 * assuan/Makefile.am (INCLUDES): Include $(top_srcdir)/gpgme. * diff --git a/trunk/assuan/ChangeLog b/trunk/assuan/ChangeLog index 2a4611e..0df0a79 100644 --- a/trunk/assuan/ChangeLog +++ b/trunk/assuan/ChangeLog @@ -1,3 +1,11 @@ +2007-07-08 Marcus Brinkmann + + * 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 Change _WIN32 to HAVE_W32_SYSTEM for consistency. diff --git a/trunk/assuan/Makefile.am b/trunk/assuan/Makefile.am index dc5baf9..4607bc7 100644 --- a/trunk/assuan/Makefile.am +++ b/trunk/assuan/Makefile.am @@ -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 diff --git a/trunk/assuan/assuan-connect.c b/trunk/assuan/assuan-connect.c index 15fc51b..b50b17b 100644 --- a/trunk/assuan/assuan-connect.c +++ b/trunk/assuan/assuan-connect.c @@ -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 */ diff --git a/trunk/assuan/assuan-defs.h b/trunk/assuan/assuan-defs.h index 33cdfa3..b1d9f3e 100644 --- a/trunk/assuan/assuan-defs.h +++ b/trunk/assuan/assuan-defs.h @@ -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; diff --git a/trunk/assuan/assuan.h b/trunk/assuan/assuan.h index 9bad258..33f14cf 100644 --- a/trunk/assuan/assuan.h +++ b/trunk/assuan/assuan.h @@ -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*/ diff --git a/trunk/configure.ac b/trunk/configure.ac index dc67682..2e97ee0 100644 --- a/trunk/configure.ac +++ b/trunk/configure.ac @@ -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 ]) diff --git a/trunk/gpgme/ChangeLog b/trunk/gpgme/ChangeLog index b690087..3b538ef 100644 --- a/trunk/gpgme/ChangeLog +++ b/trunk/gpgme/ChangeLog @@ -1,3 +1,8 @@ +2007-07-08 Marcus Brinkmann + + * engine-gpgsm.c [HAVE_W32_SYSTEM]: Enable the bunch of the file. + * funopen.c (funopen): Rename to _gpgme_funopen. + 2007-04-30 Marcus Brinkmann * engine-gpgsm.c (gpgsm_new): Fix error handling for ttyname_r. diff --git a/trunk/gpgme/engine-gpgsm.c b/trunk/gpgme/engine-gpgsm.c index 02f506c..d43a480 100644 --- a/trunk/gpgme/engine-gpgsm.c +++ b/trunk/gpgme/engine-gpgsm.c @@ -23,8 +23,6 @@ #include #endif -#ifndef HAVE_W32_SYSTEM - #include #include #include @@ -1749,5 +1747,3 @@ struct engine_ops _gpgme_engine_ops_gpgsm = gpgsm_io_event, gpgsm_cancel }; - -#endif /*!HAVE_W32_SYSTEM*/ diff --git a/trunk/gpgme/funopen.c b/trunk/gpgme/funopen.c index 55b3223..a20dd8a 100644 --- a/trunk/gpgme/funopen.c +++ b/trunk/gpgme/funopen.c @@ -24,19 +24,39 @@ #include + +/* 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 }; + + io.read = readfn; + io.write = writefn; + io.seek = seekfn; + io.close = closefn; - return fopencookie ((void *) cookie, - readfn ? (writefn ? "rw" : "r") - : (writefn ? "w" : ""), io); + return fopencookie (cookie, + readfn ? ( writefn ? "rw" : "r" ) + : ( writefn ? "w" : ""), io); } #else #error No known way to implement funopen.