diff options
| author | Werner Koch <[email protected]> | 2011-02-03 19:51:36 +0000 | 
|---|---|---|
| committer | Werner Koch <[email protected]> | 2011-02-03 19:51:36 +0000 | 
| commit | b001a8df68c8eb33abbe879f6c7fb4db4909b6f6 (patch) | |
| tree | 800d5a8dba5aeaf953c50ede3c10669b8ef48cf2 | |
| parent | Add support for non-API GnuPG status codes. (diff) | |
| parent | Fix socket implementation on Windows. (diff) | |
| download | gpgme-b001a8df68c8eb33abbe879f6c7fb4db4909b6f6.tar.gz gpgme-b001a8df68c8eb33abbe879f6c7fb4db4909b6f6.zip | |
Merge branch 'master' of git+ssh://playfair.gnupg.org/git/gpgme
| -rw-r--r-- | ChangeLog | 4 | ||||
| -rw-r--r-- | configure.ac | 2 | ||||
| -rw-r--r-- | src/ChangeLog | 303 | ||||
| -rw-r--r-- | src/assuan-support.c | 19 | ||||
| -rw-r--r-- | src/engine-gpgconf.c | 8 | ||||
| -rw-r--r-- | src/priv-io.h | 1 | ||||
| -rw-r--r-- | src/w32-io.c | 54 | ||||
| -rw-r--r-- | src/w32-util.c | 30 | 
8 files changed, 216 insertions, 205 deletions
| @@ -1,3 +1,7 @@ +2011-02-02  Marcus Brinkmann  <[email protected]> + +	* configure.ac (NEED_LIBASSUAN_VERSION): Bump to 2.0.2 for system hooks. +  2010-12-30  Werner Koch  <[email protected]>  	* configure.ac: Support a git revision. diff --git a/configure.ac b/configure.ac index 66b794cc..d515d544 100644 --- a/configure.ac +++ b/configure.ac @@ -62,7 +62,7 @@ GPGME_CONFIG_API_VERSION=1  ##############################################  NEED_LIBASSUAN_API=2 -NEED_LIBASSUAN_VERSION=2.0.0 +NEED_LIBASSUAN_VERSION=2.0.2  m4_define([git_brevis],m4_esyscmd(printf "%u" 0x[]m4_substr(git_revision,0,4))) diff --git a/src/ChangeLog b/src/ChangeLog index 9b1ef8d5..94200bc3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -5,6 +5,31 @@  	* Makefile.am (main_sources): Add extra-stati.h  	(status-table.h): Depend on extra-stati.h and adjust rule. +2011-02-03  Marcus Brinkmann  <[email protected]> + +	* w32-io.c (_gpgme_io_socket): Return fd, not res. + +2011-02-02  Marcus Brinkmann  <[email protected]> + +	* assuan-support.c (my_socket, my_connect): New functions. +	(_gpgme_assuan_system_hooks): Add my_Socket, my_connect. +	* priv-io.h (_gpgme_io_socket): New prototype. +	* w32-io.c (pid_to_handle, handle_to_oid, fd_to_handle): Remove macros. +	(is_socket): Remove function. +	(_gpgme_io_spawn) [HAVE_W32CE_SYSTEM]: Remove some dead code. +	(_gpgme_io_spawn): Translate handles before DuplicateHandle them. +	 +2011-02-02  Marcus Brinkmann  <[email protected]> + +	* w32-util.c (mkstemp): Don't use CreateFile instead of open (the +	function is not used on Windows CE, and the callers were not +	adjusted). + +2011-01-21  Marcus Brinkmann  <[email protected]> + +	* engine-gpgconf.c (_gpgme_conf_opt_change): Fix the case that is +	not self-assignment. +  2010-12-08  Werner Koch  <[email protected]>  	* gpgme-tool.c (strcpy_escaped_plus): New. @@ -1467,6 +1492,10 @@  	* op-support.c (_gpgme_op_reset): Implement a no-reset flag.  	* getauditlog.c (getauditlog_start): Use that flag. +2007-11-20  Werner Koch  <[email protected]> + +	* op-support.c (_gpgme_parse_inv_recp): Add new reason code 11. +  2007-11-22  Werner Koch  <[email protected]>  	* gpgme.h (gpgme_op_getauditlog_start, gpgme_op_getauditlog): New. @@ -1479,10 +1508,6 @@  	(gpgsm_new): Try to enable audit log support.  	* rungpg.c (_gpgme_engine_ops_gpg): Insert dummy entry. -2007-11-20  Werner Koch  <[email protected]> - -	* op-support.c (_gpgme_parse_inv_recp): Add new reason code 11. -  2007-11-12  Marcus Brinkmann  <[email protected]>  	* kdpipeiodevice.cpp: New version from Frank Osterfeld. @@ -2256,24 +2281,6 @@  	* w32-io.c (_gpgme_io_read, _gpgme_io_write): Print content in  	debug mode too. -2005-08-19  Werner Koch  <[email protected]> - -	* gpgme.def: New. -	* versioninfo.rc.in: New. -	* Makefile.am: Addes support for building a W32 DLL. - -	* ttyname_r.c (ttyname_r) [W32]: Return error. -	* ath-compat.c [W32]: select and co are not yet supported; return -	error. -	* data-stream.c (stream_seek): Use ftell if ftello is not available. - -2005-08-08  Werner Koch  <[email protected]> - -	* util.h (stpcpy): Renamed to .. -	(_gpgme_stpcpy): .. this and made inline.  This avoids duplicate -	definitions when linking statically. -	* stpcpy.c: Removed. -  2005-07-27  Marcus Brinkmann  <[email protected]>  	* gpgme.h (gpgme_status_code_t): Add GPGME_STATUS_PLAINTEXT. @@ -2288,6 +2295,24 @@  	OPD->result.plaintext_filename.  	(_gpgme_verify_status_handler): Handle GPGME_STATUS_PLAINTEXT. +2005-08-08  Werner Koch  <[email protected]> + +	* util.h (stpcpy): Renamed to .. +	(_gpgme_stpcpy): .. this and made inline.  This avoids duplicate +	definitions when linking statically. +	* stpcpy.c: Removed. + +2005-08-19  Werner Koch  <[email protected]> + +	* gpgme.def: New. +	* versioninfo.rc.in: New. +	* Makefile.am: Addes support for building a W32 DLL. + +	* ttyname_r.c (ttyname_r) [W32]: Return error. +	* ath-compat.c [W32]: select and co are not yet supported; return +	error. +	* data-stream.c (stream_seek): Use ftell if ftello is not available. +  2005-07-26  Marcus Brinkmann  <[email protected]>  	* keylist.c (gpgme_get_key): Allow key IDs. @@ -4009,64 +4034,65 @@  	fail_on_pending_request.  	* util.h: Don't include "types.h" or "debug.h", but include "gpgme.h". -2003-01-30  Marcus Brinkmann  <[email protected]> +2003-01-19  Marcus Brinkmann  <[email protected]> -	* types.h (EngineObject): Move typedef to ... -	* engine.h: ... here. -	* types.h (GpgObject): Move typedef to ... -	* rungpg.c: ... here. -	* types.h (GpgsmObject): Move typedef to ... -	* engine-gpgsm.c: ... here. +	* rungpg.c (_gpgme_engine_ops_gpg): Remove gpg_start. +	(gpg_start): Rename to ... +	(start): ... this function.  Change arguments to GpgObject. +	(gpg_decrypt): Call start. +	(gpg_edit): Likewise. +	(gpg_encrypt): Likewise. +	(gpg_encrypt_sign): Likewise. +	(gpg_export): Likewise. +	(gpg_import): Likewise. +	(gpg_keylist): Likewise. +	(gpg_keylist_ext): Likewise. +	(gpg_trustlist): Likewise. +	(gpg_verify): Likewise. -	* util.h (return_if_fail, return_null_if_fail, -	return_val_if_fail): Remove macro. -	* gpgme.c (gpgme_cancel): Don't use return_if_fail. -	* key.c (gpgme_key_ref): Likewise. -	* signers.c (gpgme_signers_enum): Likewise. -	(gpgme_signers_clear): Likewise. +	* engine-gpgsm.c (_gpgme_engine_ops_encrypt): Remove gpgsm_start. +	(gpgsm_start): Rename to ... +	(struct gpgsm_object_s): Remove member command. +	(gpgsm_release): Don't free command. +	(start): ... this function.  Change arguments to GpgsmObject and +	const char *. +	(gpgsm_decrypt): Call start. +	(gpgsm_delete): Likewise. +	(gpgsm_encrypt): Likewise. +	(gpgsm_export): Likewise. +	(gpgsm_genkey): Likewise. +	(gpgsm_import): Likewise. +	(gpgsm_keylist): Likewise. +	(gpgsm_keylist_ext): Likewise. +	(gpgsm_verify): Likewise. -	* engine-backend.h (struct engine_ops): Rename get_path to -	get_file_name. -	* gpgme.h (struct _gpgme_engine_info): Rename member path to -	file_name. -	* version.c: Do not include <stdio.h>, <stdlib.h>, context.h and -	util.h.  Other clean ups. -	(parse_version_number): Protect more seriously against -	overflow. -	(gpgme_get_engine_info): Move to ... -	* engine.c (gpgme_get_engine_info): ... here. -	(_gpgme_engine_get_info): Function removed. -	(_gpgme_engine_get_path): Make static and rename to ... -	(engine_get_file_name): .. this. -	(_gpgme_engine_get_version): Make static and rename to ... -	(engine_get_version): ... this. -	(_gpgme_engine_get_req_version): Make static and rename to ... -	(engine_get_req_version): ... this. -	* engine.h (_gpgme_engine_get_path, _gpgme_engine_get_version, -	_gpgme_engine_req_version, _gpgme_engine_get_info.): Remove -	prototypes. +	* decrypt.c (_gpgme_decrypt_start): Don't call +	_gpgme_engine_start. +	* delete.c (_gpgme_op_delete_start): Likewise. +	* edit.c (_gpgme_op_edit_start): Likewise. +	* encrypt.c (_gpgme_op_encrypt_start): +	* encrypt-sign.c (_gpgme_op_encrypt_sign_start): +	* export.c (_gpgme_op_export_start): Likewise. +	* genkey.c (_gpgme_op_genkey_start): Likewise. +	* import.c (_gpgme_op_import_start): Likewise. +	* keylist.c (gpgme_op_keylist_ext_start): Likewise. +	(gpgme_op_keylist_start): Likewise. +	* sign.c (_gpgme_op_sign_start): Likewise. +	* trustlist.c (gpgme_op_trustlist_start): Likewise. +	* verify.c (_gpgme_op_verify_start): Likewise. -	* gpgme.h (enum GpgmeProtocol): Remove GPGME_PROTOCOL_AUTO. -	* gpgme.c (gpgme_set_protocol): Don't handle GPGME_PROTOCOL_AUTO. -	(gpgme_get_protocol_name): New function. +	* engine-backend.h (struct engine_ops): Remove member start. -	* engine-backend.h (struct engine_ops): New member -	get_req_version, remove member check_version. -	* engine.h (_gpgme_Engine_get_version): New prototype. -	* rungpg.c (gpg_get_req_version): New function. -	(gpg_check_version): Function removed. -	(_gpgme_engine_ops_gpg): Add gpg_get_req_version, remove -	gpg_check_version. -	* engine-gpgsm.c (gpgsm_get_req_version): New function. -	(gpgsm_check_version): Function removed. -	(_gpgme_engine_ops_gpgsm): Add gpgsm_get_req_version, remove -	gpgsm_check_version. -	* engine.c: Include ops.h. -	 (_gpgme_engine_get_req_version): New function. -	(gpgme_engine_check_version): Rewritten. -	* version.c (gpgme_get_engine_info): Rewritten. -	* gpgme.h (gpgme_engine_info): New structure. -	(GpgmeEngineInfo): New type. +	* engine.h (_gpgme_engine_start): Remove prototype. +	* engine.c (_gpgme_engine_start): Remove function. + +2003-01-19  Miguel Coca  <[email protected]> + +	* w32-io.c (_gpgme_io_select): Add missing argument in calls to +	DEBUG_BEGIN. +	* w32-util.c: Include "sema.h". +	(find_program_in_registry): Change DEBUG1 to DEBUG2, fixes compilation +	error.  2003-01-29  Marcus Brinkmann  <[email protected]> @@ -4213,65 +4239,64 @@  	* key.c (gpgme_key_sig_get_string_attr): Use validity_to_string  	instead otrust_to_string to calculate validity. -2003-01-19  Miguel Coca  <[email protected]> - -	* w32-io.c (_gpgme_io_select): Add missing argument in calls to -	DEBUG_BEGIN. -	* w32-util.c: Include "sema.h". -	(find_program_in_registry): Change DEBUG1 to DEBUG2, fixes compilation -	error. - -2003-01-19  Marcus Brinkmann  <[email protected]> +2003-01-30  Marcus Brinkmann  <[email protected]> -	* rungpg.c (_gpgme_engine_ops_gpg): Remove gpg_start. -	(gpg_start): Rename to ... -	(start): ... this function.  Change arguments to GpgObject. -	(gpg_decrypt): Call start. -	(gpg_edit): Likewise. -	(gpg_encrypt): Likewise. -	(gpg_encrypt_sign): Likewise. -	(gpg_export): Likewise. -	(gpg_import): Likewise. -	(gpg_keylist): Likewise. -	(gpg_keylist_ext): Likewise. -	(gpg_trustlist): Likewise. -	(gpg_verify): Likewise. +	* types.h (EngineObject): Move typedef to ... +	* engine.h: ... here. +	* types.h (GpgObject): Move typedef to ... +	* rungpg.c: ... here. +	* types.h (GpgsmObject): Move typedef to ... +	* engine-gpgsm.c: ... here. -	* engine-gpgsm.c (_gpgme_engine_ops_encrypt): Remove gpgsm_start. -	(gpgsm_start): Rename to ... -	(struct gpgsm_object_s): Remove member command. -	(gpgsm_release): Don't free command. -	(start): ... this function.  Change arguments to GpgsmObject and -	const char *. -	(gpgsm_decrypt): Call start. -	(gpgsm_delete): Likewise. -	(gpgsm_encrypt): Likewise. -	(gpgsm_export): Likewise. -	(gpgsm_genkey): Likewise. -	(gpgsm_import): Likewise. -	(gpgsm_keylist): Likewise. -	(gpgsm_keylist_ext): Likewise. -	(gpgsm_verify): Likewise. +	* util.h (return_if_fail, return_null_if_fail, +	return_val_if_fail): Remove macro. +	* gpgme.c (gpgme_cancel): Don't use return_if_fail. +	* key.c (gpgme_key_ref): Likewise. +	* signers.c (gpgme_signers_enum): Likewise. +	(gpgme_signers_clear): Likewise. -	* decrypt.c (_gpgme_decrypt_start): Don't call -	_gpgme_engine_start. -	* delete.c (_gpgme_op_delete_start): Likewise. -	* edit.c (_gpgme_op_edit_start): Likewise. -	* encrypt.c (_gpgme_op_encrypt_start): -	* encrypt-sign.c (_gpgme_op_encrypt_sign_start): -	* export.c (_gpgme_op_export_start): Likewise. -	* genkey.c (_gpgme_op_genkey_start): Likewise. -	* import.c (_gpgme_op_import_start): Likewise. -	* keylist.c (gpgme_op_keylist_ext_start): Likewise. -	(gpgme_op_keylist_start): Likewise. -	* sign.c (_gpgme_op_sign_start): Likewise. -	* trustlist.c (gpgme_op_trustlist_start): Likewise. -	* verify.c (_gpgme_op_verify_start): Likewise. +	* engine-backend.h (struct engine_ops): Rename get_path to +	get_file_name. +	* gpgme.h (struct _gpgme_engine_info): Rename member path to +	file_name. +	* version.c: Do not include <stdio.h>, <stdlib.h>, context.h and +	util.h.  Other clean ups. +	(parse_version_number): Protect more seriously against +	overflow. +	(gpgme_get_engine_info): Move to ... +	* engine.c (gpgme_get_engine_info): ... here. +	(_gpgme_engine_get_info): Function removed. +	(_gpgme_engine_get_path): Make static and rename to ... +	(engine_get_file_name): .. this. +	(_gpgme_engine_get_version): Make static and rename to ... +	(engine_get_version): ... this. +	(_gpgme_engine_get_req_version): Make static and rename to ... +	(engine_get_req_version): ... this. +	* engine.h (_gpgme_engine_get_path, _gpgme_engine_get_version, +	_gpgme_engine_req_version, _gpgme_engine_get_info.): Remove +	prototypes. -	* engine-backend.h (struct engine_ops): Remove member start. +	* gpgme.h (enum GpgmeProtocol): Remove GPGME_PROTOCOL_AUTO. +	* gpgme.c (gpgme_set_protocol): Don't handle GPGME_PROTOCOL_AUTO. +	(gpgme_get_protocol_name): New function. -	* engine.h (_gpgme_engine_start): Remove prototype. -	* engine.c (_gpgme_engine_start): Remove function. +	* engine-backend.h (struct engine_ops): New member +	get_req_version, remove member check_version. +	* engine.h (_gpgme_Engine_get_version): New prototype. +	* rungpg.c (gpg_get_req_version): New function. +	(gpg_check_version): Function removed. +	(_gpgme_engine_ops_gpg): Add gpg_get_req_version, remove +	gpg_check_version. +	* engine-gpgsm.c (gpgsm_get_req_version): New function. +	(gpgsm_check_version): Function removed. +	(_gpgme_engine_ops_gpgsm): Add gpgsm_get_req_version, remove +	gpgsm_check_version. +	* engine.c: Include ops.h. +	 (_gpgme_engine_get_req_version): New function. +	(gpgme_engine_check_version): Rewritten. +	* version.c (gpgme_get_engine_info): Rewritten. +	* gpgme.h (gpgme_engine_info): New structure. +	(GpgmeEngineInfo): New type.  2003-01-06  Werner Koch  <[email protected]> @@ -5218,6 +5243,10 @@  	* keylist.c (gpgme_op_keylist_ext_start): Always use our own FD  	table (eg use synchronous mode). +2002-06-27  Marcus Brinkmann  <[email protected]> + +	* gpgme.h: Fix documentation of key attribute retrieval functions. +  2002-06-28  Marcus Brinkmann  <[email protected]>  	* ops.h (_gpgme_wait_on_condition): Remove HANG argument from @@ -5240,10 +5269,6 @@  	(gpgme_op_trustlist_next): Remove HANG argument from  	_gpgme_wait_on_condition.  Check its return value. -2002-06-27  Marcus Brinkmann  <[email protected]> - -	* gpgme.h: Fix documentation of key attribute retrieval functions. -  2002-06-26  Werner Koch  <[email protected]>  	* engine-gpgsm.c (map_assuan_error): Map No_Data_Available to EOF. @@ -5847,6 +5872,12 @@  2002-02-25  Marcus Brinkmann  <[email protected]> +	* verify.c (_gpgme_verify_status_handler): Parse the args line to +	see if the problem is due to a missing key, and report that back +	to the user. + +2002-02-25  Marcus Brinkmann  <[email protected]> +  	* engine.c (_gpgme_engine_op_encrypt_sign): New function.  	* engine.h (_gpgme_engine_op_encrypt_sign): New prototype.  	* rungpg.c (_gpgme_append_gpg_args_from_signers): New function. @@ -5867,12 +5898,6 @@  2002-02-25  Marcus Brinkmann  <[email protected]> -	* verify.c (_gpgme_verify_status_handler): Parse the args line to -	see if the problem is due to a missing key, and report that back -	to the user. - -2002-02-25  Marcus Brinkmann  <[email protected]> -  	* context.h (struct gpgme_context_s): New member include_certs.  	* gpgme.h (gpgme_set_include_certs): Add prototype.  	(gpgme_get_include_certs): Likewise. diff --git a/src/assuan-support.c b/src/assuan-support.c index f49ab32b..52643467 100644 --- a/src/assuan-support.c +++ b/src/assuan-support.c @@ -222,6 +222,21 @@ my_socketpair (assuan_context_t ctx, int namespace, int style,  } +static int +my_socket (assuan_context_t ctx, int namespace, int style, int protocol) +{ +  return _gpgme_io_socket (namespace, style, protocol); +} + + +static int +my_connect (assuan_context_t ctx, int sock, struct sockaddr *addr, +	    socklen_t length) +{ +  return _gpgme_io_connect (sock, addr, length); +} + +  struct assuan_system_hooks _gpgme_assuan_system_hooks =    {      ASSUAN_SYSTEM_HOOKS_VERSION, @@ -234,6 +249,8 @@ struct assuan_system_hooks _gpgme_assuan_system_hooks =      my_sendmsg,      my_spawn,      my_waitpid, -    my_socketpair +    my_socketpair, +    my_socket, +    my_connect    }; diff --git a/src/engine-gpgconf.c b/src/engine-gpgconf.c index d08ed03c..6807dce9 100644 --- a/src/engine-gpgconf.c +++ b/src/engine-gpgconf.c @@ -622,7 +622,7 @@ _gpgme_conf_opt_change (gpgme_conf_opt_t opt, int reset, gpgme_conf_arg_t arg)      {        if (opt->new_value)  	release_arg (opt->new_value, opt->alt_type); -     opt->new_value = NULL; +      opt->new_value = NULL;        opt->change_value = 0;      }    else @@ -630,10 +630,8 @@ _gpgme_conf_opt_change (gpgme_conf_opt_t opt, int reset, gpgme_conf_arg_t arg)        /* Support self-assignment, for example for adding an item to an  	 existing list.  */        if (opt->new_value && arg != opt->new_value) -	{ -	  release_arg (opt->new_value, opt->alt_type); -	  opt->new_value = arg; -	} +	release_arg (opt->new_value, opt->alt_type); +      opt->new_value = arg;        opt->change_value = 1;      }    return 0; diff --git a/src/priv-io.h b/src/priv-io.h index 9c70d22f..770c0617 100644 --- a/src/priv-io.h +++ b/src/priv-io.h @@ -64,6 +64,7 @@ struct io_select_fd_s  /* These function are either defined in posix-io.c or w32-io.c.  */  void _gpgme_io_subsystem_init (void); +int _gpgme_io_socket (int namespace, int style, int protocol);  int _gpgme_io_connect (int fd, struct sockaddr *addr, int addrlen);  int _gpgme_io_read (int fd, void *buffer, size_t count);  int _gpgme_io_write (int fd, const void *buffer, size_t count); diff --git a/src/w32-io.c b/src/w32-io.c index 168177e5..56a05c4b 100644 --- a/src/w32-io.c +++ b/src/w32-io.c @@ -125,9 +125,6 @@ release_fd (int fd)  } -#define pid_to_handle(a) ((HANDLE)(a)) -#define handle_to_pid(a) ((int)(a)) -#define fd_to_handle(a)  ((HANDLE)(a))  #define handle_to_fd(a)  ((int)(a))  #define READBUF_SIZE 4096 @@ -260,40 +257,6 @@ set_synchronize (HANDLE hd)  } -/* Return 1 if HD refers to a socket, 0 if it does not refer to a -   socket, and -1 for unknown (autodetect).  */ -static int -is_socket (HANDLE hd) -{ -#ifdef HAVE_W32CE_SYSTEM -  return -1; -#else -  /* We need to figure out whether we are working on a socket or on a -     handle.  A trivial way would be to check for the return code of -     recv and see if it is WSAENOTSOCK.  However the recv may block -     after the server process died and thus the destroy_reader will -     hang.  Another option is to use getsockopt to test whether it is -     a socket.  The bug here is that once a socket with a certain -     values has been opened, closed and later a CreatePipe returned -     the same value (i.e. handle), getsockopt still believes it is a -     socket.  What we do now is to use a combination of GetFileType -     and GetNamedPipeInfo.  The specs say that the latter may be used -     on anonymous pipes as well.  Note that there are claims that -     since winsocket version 2 ReadFile may be used on a socket but -     only if it is supported by the service provider.  Tests on a -     stock XP using a local TCP socket show that it does not work.  */ -  DWORD dummyflags, dummyoutsize, dummyinsize, dummyinst; - -  if (GetFileType (hd) == FILE_TYPE_PIPE -      && !GetNamedPipeInfo (hd, &dummyflags, &dummyoutsize, -                            &dummyinsize, &dummyinst)) -    return 1; /* Function failed; thus we assume it is a socket.  */ -  else -    return 0; /* Success; this is not a socket.  */ -#endif -} - -  static DWORD CALLBACK   reader (void *arg)  { @@ -1605,11 +1568,9 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,    si.hStdOutput = INVALID_HANDLE_VALUE;    si.hStdError = INVALID_HANDLE_VALUE; -  cr_flags |= CREATE_SUSPENDED;  -#ifndef HAVE_W32CE_SYSTEM +  cr_flags |= CREATE_SUSPENDED;    cr_flags |= DETACHED_PROCESS;    cr_flags |= GetPriorityClass (GetCurrentProcess ()); -#endif    if (!CreateProcessA (_gpgme_get_w32spawn_path (),  		       arg_string,  		       &sec_attr,     /* process security attributes */ @@ -1639,10 +1600,15 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,    /* Insert the inherited handles.  */    for (i = 0; fd_list[i].fd != -1; i++)      { -      HANDLE hd; - +      int fd = fd_list[i].fd; +      HANDLE ohd = INVALID_HANDLE_VALUE; +      HANDLE hd = INVALID_HANDLE_VALUE; +              /* Make it inheritable for the wrapper process.  */ -      if (!DuplicateHandle (GetCurrentProcess(), fd_to_handle (fd_list[i].fd), +      if (fd >= 0 && fd < MAX_SLAFD && fd_table[fd].used) +	ohd = fd_table[fd].handle; + +      if (!DuplicateHandle (GetCurrentProcess(), ohd,  			    pi.hProcess, &hd, 0, TRUE, DUPLICATE_SAME_ACCESS))  	{  	  TRACE_LOG1 ("DuplicateHandle failed: ec=%d", (int) GetLastError ()); @@ -2069,7 +2035,7 @@ _gpgme_io_socket (int domain, int type, int proto)    TRACE_SUC2 ("socket=0x%x (0x%x)", fd, fd_table[fd].socket); -  return res; +  return fd;  } diff --git a/src/w32-util.c b/src/w32-util.c index 78578f9e..b33aa2c6 100644 --- a/src/w32-util.c +++ b/src/w32-util.c @@ -476,6 +476,14 @@ _gpgme_get_conf_int (const char *key, int *value)  } +#ifdef HAVE_W32CE_SYSTEM +int +_gpgme_mkstemp (int *fd, char **name) +{ +  return -1; +} +#else +  /* mkstemp extracted from libc/sysdeps/posix/tempname.c.  Copyright     (C) 1991-1999, 2000, 2001, 2006 Free Software Foundation, Inc. @@ -499,7 +507,7 @@ mkstemp (char *tmpl)    static uint64_t value;    uint64_t random_time_bits;    unsigned int count; -  HANDLE fd = INVALID_HANDLE_VALUE; +  int fd = -1;    int save_errno = errno;    /* A lower bound on the number of temporary files to attempt to @@ -555,23 +563,14 @@ mkstemp (char *tmpl)        v /= 62;        XXXXXX[5] = letters[v % 62]; -      fd = CreateFileA (tmpl,  -                        GENERIC_WRITE|GENERIC_READ, -                        FILE_SHARE_READ|FILE_SHARE_WRITE, -                        NULL, -                        CREATE_NEW, -                        FILE_ATTRIBUTE_NORMAL, -                        NULL); -      if (fd != INVALID_HANDLE_VALUE) +      fd = open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); +      if (fd >= 0)  	{  	  gpg_err_set_errno (save_errno); -	  return (int)fd; +	  return fd;  	} -      else if (GetLastError () != ERROR_FILE_EXISTS) -        { -	  gpg_err_set_errno (EIO); -          return -1; -        } +      else if (errno != EEXIST) +	return -1;      }    /* We got out of the loop because we ran out of combinations to try.  */ @@ -616,6 +615,7 @@ _gpgme_mkstemp (int *fd, char **name)    *name = tmpname;    return 0;  } +#endif | 
