* src/context.h (OPDATA_EXPORT): New.
* src/export.c (op_data_t): New.
(release_op_data): New.
(parse_error): New.
(export_status_handler): New.
(export_start, export_ext_start): Prepare op_data.
(gpgme_op_export_ext, gpgme_op_export_keys): Return an error from the
status handler.
--
To support an error return also for the async functions we need to
extend the API. Until we have done that this new features helps at
least in some cases; in particular for --send-keys.
* src/sign.c (gpgme_op_sign_result): Reformat and take care of failed
malloc.
--
Although _gpgme_debug_trace() is current always true, the code should
be run always and not just in trace mode. Also added error checking
to malloc and strdup. And while at replace some while by for loop for
easier readability.
* src/sign.c (gpgme_op_sign_result): Test that invalid and valid
signatures add up to gpgme_signers_count().
--
When invalid and valid signatures do not equal gpgme_signers_count() it
means that there was a bad passphrase during signing after the first
signer. This leaves the result.signatures from previous signers intact
which isn't correct since gpg will report:
gpg: number of one-pass packets does not match number of signature
packets
gpg: can't handle this ambiguous signature data
during verify. So when this happens append the valid signatures to the
.invalid_signers list with .reason set to GPG_ERR_GENERAL.
--
The --no-sk-comments flag is (or should be) a no-op in modern versions
of gnupg, but gpgme should still use its full form rather than the
(slightly) abbreviated --no-sk-comment
* src/engine-gpgsm.c (status_handler):
* src/engine-uiserver.c (status_handler):
--
After a realloc (realloc is also used for initial alloc) the allocated
size if the buffer is not correctly recorded. Thus an overflow can be
introduced by receiving data with different line lengths in a specific
order. This is not easy exploitable because libassuan constructs the
line. However a crash has been reported and thus it might be possible
to constructs an exploit.
CVE-id: CVE-2014-3564
Reported-by: Tomáš Trnka
* src/gpgme.h.in (GPGME_KEYLIST_MODE_WITH_SECRET): New.
* src/engine-gpg.c (gpg_keylist_build_options): Handle new mode.
* src/engine-gpgsm.c (gpgsm_keylist, gpgsm_keylist_ext): Ditto.
* src/keylist.c (parse_sec_field15): Add arg key and take care of
--with-secret output.
* src/gpgme-tool.c (gt_get_keylist_mode, cmd_keylist_mode): Add
"with_secret". Print card info and and secret flag for subkeys.
--
Note: This mode may only be used with GnuPG >= 2.1.
* src/gpgme.h.in (struct _gpgme_subkey): Add field CURVE.
* src/key.c (gpgme_key_unref): Free CURVE.
* src/keylist.c (keylist_colon_handler): Set CURVE.
* src/gpgme.c (gpgme_release): For failsafe reasons reset engine and
engine info after freeing.
--
The engine hack is useful in case the other release functions
accidently call engine release.
* src/engine-spawn.c (engspawn_start): Allocate space for list
terminator.
* src/posix-util.c (walk_path): Fix trailing slash detection.
--
Kudos to Valgrind for pointing out these two problems.
The first is a plain allocation bug in a code pattern I have written
thousands of times - this time it went wrong. The allocation is not
user controlled thus not directly exploitable.
The second is missed to do what it intended to do. Found due to the
access of malloced but not initialized memory. Not using calloc
again proved to be helpful to detect logical error.
* src/w32-io.c (create_writer): Free CTX in cased of bad FD.
* src/w32-util.c (_gpgme_mkstemp): Free TMPNAME in case of a failed
mkstemp.
--
Found by Hans-Christoph Steiner with cppcheck.
* src/spawn.c (gpgme_op_spawn_start, gpgme_op_spawn): Pass FLAGS dow
to spawn_start and add FLAGS args along the call path.
* src/engine-spawn.c (engspawn_start): Hack to automagically provide
argv[0].
* src/posix-io.c (_gpgme_io_spawn): dup /dev/null also to unsued
stdout.
--
Better be sure that stdout of a spawned process is connected to stdout
so that the process does not run into a write error if it writes to
stdout. AFAICS we always use a connected stdout; thus this is only
for correctness.
* configure.ac: Add option --enable-fixed-path.
(FIXED_SEARCH_PATH): New ac_define.
* src/posix-util.c (walk_path): Make use of the option. Remove
current directory from fallback PATH.
--
Note that using this option PATH is entirely ignored by GPGME and only
the given value is used instead to locate the GnuPG binaries.
On Android the use of PATH is not desirable. Instead the GnuPG tools
are expected in a fixed directory. By using
./configure --enable-fixed-path="/foo/bar"
gpg et al are expected to be installed as /foo/bar/gpg. With
./configure --enable-fixed-path="/foo/bar:/bin"
gpg is expected as /foo/bar/gpg or /bin/gpg.
* src/dirinfo.c (WANT_GPG_ONE_MODE): New.
(struct dirinfo): Add field "gpg_one_mode".
(get_gpgconf_item): Set that field and return it if requested.
(_gpgme_in_gpg_one_mode): New.
* src/engine-gpg.c (build_argv): Check GPG_AGENT_INFO only in gpg-1
mode.
* src/dirinfo.c (_gpgme_get_basename): New.
* src/engine-g13.c (g13_new): Take argv[0] from the pgmname.
* src/engine-gpgsm.c (gpgsm_new): Ditto.
* src/engine-gpg.c (build_argv): Ditto. Add arg PGMNAME.
(start): Pass PGMNAME to buildargv.
* src/gpgme.c (gpgme_set_global_flag): Add names "disable-gpgconf",
"gpgconf-name", and "gpg-name".
* src/dirinfo.c (_gpgme_dirinfo_disable_gpgconf): New.
(get_gpgconf_item): Minor debug info change.
* src/posix-util.c (default_gpg_name, default_gpgconf_name): Add vars.
(_gpgme_set_default_gpg_name): New.
(_gpgme_set_default_gpgconf_name): New.
(_gpgme_get_gpg_path, _gpgme_get_gpgconf_path): Use new vars.
(walk_path): Add debug output on failure.
* src/w32-util.c (default_gpg_name, default_gpgconf_name): Add vars.
(replace_slashes): New.
(get_basename): New.
(_gpgme_set_default_gpg_name): New.
(_gpgme_set_default_gpgconf_name): New.
(_gpgme_get_gpg_path, _gpgme_get_gpgconf_path): Use new vars.
* tests/t-engine-info.c (main): Add --verbose and --set-global-flag
options.
--
Note that the Windows part has not been tested.
* configure.ac (NEED_GPG_VERSION, NEED_GPGSM_VERSION)
(NEED_G13_VERSION, NEED_GPGCONF_VERSION): Remove vars and all related
checks. Do not check for any engine version.
(HAVE_ASSUAN): Remove AM conditional.
* src/Makefile.am: Remove separate component vars and always build all
engines but uiserver.
* src/dirinfo.c (WANT_GPGCONF_NAME): New.
(struct dirinfo): Add field gpgconf_name.
(_gpgme_get_default_gpgconf_name): Use WANT_GPGCONF_NAME.
(get_gpgconf_item): Set gpgconf name and adjust for _gpgme_get_*_path
now returning a malloced string.
* src/engine.c (engine_ops): Always init all engines except for
uiserver.
* src/posix-util.c (_gpgme_get_gpgsm_path, _gpgme_get_g13_path):
Remove unused functions.
(walk_path): New.
(_gpgme_get_gpg_path, _gpgme_get_gpgconf_path ): Re-implement using
walk_path.
* src/w32-util.c (_gpgme_get_gpgsm_path, _gpgme_get_g13_path): Remove
unused functions.
(_gpgme_get_gpg_path, _gpgme_get_gpgconf_path): Return a malloced
string.
* src/engine-g13.c (g13_get_req_version): Use a hardwired string with
the required version. This info belongs into this file.
* src/engine-gpg.c (gpg_get_req_version): Ditto.
* src/engine-gpgconf.c (gpgconf_get_req_version): Ditto.
* src/engine-gpgsm.c (gpgsm_get_req_version): Ditto.
* tests/t-engine-info.c: Replace now useless test by an info output.
* tests/gpg/Makefile.am (GPG, GPG_AGENT): Hardwire gpg and gpg-agent.
* tests/gpgsm/Makefile.am (GPGSM): Hardwire gpgsm.
Signed-off-by: Werner Koch <wk@gnupg.org>
* src/gpgme.h.in (gpgme_data_type_t): New.
(gpgme_data_identify): New prototype.
* src/data-identify.c: New.
* src/parsetlv.c, src/parsetlv.h: New. Take from gpa.
* src/libgpgme.vers, src/gpgme.def: Add gpgme_data_identify.
* src/gpgme-tool.c (status): Add STATUS_IDENTIFY_RESULT.
(gt_identify): New.
(cmd_identify): New.
(hlp_passwd): Move close to cmd_passwd.
--
It is often useful to have a way to identify the data which needs
processing. This is such a common task that it makes sense to
implement this in gpgme to avoid diverging implementations.
* src/util.h: Move some prototypes to ...
* src/sys-util.h: New.
* src/Makefile.am (main_sources): Add sys-util.h.
* configure.ac (AH_VERBATIM): Add DIRSEP_C and DIRSEP_S.
* src/dirinfo.c: Include sys-util.h.
(WANT_GPG_NAME, WANT_GPGSM_NAME, WANT_G13_NAME)
(WANT_UISRV_SOCKET): New.
(dirinfo): Add corresponding fields.
(parse_output): Add arg COMPONENTS and set new fields.
(read_gpgconf_dirs): Add arg components and act upon it.
(get_gpgconf_item): Call read_gpgconf_dirs two times. Add debug
output.
(_gpgme_get_default_gpg_name): New.
(_gpgme_get_default_gpgsm_name): New.
(_gpgme_get_default_g13_name): New.
(_gpgme_get_default_gpgconf_name): New.
(_gpgme_get_default_uisrv_socket): New.
* src/engine-gpg.c, src/engine-g13.c, src/engine-gpgconf.c
* src/engine-gpgsm.c, src/engine-uiserver.c: Change to use
_gpgme_get_default_ instead of those from sys-util.h.
* src/posix-util.c (_gpgme_get_gpg_path): Include sys-util.h.
(_gpgme_get_uiserver_socket_path): Remove.
* src/w32-util.c (_gpgme_get_gpg_path): Include sys-util.h.
(_gpgme_get_uiserver_socket_path): Remove.
--
The default engines names are now taken from the output of gpgconf.
If gpgconf is not installed gpg 1 is assumed and locate the same was
as gpgconf.
* src/gpgme.h.in: Move gpgme_sssize_t and gpgme_off_t typedefs into
the extern "C" scope.
--
Frankly, this does not help very much because g++ still does not
interpret gpgme_data_seek_cb_t as compatible with the C++ ssize_t. I
am sorry for that API change but C and C++ are too different to always
get both of them under one umbrella. However, the ABI should now be
identical to older gpgme versions.
* 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.
* src/w32-io.c (reader_context_s, create_reader)
(writer_context_s, create_writer): Rename STOPPED to CLOSE_EV.
(reader, writer): Remove setting of STOPPED. Wait for CLOSE_EV and
then release the context.
(destroy_reader, destroy_writer): Do not wait but set the CLOSE_EV.
(kill_reader, kill_writer): Remove.
(_gpgme_io_close): Add code from kill_reader and kill_writer.
--
The old code was prone to deadlocks which were actually exhibited at
Kleopatra startup. The new code is much more straightforward and
easier to understand. The reason for the complex old code was
probably due to our former idea to allow re-use of the I/O threads.
However we have long given up on this.
* configure.ac (INSERT__TYPEDEFS_FOR_GPGME_H): Add hacks for 32 bit
mingw64.
* src/util.h [W32]: Include winsock2.h before windows to make mingw64
happy.
* src/w32-util.c (_WIN32_IE): Need to use 5.1 for mingw64.
--
It is not clear to me what mingw64 wants to achieve with their POSIX
hacks. In particular the off64_t stuff looks quite strange given that
Windows has a pretty stable API for close to 2 decades. Thus I can't
say whether it will really work when build with that toolchain.
* configure.ac: Rename my_foo variables to mym4_foo variables to make
clear that they are processed by m4.
(VERSION_NUMBER): New ac_subst.
(AH_BOTTOM): Add CRIGHTBLURB macro.
(BUILD_REVISION, BUILD_FILEVERSION, BUILD_TIMESTAMP): Change them to
work similar to libgpg-error et al.
* src/versioninfo.rc.in: Remove use of BUILD_NUMBER and get it in line
with gpg-error et al.
* src/version.c (cright_blurb): New.
(gpgme_check_version_internal): Add magic to display the above
information.
* tests/t-version.c (main): Add option --verbose.
* src/gpgme.c (gpgme_set_pinentry_mode): New.
* src/gpgme.h.in (gpgme_pinentry_t): New.
(gpgme_set_pinentry_mode): New.
* src/context.h (struct gpgme_context): Add field pinentry_mode.
* src/engine-backend.h (struct engine_ops): Add field
set_pinentry_mode.
* src/engine-gpg.c (struct engine_gpg): Add field pinentry_mode.
(build_argv): Implement pinentry_mode.
(gpg_set_pinentry_mode): New.
(_gpgme_engine_ops_gpg): Register gpg_set_pinentry_mode.
--
Note that this new fucntion may only be used with gpg 2.1.
* src/gpgme.c (gpgme_io_read): New.
--
This is a writen style variant for gpgme_io_write. It is often easier
to use this one in passphrase and edit callbacks.
* src/conversion.c (D_gpgme_encode_percent_string): Remove stray
semicolon. Reported by Xi Wang.
--
Obviously this function is not used with a supplied LEN argument != 0.
* configure.ac: Define macro and conditional HAVE_ANDROID_SYSTEM.
* m4/gnupg-ttyname.m4: Force use of replacement on Android.
* src/ttyname_r.c: Ditto.
--
Android's bionic lib has no working ttyname_r() nor ttyname(). Using
them anyway will print
FIX ME! implement ttyname_r() bionic/libc/bionic/stubs.c:466
Thus we force the use of our replacement code which simply return
"/dev/tty".
* src/debug.h: Include "gpgme.h"
(_gpgme_trace_gpgme_error): New.
(trace_gpg_error): New macro. Use it in all files where we return
GPG_ERR_INV_ENGINE; also "include debug.h" as needed.
--
This is a pretty common error code but often it is hard to figure out
the actual cause. With debug level 4 we now print the file name and
line number where this error code is generated by gpgme. Along with
the git revision printed in the first log lines, this should give us
an easier way to track down the problems related to this error code.
* src/gpgme-tool.c (clear_membuf, init_membuf, put_membuf)
(put_membuf_str, get_membuf, peek_membuf): Add membuf functions.
Take from GnuPG master's common/membuf.[ch] and patch for our use.
(result_xml_escape): Rewrite using new functions.
--
First counting, then allocating, and finally copying data is prone to
errors. We better use the membuf functions which make it much easier.
* src/gpgme-tool.c: Change license notice.
--
gpgme-tool.c is a standalone program, thus it makes no sense to keep
it under the LGPL. We already had the manual under GPLv3+.
[[PGP Signed Part:Undecided]]
src/gpgme-tool.c (result_xml_escape_replacement, result_xml_escape):
New.
(result_xml_tag_data): Use result_xml_escape() to escape data.
(result_add_error): Use unescaped < and >.
--
This is a general solution for generating valid XML, but the specific
output that inspired the change was from the KEYLIST command:
<uid>William Trevor King <wking@tremily.us></uid>
Now the uids are properly escaped:
<uid>William Trevor King <wking@tremily.us></uid>
Signed-off-by: W. Trevor King <wking@tremily.us>
[[PGP Signed Part:Undecided]]
src/gpgme-tool.c (cmd_keylist): Use <chain-id> instead of <chain_id>.
--
All the other tags map struct attribute underscores to hyphens, so
fixing <chain_id> follows the priciple of least surprise.
Signed-off-by: W. Trevor King <wking@tremily.us>
src/gpgme-tool.c (cmd_keylist): Convert output from a list of
to more detailed XML.
(xml_preamble1, xml_preamble2, xml_end): Make global.
(result_add_protocol, result_add_validity): New functions for
generating XML from GPGME types.
(result_add_string): Treat NULL strings as "".
(result_xml_tag_data): Make 'data' a 'const char' so we can use the
value returned by gpgme_get_protocol_name directly.
--
This is a first pass at returning most of the gpgme_key_t data from the
KEYLIST call.
Signed-off-by: W. Trevor King <wking@tremily.us>
* src/gpgme-tool.c (server_reset_fds): Use close/CloseHandle instead
of the assuan close functions.
(_cmd_decrypt_verify, _cmd_sign_encrypt, cmd_verify, cmd_import)
(cmd_export, cmd_genkey, cmd_getauditlog): Use SERVER object instead
of assuan_get_*_fd functions.
--
Although we used our own handlers for INPUT and OUTPUT, we still used
assuan_get_input_fd, assuan_get_output_fd and their close functions.
That clearly can't work because libassuan does not have any values for
them.
* src/gpgme.c (gpgme_set_global_flag): New.
* src/gpgme.h.in (gpgme_set_global_flag): New.
* src/gpgme.def, src/libgpgme.vers: Add new public function.
* src/debug.c (envvar_override): New.:
(_gpgme_debug_set_debug_envvar): New.
(debug_init): Take ENVVAR_OVERRIDE in account.
--
On Android envvars can't be used, thus we need another way to enable
GPGME debugging. The new function allows this and may be used in the
future to implement similar things.
* src/engine-uiserver.c: Remove status-table.h which is not anymore
built. Fixes bug#1412.
--
The file was actually removed from the code by 885243e0 but for
unknown reasons the missing file was not reported by "make distcheck".
* src/engine-gpgconf.c (arg_to_data): Allow for NULL as value.string.
--
I was not able to replicate the problem. However this patch makes the
code more robust and tolerates errors by the user. IT should fix the
problem at hand.
* src/verify.c (gpgme_op_verify_result): Update summary field.
--
This is actually a hack to solve the problem that GPGME currently does
not emit ERRSIG for a missing public key.
* m4/gnupg-ttyname.m4: New. Based on ttyname_r from gnulib.
* src/ttyname_r.c (_gpgme_ttyname_r): Rename from ttyname_r.
Implement hacks required for Solaris and possible other non-fully
Posix systems.
* src/util.h: Include unistd.h. Redefine ttyname_r depending on
REPLACE_TTYNAME_R and put it into the gpgme name space.
--
Unfortunately we cant not use the ttyname_r replacement from gnulib
because we want to keep GPGME LGPLv2+.
We would need to use a shortened commit id so that it fits into an 16
bit Windows variable. Further it is a random number and not something
increasing. Thus a build number made up from the day of the year and
the hour is much more useful to describe a build number for a specific
revision.
* configure.ac [W32]: Replace BUILD_REVISION by BUILD_NUMBER.
* src/versioninfo.rc.in: Ditto.
* build-aux/gitlog-to-changelog: New script. Taken from gnulib.
* build-aux/git-log-fix: New file.
* build-aux/git-log-footer: New file.
* build-aux/git-hook/commit-msg: New script.
* doc/HACKING: New file.
* ChangeLog: New file.
* Makefile.am (EXTRA_DIST): Add new files.
(gen-ChangeLog): New.
(dist-hook): Run gen-ChangeLog.
* autogen.sh: Install commit-msg hook for git.
Rename all ChangeLog files to ChangeLog-2011.
gpgme-config.in: Add option --host. Change options --cflags and
--libs to collapse duplicate include and lib dirs. Try to put extra
libs at the end.
Note that gpgme.m4 has not yet been extended.
We already modify gpgme.h per playform and thus we can also get rid of
some #ifdefs. The change does not change anything for current
platforms but should do the right think for W64.
Note that as per MS specs ssize_t is to be defined as LONG_PTR which
translates to a long on 32 bit platforms and to __int64 on 64 bit
Windows platforms. We already used long in the past. There seems to
be a problem with some versions of mingw32 which includes a ssize_t
type typedefed to int. O(n 32 bit W32 platforms int and long are
identically.
As an example stub code for DECRYTPION_INFO has been added. Note
that the status codes in gpgme.h do only make sense for the edit
interactor interface and thus certain codes don't need to be part of
the public interface.
* gpgme.def: Add gpgme_err_code_from_syserror and gpgme_err_set_errno.
* libgpgme.vers: Likewise.
* gpgme.h.in (gpgme_error_from_errno): Fix return type to
gpgme_error_t.
(gpgme_err_code_from_syserror, gpgme_err_set_errno): New prototype.
(gpgme_error_from_syserror): New inline function (why are
gpgme_err_make_from_errno and gpgme_error_from_errno not inline
functions?).
* error.c (gpgme_error_from_errno): Fix return type to gpgme_error_t.
(gpgme_err_set_errno, gpgme_err_code_from_syserror): New functions.
* debug.h (TRACE_SUC6): New macro.
* w32-io.c (MAX_SLAFD): New macro.
(fd_table): New static variable.
(new_fd, release_fd): New functions.
(fd_to_handle, handle_to_fd, handle_to_socket): Remove macros.
(MAX_READERS, MAX_WRITERS): Increase to 64.
(notify_table): Increase to MAX_SLAFD.
(struct reader_context_s, struct writer_context_s): Add member
file_sock.
(reader, writer): Use file_hd vs file_sock to decide if socket
operations to use. Remove auto-detect mode.
(create_reader, create_writer): Set file_sock. Unblock pending
thread only if this is a pipe fd.
(_gpgme_io_pipe): Allocate fds from table and return slot indices
instead of windows handles. This allows to properly handle RVIDs.
(_gpgme_io_close): Handle dup'ed file descriptors.
(build_commandline) [HAVE_W32_SYSTEM]: Use RVID from fd table now.
(_gpgme_io_spawn): Use fd table now.
(_gpgme_io_fd2str): Use RVID from fd table now.
(_gpgme_io_dup): Implement using fd table.
(_gpgme_io_socket): Allocate fds from table.
(_gpgme_io_connect): Use fd from table.
* w32-io.c [HAVE_W32CE_SYSTEM]: Include assuan.h and winioctl.h.
(GPGCEDEV_IOCTL_UNBLOCK) [HAVE_W32CE_SYSTEM]: Define.
(set_synchronize) [HAVE_W32CE_SYSTEM]: Stub it out.
(is_socket): Allow to return -1 for auto-detect (old behaviour).
(is_socket) [HAVE_W32CE_SYSTEM]: Return -1.
(reader): Handle auto-detect case. Handle ctx->stop_me before
checking for EOF.
(destroy_reader) [HAVE_W32CE_SYSTEM]: Unblock a pending reader.
(writer): Handle auto-detect case. Handle ctx->stop_me with
ERROR_BUSY.
(destroy_writer) [HAVE_W32CE_SYSTEM]: Unblock a pending writer.
(_gpgme_io_pipe) [HAVE_W32CE_SYSTEM]: Implement in terms of a
half-pipe.
(build_commandline) [HAVE_W32CE_SYSTEM]: New function.
(_gpgme_io_spawn) [HAVE_W32CE_SYSTEM]: Implement it differently
for this platform.
(_gpgme_io_fd2str) [HAVE_W32CE_SYSTEM]: Implement it for RVIDs.
(_gpgme_io_dup) [HAVE_W32CE_SYSTEM]: Stub it out.
* gpgme-tool.c (result_add_timestamp): Add missing NULL argument.
(result_sign_to_xml): Protect against NULL fingerprint.
(struct server): New members input_fd, input_filename,
input_stream output_fd, output_filename, output_stream,
message_filename, message_stream.
(server_reset_fds): Deallocate those.
(server_parse_fd): New function.
(server_data_obj): Take optional filename argument and direction
argument. Also take new argument to return a filestream that
needs to be closed after destroying the data object.
Change all callers, too.
(input_notify, output_notify): Removed.
(cmd_input, cmd_output): New functions.
(gpgme_server): Do not register input and output notifier.
(register_commands): Use cmd_input and cmd_output.
(cmd_message): Rewritten to use server_parse_fd.
(cmd_delete, cmd_keylist): Fix inverted option check.
(main) [HAVE_W32CE_SYSTEM]: Sleep a bit to work around bug in ssh.
* configure.ac: Check for setlocale.
src/
2010-05-12 Marcus Brinkmann <marcus@g10code.de>
* gpgme-tool.c (main): Protect call to setlocale with
HAVE_SETLOCALE.
* w32-util.c: Include ath.h
(HAVE_ALLOW_SET_FOREGROUND_WINDOW) [!HAVE_W32CE_SYSTEM]: Define
it.
(RTLD_LAZY, dlopen, dlsym,
dlclose) [!HAVE_ALLOW_SET_FORGROUND_WINDOW]: Don't define anymore.
(_gpgme_allow_set_foreground_window) [!HAVE_ALLOW_SET_FOREGROUND_WINDOW]:
Make it a stub.
(read_w32_registry_string): Use FooA variants of Windows functions
instead of Foo (which dispatches depending on UNICODE).
[!HAVE_W32CE_SYSTEM]: Don't check environment.
(w32_shgetfolderpath): Remove.
(find_program_at_standard_place): Call
SHGetSpecialFolderPath (which is available on all Windows systems
and also Windows CE).
(mkstemp): Use ath_self instead of getpid.
(_gpgme_mkstemp): Use GetTempPathA instead of GetTempPath.
* engine-g13.c, gpgme.c, engine-gpgsm.c, engine-gpg.c,
op-support.c, engine-assuan.c, gpgme-tool.c: Include <locale.h>
only if available with HAVE_LOCALE_H and conditionalize use of
LC_CTYPE on its definition.
* engine-gpgconf.c: Do not include <locale.h>.
* configure.ac: Detect Windows CE.
(HAVE_W32CE_SYSTEM): New symbol and automake conditional.
* ltmain.sh, m4/libtool.m4: Patch so that it works for Windows CE.
* 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.
* 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.
* gpgme-tool.c (struct gpgme_tool): New members write_data and
write_data_hook.
(gt_write_data): New function.
(gt_result): Output vfs_mount result.
(server_write_data): New function.
(gpgme_server): Initialize write_data members.
* engine-g13.c (struct engine_g13): Remove members RESULT_CB and
RESULT_CB_VALUE.
(g13_assuan_simple_command, status_handler): Don't use those anymore.
(g13_transact): Remove them from argument list, too.
* vfs-mount.c (_gpgme_vfs_mount_status_handler): New function.
(_gpgme_op_vfs_mount): Pass it to transact.
* engine-assuan.c (llass_new): Update use of assuan_socket_connect.
* engine-gpgsm.c (gpgsm_new): Update use of assuan_pipe_connect.
* engine-g13.c (g13_new): Likewise.
* ath.h (ath_self): New prototype. Include <stdint.h>
* ath.c, ath-pth.c, ath-pthread.c (ath_self): New function.
* debug.h: Rewrite most macros to beautify debug output.
(_gpgme_debug_buffer): Remove tagname and tag argument.
(_gpgme_debug_frame_begin, _gpgme_debug_frame_end): New prototypes.
* debug.c: Include <time.h>. Don't include assuan.h.
(frame_nr, FRAME_NR): New thread-specific variable and macro.
(debug_init): Do not initialize assuan. Call _gpgme_debug after
initialization instead using printf directly.
(_gpgme_debug): Do not call debug_init (we now ensure proper
initialization by user). Add timestamp and thread/process ID.
(_gpgme_debug_buffer): Do not take tagname and tag argument.
(_gpgme_debug_frame_begin, _gpgme_debug_frame_end): New functions.
* version.c (gpgme_check_version_internal, gpgme_check_version):
Fix debug string. Do not initialize assuan.
* posix-io.c (get_max_fds): Use 0 not NULL (nicer debug output).
* 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.
* configure.ac (NEED_GPG_VERSION_DEFAULT): Bump to 1.4.0 as 1.3.0
was development versions only.
tests/
2009-10-26 Marcus Brinkmann <marcus@g10code.de>
* opassuan/t-command.c: Update to new interface.
src/
2009-10-26 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h.in (struct gpgme_io_event_done_data)
(gpgme_io_event_done_data_t): New types.
(struct _gpgme_op_assuan_result): Deprecate the err member.
(gpgme_op_assuan_result): Deprecate (for now).
(gpgme_op_assuan_transact_ext): New prototype.
(gpgme_op_assuan_transact): Deprecate.
(struct _gpgme_op_g13_result): Replace with ...
(struct _gpgme_op_vfs_mount_result): ... this.
(gpgme_op_g13_mount): Replace with ...
(gpgme_op_vfs_mount): ... this.
* gpgme.def (gpgme_op_assuan_transact_ext, gpgme_wait_ext)
(gpgme_op_vfs_mount_result, gpgme_op_vfs_mount): New.
(gpgme_op_g13_mount): Remove.
* libgpgme.vers: Likewise.
* engine-backend.h (struct engine_ops): Remove RESULT_CB and
RESULT_CB_VALUE args in opassuan_transact member. Add CANCEL_OP
member.
* ops.h (_gpgme_cancel_with_err, _gpgme_wait_on_condition): Add
OP_ERR argument.
(_gpgme_wait_one_ext): New prototype.
* context.h (ctx_op_data_id_t): Add OPDATA_VFS_MOUNT.
* engine-g13.c (g13_cancel_op): New function.
(parse_status): Remove declaration.
(g13_assuan_simple_command): Do nothing with status lines for now.
(status_handler): Update opaque value access.
(_gpgme_engine_ops_g13): Add new cancel_op member.
* gpgme.c (_gpgme_cancel_with_err): Add new parameter OP_ERR.
Handle operational errors.
(gpgme_cancel, gpgme_io_read, gpgme_io_write): Add debug output.
* data.c (_gpgme_data_inbound_handler)
(_gpgme_data_outbound_handler): Adjust opaque value access.
* engine-gpg.c (command_handler, status_handler)
(colon_line_handler): Likewise.
* engine-gpgsm.c (status_handler): Likewise.
* engine-gpg.c (_gpgme_engine_ops_gpg): Add cancel_op member.
* engine-gpgsm.c (_gpgme_engine_ops_gpgsm): Likewise.
* g13.c: Rewritten (and will be rewritten again).
* engine.h (_gpgme_engine_op_assuan_transact): Remove result_cb
and result_cb_value parameters from prototype.
(_gpgme_engine_cancel_op): New prototype.
* engine.c (engine_ops) [! ENABLE_ASSUAN]: Add missing comma.
(_gpgme_engine_op_assuan_transact): Remove result_cb and
result_cb_value parameter.
(_gpgme_engine_cancel_op): New function.
* wait.h (_gpgme_run_io_cb): Add new argument OP_ERR.
(struct io_cb_data): New struct to pass opaque data and get a
op_err return value. Needed because we can't modify I/O callback
handler signature because it is exposed to the user.
* wait.c (_gpgme_run_io_cb): Add OP_ERR parameter. Handle
operational errors.
* wait-user.c (_gpgme_user_io_cb_handler): Handle operational
errors.
* wait-private.c (_gpgme_wait_on_condition): New argument to
retrieve the operational result. Handle operational errors in
session based protocols.
(_gpgme_wait_one_ext): New function.
(_gpgme_wait_one): Pass argument in invocation of
_gpgme_wait_on_condition.
* wait-global.c (struct ctx_list_item): Add member OP_ERR.
(ctx_done): New argument OP_ERR.
(ctx_wait): New argument OP_ERR.
(gpgme_wait_ext): New function based on gpgme_wait but handling
operational errors.
(gpgme_wait): Implement in term of gpgme_wait_ext.
* keylist.c (gpgme_op_keylist_next): Pass argument in invocation
of _gpgme_wait_on_condition.
* trustlist.c (gpgme_op_trustlist_next): Pass argument in
invocation of _gpgme_wait_on_condition.
* engine-assuan.c (struct engine_llass): Replace members RESULT_CB
and RESULT_CB_VALUE by LAST_OP_ERR.
(_gpgme_engine_assuan_last_op_err): Add this hack function.
(llass_cancel_op): New function.
(_gpgme_engine_llass_ops): Add cancel_op member.
(llass_status_handler): Update opaque value access.
(llass_transact): Remove RESULT_CB and RESULT_CB_VALUE arguments.
* opassuan.c: Move compat hacks to the end of file.
(opassuan_start): Do not set OPD->result.err.
Do not pass RESULT_Cb and CTX to _gpgme_engine_op_assuan_transact.
(gpgme_op_assuan_transact_ext): New function.
* configure.ac: Add AC_TYPE_UINTPTR_T.
* assuan/assuan.h [_ASSUAN_IN_GPGME_BUILD_ASSUAN]: Declare
_gpgme_io_connect.
src/
2009-06-22 Marcus Brinkmann <marcus@g10code.de>
* debug.h: Everywhere, use %p instead of 0x%x to print pointer.
[HAVE_STDINT_H]: Include <stdint.h>.
(_TRACE, TRACE, TRACE0, TRACE1, TRACE2, TRACE3, TRACE6): Cast tag
to (uintptr_t) before casting it to (void*) to silence GCC
warning.
* gpgme.h.in (_GPGME_DEPRECATED_OUTSIDE_GPGME): New macro.
* sign.c (_GPGME_IN_GPGME): Define it.
* keylist.c (_GPGME_IN_GPGME): Define it.
* debug.c (_gpgme_debug_begin, _gpgme_debug_add): Handle error in
vasprintf and asprintf.
* priv-io.h: Include <sys/socket.h>. Declare _gpgme_io_connect.
tests/
2009-06-22 Marcus Brinkmann <marcus@g10code.de>
* gpg/t-support.h (passphrase_cb): Implement write() according to
the book to silence compiler warning.
* gpgsm/t-support.h (passphrase_cb): Likewise.
2009-06-16 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Result Management): New section.
src/
2009-06-16 Marcus Brinkmann <marcus@g10code.de>
* gpgme.c (result_ref_lock): New global variable.
(gpgme_result_ref, gpgme_result_unref): use it.
2009-05-28 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Library Version Check): Document selftest error.
(Creating Contexts): Likewise.
src/
2009-05-28 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h.in (gpgme_check_version_internal): New prototype.
(gpgme_check_version): New macro, overriding function of the same
name.
* libgpgme.vers, gpgme.def: Add gpgme_check_version_internal.o
* context.h (_gpgme_selftest): New variable declaration.
* version.c: Include "context.h".
(gpgme_check_version): Set _gpgme_selftest on success.
(gpgme_check_version_internal): New function.
* gpgme.c (_gpgme_selftest): Define it.
(gpgme_new): Check the selftest result.
2009-05-18 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Encrypting a Plaintext): Document
GPGME_ENCRYPT_NO_ENCRYPT_TO.
src/
2009-05-18 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h.in (gpgme_encrypt_flags_t): Add
GPGME_ENCRYPT_NO_ENCRYPT_TO.
* engine-gpg.c (gpg_encrypt): Pass --no-encrypt-to to gpg if
GPGME_ENCRYPT_NO_ENCRYPT_TO flag is set.
* configure.ac: Add infrastructure for compile time check of
_FILE_OFFSET_BITS.
src/
2009-05-05 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h.in: Add compile time check for _FILE_OFFSET_BITS.
2009-03-06 Marcus Brinkmann <marcus@g10code.de>
* assuan/: Update to libassuan SVN 2009-03-06.
src/
2009-03-06 Marcus Brinkmann <marcus@g10code.de>
* version.c (do_subsystem_inits): Do not set assuan log level.
* debug.c (debug_init): Likewise.