Merge branch 'master' of git+ssh://playfair.gnupg.org/git/gpgme

This commit is contained in:
Werner Koch 2011-02-03 20:51:36 +01:00
commit b001a8df68
8 changed files with 216 additions and 205 deletions

View File

@ -1,3 +1,7 @@
2011-02-02 Marcus Brinkmann <mb@g10code.com>
* configure.ac (NEED_LIBASSUAN_VERSION): Bump to 2.0.2 for system hooks.
2010-12-30 Werner Koch <wk@g10code.com> 2010-12-30 Werner Koch <wk@g10code.com>
* configure.ac: Support a git revision. * configure.ac: Support a git revision.

View File

@ -62,7 +62,7 @@ GPGME_CONFIG_API_VERSION=1
############################################## ##############################################
NEED_LIBASSUAN_API=2 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))) m4_define([git_brevis],m4_esyscmd(printf "%u" 0x[]m4_substr(git_revision,0,4)))

View File

@ -5,6 +5,31 @@
* Makefile.am (main_sources): Add extra-stati.h * Makefile.am (main_sources): Add extra-stati.h
(status-table.h): Depend on extra-stati.h and adjust rule. (status-table.h): Depend on extra-stati.h and adjust rule.
2011-02-03 Marcus Brinkmann <marcus@g10code.com>
* w32-io.c (_gpgme_io_socket): Return fd, not res.
2011-02-02 Marcus Brinkmann <mb@g10code.com>
* 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 <mb@g10code.com>
* 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 <mb@g10code.com>
* engine-gpgconf.c (_gpgme_conf_opt_change): Fix the case that is
not self-assignment.
2010-12-08 Werner Koch <wk@g10code.com> 2010-12-08 Werner Koch <wk@g10code.com>
* gpgme-tool.c (strcpy_escaped_plus): New. * gpgme-tool.c (strcpy_escaped_plus): New.
@ -1467,6 +1492,10 @@
* op-support.c (_gpgme_op_reset): Implement a no-reset flag. * op-support.c (_gpgme_op_reset): Implement a no-reset flag.
* getauditlog.c (getauditlog_start): Use that flag. * getauditlog.c (getauditlog_start): Use that flag.
2007-11-20 Werner Koch <wk@g10code.com>
* op-support.c (_gpgme_parse_inv_recp): Add new reason code 11.
2007-11-22 Werner Koch <wk@g10code.com> 2007-11-22 Werner Koch <wk@g10code.com>
* gpgme.h (gpgme_op_getauditlog_start, gpgme_op_getauditlog): New. * gpgme.h (gpgme_op_getauditlog_start, gpgme_op_getauditlog): New.
@ -1479,10 +1508,6 @@
(gpgsm_new): Try to enable audit log support. (gpgsm_new): Try to enable audit log support.
* rungpg.c (_gpgme_engine_ops_gpg): Insert dummy entry. * rungpg.c (_gpgme_engine_ops_gpg): Insert dummy entry.
2007-11-20 Werner Koch <wk@g10code.com>
* op-support.c (_gpgme_parse_inv_recp): Add new reason code 11.
2007-11-12 Marcus Brinkmann <marcus@g10code.de> 2007-11-12 Marcus Brinkmann <marcus@g10code.de>
* kdpipeiodevice.cpp: New version from Frank Osterfeld. * kdpipeiodevice.cpp: New version from Frank Osterfeld.
@ -2256,24 +2281,6 @@
* w32-io.c (_gpgme_io_read, _gpgme_io_write): Print content in * w32-io.c (_gpgme_io_read, _gpgme_io_write): Print content in
debug mode too. debug mode too.
2005-08-19 Werner Koch <wk@g10code.com>
* 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 <wk@g10code.com>
* 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 <marcus@g10code.de> 2005-07-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (gpgme_status_code_t): Add GPGME_STATUS_PLAINTEXT. * gpgme.h (gpgme_status_code_t): Add GPGME_STATUS_PLAINTEXT.
@ -2288,6 +2295,24 @@
OPD->result.plaintext_filename. OPD->result.plaintext_filename.
(_gpgme_verify_status_handler): Handle GPGME_STATUS_PLAINTEXT. (_gpgme_verify_status_handler): Handle GPGME_STATUS_PLAINTEXT.
2005-08-08 Werner Koch <wk@g10code.com>
* 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 <wk@g10code.com>
* 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 <marcus@g10code.de> 2005-07-26 Marcus Brinkmann <marcus@g10code.de>
* keylist.c (gpgme_get_key): Allow key IDs. * keylist.c (gpgme_get_key): Allow key IDs.
@ -4009,64 +4034,65 @@
fail_on_pending_request. fail_on_pending_request.
* util.h: Don't include "types.h" or "debug.h", but include "gpgme.h". * util.h: Don't include "types.h" or "debug.h", but include "gpgme.h".
2003-01-30 Marcus Brinkmann <marcus@g10code.de> 2003-01-19 Marcus Brinkmann <marcus@g10code.de>
* types.h (EngineObject): Move typedef to ... * rungpg.c (_gpgme_engine_ops_gpg): Remove gpg_start.
* engine.h: ... here. (gpg_start): Rename to ...
* types.h (GpgObject): Move typedef to ... (start): ... this function. Change arguments to GpgObject.
* rungpg.c: ... here. (gpg_decrypt): Call start.
* types.h (GpgsmObject): Move typedef to ... (gpg_edit): Likewise.
* engine-gpgsm.c: ... here. (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, * engine-gpgsm.c (_gpgme_engine_ops_encrypt): Remove gpgsm_start.
return_val_if_fail): Remove macro. (gpgsm_start): Rename to ...
* gpgme.c (gpgme_cancel): Don't use return_if_fail. (struct gpgsm_object_s): Remove member command.
* key.c (gpgme_key_ref): Likewise. (gpgsm_release): Don't free command.
* signers.c (gpgme_signers_enum): Likewise. (start): ... this function. Change arguments to GpgsmObject and
(gpgme_signers_clear): Likewise. 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 * decrypt.c (_gpgme_decrypt_start): Don't call
get_file_name. _gpgme_engine_start.
* gpgme.h (struct _gpgme_engine_info): Rename member path to * delete.c (_gpgme_op_delete_start): Likewise.
file_name. * edit.c (_gpgme_op_edit_start): Likewise.
* version.c: Do not include <stdio.h>, <stdlib.h>, context.h and * encrypt.c (_gpgme_op_encrypt_start):
util.h. Other clean ups. * encrypt-sign.c (_gpgme_op_encrypt_sign_start):
(parse_version_number): Protect more seriously against * export.c (_gpgme_op_export_start): Likewise.
overflow. * genkey.c (_gpgme_op_genkey_start): Likewise.
(gpgme_get_engine_info): Move to ... * import.c (_gpgme_op_import_start): Likewise.
* engine.c (gpgme_get_engine_info): ... here. * keylist.c (gpgme_op_keylist_ext_start): Likewise.
(_gpgme_engine_get_info): Function removed. (gpgme_op_keylist_start): Likewise.
(_gpgme_engine_get_path): Make static and rename to ... * sign.c (_gpgme_op_sign_start): Likewise.
(engine_get_file_name): .. this. * trustlist.c (gpgme_op_trustlist_start): Likewise.
(_gpgme_engine_get_version): Make static and rename to ... * verify.c (_gpgme_op_verify_start): Likewise.
(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.
* gpgme.h (enum GpgmeProtocol): Remove GPGME_PROTOCOL_AUTO. * engine-backend.h (struct engine_ops): Remove member start.
* gpgme.c (gpgme_set_protocol): Don't handle GPGME_PROTOCOL_AUTO.
(gpgme_get_protocol_name): New function.
* engine-backend.h (struct engine_ops): New member * engine.h (_gpgme_engine_start): Remove prototype.
get_req_version, remove member check_version. * engine.c (_gpgme_engine_start): Remove function.
* engine.h (_gpgme_Engine_get_version): New prototype.
* rungpg.c (gpg_get_req_version): New function. 2003-01-19 Miguel Coca <mcoca@gnu.org>
(gpg_check_version): Function removed.
(_gpgme_engine_ops_gpg): Add gpg_get_req_version, remove * w32-io.c (_gpgme_io_select): Add missing argument in calls to
gpg_check_version. DEBUG_BEGIN.
* engine-gpgsm.c (gpgsm_get_req_version): New function. * w32-util.c: Include "sema.h".
(gpgsm_check_version): Function removed. (find_program_in_registry): Change DEBUG1 to DEBUG2, fixes compilation
(_gpgme_engine_ops_gpgsm): Add gpgsm_get_req_version, remove error.
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-29 Marcus Brinkmann <marcus@g10code.de> 2003-01-29 Marcus Brinkmann <marcus@g10code.de>
@ -4213,65 +4239,64 @@
* key.c (gpgme_key_sig_get_string_attr): Use validity_to_string * key.c (gpgme_key_sig_get_string_attr): Use validity_to_string
instead otrust_to_string to calculate validity. instead otrust_to_string to calculate validity.
2003-01-19 Miguel Coca <mcoca@gnu.org> 2003-01-30 Marcus Brinkmann <marcus@g10code.de>
* w32-io.c (_gpgme_io_select): Add missing argument in calls to * types.h (EngineObject): Move typedef to ...
DEBUG_BEGIN. * engine.h: ... here.
* w32-util.c: Include "sema.h". * types.h (GpgObject): Move typedef to ...
(find_program_in_registry): Change DEBUG1 to DEBUG2, fixes compilation * rungpg.c: ... here.
error. * types.h (GpgsmObject): Move typedef to ...
* engine-gpgsm.c: ... here.
2003-01-19 Marcus Brinkmann <marcus@g10code.de> * 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.
* rungpg.c (_gpgme_engine_ops_gpg): Remove gpg_start. * engine-backend.h (struct engine_ops): Rename get_path to
(gpg_start): Rename to ... get_file_name.
(start): ... this function. Change arguments to GpgObject. * gpgme.h (struct _gpgme_engine_info): Rename member path to
(gpg_decrypt): Call start. file_name.
(gpg_edit): Likewise. * version.c: Do not include <stdio.h>, <stdlib.h>, context.h and
(gpg_encrypt): Likewise. util.h. Other clean ups.
(gpg_encrypt_sign): Likewise. (parse_version_number): Protect more seriously against
(gpg_export): Likewise. overflow.
(gpg_import): Likewise. (gpgme_get_engine_info): Move to ...
(gpg_keylist): Likewise. * engine.c (gpgme_get_engine_info): ... here.
(gpg_keylist_ext): Likewise. (_gpgme_engine_get_info): Function removed.
(gpg_trustlist): Likewise. (_gpgme_engine_get_path): Make static and rename to ...
(gpg_verify): Likewise. (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-gpgsm.c (_gpgme_engine_ops_encrypt): Remove gpgsm_start. * gpgme.h (enum GpgmeProtocol): Remove GPGME_PROTOCOL_AUTO.
(gpgsm_start): Rename to ... * gpgme.c (gpgme_set_protocol): Don't handle GPGME_PROTOCOL_AUTO.
(struct gpgsm_object_s): Remove member command. (gpgme_get_protocol_name): New function.
(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.
* decrypt.c (_gpgme_decrypt_start): Don't call * engine-backend.h (struct engine_ops): New member
_gpgme_engine_start. get_req_version, remove member check_version.
* delete.c (_gpgme_op_delete_start): Likewise. * engine.h (_gpgme_Engine_get_version): New prototype.
* edit.c (_gpgme_op_edit_start): Likewise. * rungpg.c (gpg_get_req_version): New function.
* encrypt.c (_gpgme_op_encrypt_start): (gpg_check_version): Function removed.
* encrypt-sign.c (_gpgme_op_encrypt_sign_start): (_gpgme_engine_ops_gpg): Add gpg_get_req_version, remove
* export.c (_gpgme_op_export_start): Likewise. gpg_check_version.
* genkey.c (_gpgme_op_genkey_start): Likewise. * engine-gpgsm.c (gpgsm_get_req_version): New function.
* import.c (_gpgme_op_import_start): Likewise. (gpgsm_check_version): Function removed.
* keylist.c (gpgme_op_keylist_ext_start): Likewise. (_gpgme_engine_ops_gpgsm): Add gpgsm_get_req_version, remove
(gpgme_op_keylist_start): Likewise. gpgsm_check_version.
* sign.c (_gpgme_op_sign_start): Likewise. * engine.c: Include ops.h.
* trustlist.c (gpgme_op_trustlist_start): Likewise. (_gpgme_engine_get_req_version): New function.
* verify.c (_gpgme_op_verify_start): Likewise. (gpgme_engine_check_version): Rewritten.
* version.c (gpgme_get_engine_info): Rewritten.
* engine-backend.h (struct engine_ops): Remove member start. * 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-06 Werner Koch <wk@gnupg.org> 2003-01-06 Werner Koch <wk@gnupg.org>
@ -5218,6 +5243,10 @@
* keylist.c (gpgme_op_keylist_ext_start): Always use our own FD * keylist.c (gpgme_op_keylist_ext_start): Always use our own FD
table (eg use synchronous mode). table (eg use synchronous mode).
2002-06-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: Fix documentation of key attribute retrieval functions.
2002-06-28 Marcus Brinkmann <marcus@g10code.de> 2002-06-28 Marcus Brinkmann <marcus@g10code.de>
* ops.h (_gpgme_wait_on_condition): Remove HANG argument from * ops.h (_gpgme_wait_on_condition): Remove HANG argument from
@ -5240,10 +5269,6 @@
(gpgme_op_trustlist_next): Remove HANG argument from (gpgme_op_trustlist_next): Remove HANG argument from
_gpgme_wait_on_condition. Check its return value. _gpgme_wait_on_condition. Check its return value.
2002-06-27 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h: Fix documentation of key attribute retrieval functions.
2002-06-26 Werner Koch <wk@gnupg.org> 2002-06-26 Werner Koch <wk@gnupg.org>
* engine-gpgsm.c (map_assuan_error): Map No_Data_Available to EOF. * engine-gpgsm.c (map_assuan_error): Map No_Data_Available to EOF.
@ -5845,6 +5870,12 @@
* verify.c (_gpgme_verify_status_handler): Fix the last change. * verify.c (_gpgme_verify_status_handler): Fix the last change.
2002-02-25 Marcus Brinkmann <marcus@g10code.de>
* 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 <marcus@g10code.de> 2002-02-25 Marcus Brinkmann <marcus@g10code.de>
* engine.c (_gpgme_engine_op_encrypt_sign): New function. * engine.c (_gpgme_engine_op_encrypt_sign): New function.
@ -5865,12 +5896,6 @@
* encrypt.c (gpgme_op_encrypt_start): Use new status handler name. * encrypt.c (gpgme_op_encrypt_start): Use new status handler name.
* sign.c (gpgme_op_sign_start): Likewise. * sign.c (gpgme_op_sign_start): Likewise.
2002-02-25 Marcus Brinkmann <marcus@g10code.de>
* 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 <marcus@g10code.de> 2002-02-25 Marcus Brinkmann <marcus@g10code.de>
* context.h (struct gpgme_context_s): New member include_certs. * context.h (struct gpgme_context_s): New member include_certs.

View File

@ -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 = struct assuan_system_hooks _gpgme_assuan_system_hooks =
{ {
ASSUAN_SYSTEM_HOOKS_VERSION, ASSUAN_SYSTEM_HOOKS_VERSION,
@ -234,6 +249,8 @@ struct assuan_system_hooks _gpgme_assuan_system_hooks =
my_sendmsg, my_sendmsg,
my_spawn, my_spawn,
my_waitpid, my_waitpid,
my_socketpair my_socketpair,
my_socket,
my_connect
}; };

View File

@ -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 /* Support self-assignment, for example for adding an item to an
existing list. */ existing list. */
if (opt->new_value && arg != opt->new_value) if (opt->new_value && arg != opt->new_value)
{
release_arg (opt->new_value, opt->alt_type); release_arg (opt->new_value, opt->alt_type);
opt->new_value = arg; opt->new_value = arg;
}
opt->change_value = 1; opt->change_value = 1;
} }
return 0; return 0;

View File

@ -64,6 +64,7 @@ struct io_select_fd_s
/* These function are either defined in posix-io.c or w32-io.c. */ /* These function are either defined in posix-io.c or w32-io.c. */
void _gpgme_io_subsystem_init (void); 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_connect (int fd, struct sockaddr *addr, int addrlen);
int _gpgme_io_read (int fd, void *buffer, size_t count); int _gpgme_io_read (int fd, void *buffer, size_t count);
int _gpgme_io_write (int fd, const void *buffer, size_t count); int _gpgme_io_write (int fd, const void *buffer, size_t count);

View File

@ -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 handle_to_fd(a) ((int)(a))
#define READBUF_SIZE 4096 #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 static DWORD CALLBACK
reader (void *arg) reader (void *arg)
{ {
@ -1606,10 +1569,8 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
si.hStdError = INVALID_HANDLE_VALUE; si.hStdError = INVALID_HANDLE_VALUE;
cr_flags |= CREATE_SUSPENDED; cr_flags |= CREATE_SUSPENDED;
#ifndef HAVE_W32CE_SYSTEM
cr_flags |= DETACHED_PROCESS; cr_flags |= DETACHED_PROCESS;
cr_flags |= GetPriorityClass (GetCurrentProcess ()); cr_flags |= GetPriorityClass (GetCurrentProcess ());
#endif
if (!CreateProcessA (_gpgme_get_w32spawn_path (), if (!CreateProcessA (_gpgme_get_w32spawn_path (),
arg_string, arg_string,
&sec_attr, /* process security attributes */ &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. */ /* Insert the inherited handles. */
for (i = 0; fd_list[i].fd != -1; i++) 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. */ /* 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)) pi.hProcess, &hd, 0, TRUE, DUPLICATE_SAME_ACCESS))
{ {
TRACE_LOG1 ("DuplicateHandle failed: ec=%d", (int) GetLastError ()); 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); TRACE_SUC2 ("socket=0x%x (0x%x)", fd, fd_table[fd].socket);
return res; return fd;
} }

View File

@ -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 /* mkstemp extracted from libc/sysdeps/posix/tempname.c. Copyright
(C) 1991-1999, 2000, 2001, 2006 Free Software Foundation, Inc. (C) 1991-1999, 2000, 2001, 2006 Free Software Foundation, Inc.
@ -499,7 +507,7 @@ mkstemp (char *tmpl)
static uint64_t value; static uint64_t value;
uint64_t random_time_bits; uint64_t random_time_bits;
unsigned int count; unsigned int count;
HANDLE fd = INVALID_HANDLE_VALUE; int fd = -1;
int save_errno = errno; int save_errno = errno;
/* A lower bound on the number of temporary files to attempt to /* A lower bound on the number of temporary files to attempt to
@ -555,24 +563,15 @@ mkstemp (char *tmpl)
v /= 62; v /= 62;
XXXXXX[5] = letters[v % 62]; XXXXXX[5] = letters[v % 62];
fd = CreateFileA (tmpl, fd = open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
GENERIC_WRITE|GENERIC_READ, if (fd >= 0)
FILE_SHARE_READ|FILE_SHARE_WRITE,
NULL,
CREATE_NEW,
FILE_ATTRIBUTE_NORMAL,
NULL);
if (fd != INVALID_HANDLE_VALUE)
{ {
gpg_err_set_errno (save_errno); gpg_err_set_errno (save_errno);
return (int)fd; return fd;
} }
else if (GetLastError () != ERROR_FILE_EXISTS) else if (errno != EEXIST)
{
gpg_err_set_errno (EIO);
return -1; return -1;
} }
}
/* We got out of the loop because we ran out of combinations to try. */ /* We got out of the loop because we ran out of combinations to try. */
gpg_err_set_errno (EEXIST); gpg_err_set_errno (EEXIST);
@ -616,6 +615,7 @@ _gpgme_mkstemp (int *fd, char **name)
*name = tmpname; *name = tmpname;
return 0; return 0;
} }
#endif