* 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.