Commit Graph

14 Commits

Author SHA1 Message Date
Ben Kibbey
aea2c168fc Add gpgme_set_global_malloc_hooks().
* configure.ac: Remove check for vasprintf().
* doc/gpgme.texi: Add documentation.
* src/gpgme.h.in (gpgme_malloc_hooks,gpgme_malloc_hooks_t): New.
* src/gpgme.h.in (gpgme_set_global_malloc_hooks): New prototype.
* src/mem.c, src/mem.h: New.
* src/gpgme.c (gpgme_set_global_malloc_hooks): New.
* src/gpgme.def, src/libgpgme.vers: Add gpgme_set_global_malloc_hooks.
* src/vasprintf.c (vasprintf): Rename to _gpgme_vasprintf().
* src/vasprintf.c (asprintf): Rename to _gpgme_asprintf().
* src/Makefile.am: Add mem.c, mem.h and vasprintf.c to main_sources.
* src/assuan-support.c, src/ath-pthread.c, src/conversion.c,
src/data-compat.c, src/data-identify.c, src/data-mem.c, src/data.c,
src/debug.c, src/decrypt.c, src/dirinfo.c, src/encrypt.c,
src/engine-assuan.c, src/engine-g13.c, src/engine-gpg.c,
src/engine-gpgconf.c, src/engine-gpgsm.c, src/engine-spawn.c,
src/engine-uiserver.c, src/engine.c, src/export.c, src/genkey.c,
src/get-env.c, src/gpgme-w32spawn.c, src/gpgme.c, src/import.c,
src/key.c, src/keylist.c, src/op-support.c, src/passphrase.c,
src/posix-io.c, src/posix-util.c, src/progress.c, src/setenv.c,
src/sig-notation.c, src/sign.c, src/signers.c, src/trust-item.c,
src/trustlist.c, src/util.h, src/verify.c, src/version.c,
src/vfs-create.c, src/vfs-mount.c, src/w32-ce.c, src/w32-ce.h,
src/w32-glib-io.c, src/w32-io.c, src/w32-sema.c, src/w32-util.c,
src/wait-global.c, src/wait.c:
Change allocation functions: free() to _gpgme_free(), malloc() to
_gpgme_malloc(), calloc() to _gpgme_calloc(), realloc() to
_gpgme_realloc() and strdup() to _gpgme_strdup().

--
Mostly borrowed from libassuan for custom memory handling. This changes
vasprintf.c to implement _gpgme_asprintf() and _gpgme_vasprintf() and
will always use the built-in vasprintf() even when provided by the OS.
2014-10-15 21:34:10 -04:00
Werner Koch
efaf42205c w32: Add comment about a compiler warning
--
2014-06-26 10:41:46 +02:00
Werner Koch
443f6b76a9 Make use of internal iospawn flags more flexible.
* src/priv-io.h (IOSPAWN_FLAG_DETACHED): New. Renumber the others.
* src/w32-io.c (_gpgme_io_spawn): Use DETACHED_PROCESS process only if
IOSPAWN_FLAG_DETACHED is given.
* src/w32-qt-io.cpp (_gpgme_io_spawn): Ditto.
* src/w32-glib-io.c (_gpgme_io_spawn): Ditto.
* src/assuan-support.c (my_spawn): Pass IOSPAWN_FLAG_DETACHED flags.
* src/dirinfo.c (read_gpgconf_dirs): Ditto.
* src/engine-gpg.c (start): Ditto.
* src/engine-gpgconf.c (gpgconf_read, gpgconf_write): Ditto.
* src/version.c (_gpgme_get_program_version): Ditto.
2014-04-10 11:39:14 +02:00
Werner Koch
6d0d8e7ba0 Make definition of off_t robust against misbehaving w32 toolchains.
* configure.ac (NEED__FILE_OFFSET_BITS): Change to define gpgme_off_t
and gpgme_ssize_t.
(API__OFF_T, API__SSIZE_T): New ac_subst.
* src/gpgme.h.in: Replace all ssize_t and off_t by ac_subst macros.
* src/assuan-support.c, src/ath-pthread.c, src/ath.c, src/ath.h
* src/data-compat.c, src/data-fd.c, src/data-mem.c, src/data-stream.c
* src/data-user.c, src/data.c, src/data.h, src/engine-gpgsm.c
* src/engine-uiserver.c, src/gpgme-tool.c, src/gpgme.c: Replace off_t
by gpgme_off_t and sszie_t by gpgme_ssize_t.
* src/ath-pthread.c, src/ath.h: Include gpgme.h.
--

For a detailed description, see the gpgme.texi diff.
2013-05-16 17:48:50 +02:00
Werner Koch
139e798c87 Remove all trailing whitespace from source files
--
Command used:  sed -i 's,[ \t]*$,,' FILE
2012-09-25 15:29:49 +02:00
Marcus Brinkmann
129741d2f7 Fix Windows port (spawn and assuan engine).
2011-02-02  Marcus Brinkmann  <mb@g10code.com>

        * configure.ac (NEED_LIBASSUAN_VERSION): Bump to 2.0.2 for system hooks.

src/
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 14:11:18 +01:00
Marcus Brinkmann
97df297ae2 2010-05-07 Marcus Brinkmann <marcus@g10code.de>
* engine-gpgsm.c (gpgsm_new, start): Cast between int and
	assuan_fd_t.
	* assuan-support.c (my_pipe, my_close, my_read, my_write): Likewise.
	* gpgme-tool.c (server_data_obj, server_reset_fds, gpgme_server),
	(my_recvmsg, my_sendmsg, my_spawn): Likewise.
	* engine-assuan.c (start): Likewise.
	* engine-g13.c (start): Likewise.
2010-05-07 01:06:14 +00:00
Marcus Brinkmann
749325d6c1 2010-05-06 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Require libgpg-error 1.8.

src/
2010-05-06  Marcus Brinkmann  <marcus@g10code.de>

	* sign.c, data-user.c, conversion.c, debug.c, verify.c, data.c,
	decrypt.c, delete.c, assuan-support.c, import.c, engine-gpgsm.c,
	data-mem.c, op-support.c, w32-io.c, w32-util.c, data-compat.c: Use
	gpg_error_from_syserror instead gpg_error_from_errno, and use
	gpg_err_set_errno to set error number.
	* setenv.c: Include <gpg-error.h> and define __set_errno to use
	gpg_err_set_errno.
	* gpgme-tool.c (ARGP_ERR_UNKNOWN): Define to EDEADLOCK (which is
	mapped in Windows CE) instead of E2BIG (which is not).
	(gt_import_keys): Initialize err.
2010-05-06 13:39:55 +00:00
Marcus Brinkmann
dfefe1b390 2010-04-19 Marcus Brinkmann <marcus@g10code.de>
* assuan-support.c (my_spawn): Cast to avoid warning.
	* engine-g13.c (g13_new): Make ARGV array of pointer to const
	char.
	(g13_assuan_simple_command) [!USE_DESCRIPTOR_FUNCTION]: Don't define.
	* ops.h (_gpgme_key_append_name): Same in prototype.
	* key.c (_gpgme_key_append_name): Make SRC argument pointer to
	const char.
	* posix-util.c (_gpgme_get_uiserver_socket_path): Make HOMEDIR
	const.
	* vfs-mount.c (gpgme_op_vfs_transact_start): Never define this
	potentially useful but currently unused function.
	* vfs-create.c (gpgme_op_vfs_transact_start): Likewise.
2010-04-19 16:59:23 +00:00
Marcus Brinkmann
1094c0a5d3 2009-12-15 Marcus Brinkmann <marcus@g10code.de>
* assuan-support.c (my_spawn): Calloc, not malloc, the fd_items.
2009-12-15 01:01:40 +00:00
Marcus Brinkmann
96cf17b159 2009-11-10 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Activate UIServer if FD passing is enabled and
	Assuan is available.

m4/
2009-11-10  Marcus Brinkmann  <marcus@g10code.de>

	* libassuan.m4: Fix LIBASSUAN_VERSION.

src/
2009-11-10  Marcus Brinkmann  <marcus@g10code.de>

	* Makefile.am (uiserver_components): New variable.
	(main_sources): Add it.
	* ops.h, key.c (_gpgme_key_append_name): Take CONVERT argument,
	implement it.  Adjust callers.
	(gpgme_key_from_uid): New function.
	* gpgme.h.in (gpgme_protocol_t): Add GPGME_PROTOCOL_DEFAULT.
	(gpgme_encrypt_flags_t): Add GPGME_ENCRYPT_PREPARE,
	GPGME_ENCRYPT_EXPECT_SIGN.
	(gpgme_set_sub_protocol, gpgme_key_from_uid): New functions.
	* libgpgme.vers, gpgme.def: Add new functions.
	* gpgme.c (gpgme_set_protocol): Add UIServer protocol.
	(gpgme_set_sub_protocol): New function.
	(gpgme_get_protocol_name): Add UIServer and default protocol.
	* assuan-support.c: Return correct error values, implement
	socketpair for POSIX.
	* priv-io.h, posix-io.c, w32-io.c, w32-glib-io.c,
	w32-qt-io.cpp (_gpgme_io_spawn): Add ATFORK and ATFORKVALUE
	arguments.  Implement it for POSIX.  Adjust all callers.
	* engine.h, engine-backend.h (_gpgme_engine_set_protocol)
	(_gpgme_engine_op_decrypt_verify): New prototypes.  Adjust all
	users.
	* engine.c (engine_ops, gpgme_get_engine_info): Add UIServer
	engine.
	(_gpgme_engine_set_protocol, _gpgme_engine_op_decrypt_verify): New
	function.
	* decrypt-verify.c (decrypt_verify_start): Call
	_gpgme_engine_op_decrypt_verify.
	* util.h, posix-util.c,
	w32-util.c (_gpgme_get_uiserver_socket_path): New function.
	* engine-gpgsm.c (gpgsm_set_fd): Fix _gpgme_io_pipe invocation.
	* gpgme-tool.c: Some support for UIServer protocol.
	* engine-uiserver.c: New file.
2009-11-10 09:07:19 +00:00
Marcus Brinkmann
59dc98545a 2009-11-05 Marcus Brinkmann <marcus@g10code.de>
* priv-io.h (IOSPAWN_FLAG_NOCLOSE): New flag.
	* w32-io.c (_gpgme_io_spawn): Implement this flag.
	* posix-io.c (_gpgme_io_spawn): Likewise.
	* w32-glib-io.c (_gpgme_io_spawn): Likewise.
	* assuan-support.c (my_spawn): Set this flag.
2009-11-05 02:39:31 +00:00
Marcus Brinkmann
9d3fdd8c96 2009-10-30 Marcus Brinkmann <marcus@g10code.de>
* configure.ac: Check for argp.h and error_t.

src/
2009-10-30  Marcus Brinkmann  <marcus@g10code.de>

	* Makefile.am (noinst_PROGRAMS): New target gpgme-tool.
	(gpgme_tool_LDADD): New variable.
	* gpgme-tool.c: New file.
	* ops.h (_gpgme_sig_notation_clearm _gpgme_signers_clear): New
	prototypes.
	* gpgme.c (gpgme_set_protocol): Allow GPGME_PROTOCOL_GPGCONF (when
	had that gone missing?).
	(_gpgme_sig_notation_clear): New function without debug output.
	(gpgme_release): Call it and _gpgme_signers_clear.
	* signers.c (_gpgme_signers_clear): New function without debug output.
	* g13.c (gpgme_op_vfs_mount): Add debug output.
	* assuan-support.c (my_spawn): Allow fd_child_list to be NULL.
	* conversion.c (_gpgme_encode_percent_string): Fix infinite loop.
	* debug.h: Put tag in front of debug lines, should make for nicer
	output.
	* engine-assuan.c (llass_new): Use our new system hooks for libassuan.
	* engine-g13.c (g13_new): Remove redundant assuan context allocation.
	* version.c (gpgme_check_version_internal): Delay debug output
	until after gpgme_check_version was called.
2009-10-30 14:21:08 +00:00
Marcus Brinkmann
9e2397571d Really add file. 2009-10-20 16:05:21 +00:00