diff --git a/NEWS b/NEWS
index aa9b38e..aee05ed 100644
--- a/NEWS
+++ b/NEWS
@@ -1,561 +1,567 @@
-Noteworthy changes in version 2.5.4 (unreleased) [C8/A8/R_]
+Noteworthy changes in version 2.5.4 (2020-10-23) [C8/A8/R4]
------------------------------------------------
+ * Support Unicode socket names on Windows.
+
+ * Fix some minor build annoyances.
+
+ Release-info: https://dev.gnupg.org/T5112
+
Noteworthy changes in version 2.5.3 (2019-02-11) [C8/A8/R3]
------------------------------------------------
* Add a timeout for writing to a SOCKS5 proxy. This helps if another
service is running on the standard tor socket (e.g. Windows 10).
[#3381]
* Add workaround for a problem with LD_LIBRARY_PATH on newer systems.
[#4298]
Release-info: https://dev.gnupg.org/T4361
Noteworthy changes in version 2.5.2 (2018-12-13) [C8/A8/R2]
------------------------------------------------
* Better credential support for BSDs.
* Fix some compiler warnings.
* Update the build system.
Noteworthy changes in version 2.5.1 (2017-12-07) [C8/A8/R1]
------------------------------------------------
* Fix c+p error in the previous usleep fix.
Noteworthy changes in version 2.5.0 (2017-12-07) [C8/A8/R0]
------------------------------------------------
* New function to change the system hooks for the socket
interface. [#3378]
* Fix the use of the internal usleep in the nPth implementation.
* Interface changes relative to the 2.4.0 release:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
assuan_sock_set_system_hooks NEW.
Noteworthy changes in version 2.4.5 (2017-12-01) [C7/A7/R5]
------------------------------------------------
* Avoid a blocking close on Windows with nPth. [#3378]
Noteworthy changes in version 2.4.4 (2017-11-16) [C7/A7/R4]
------------------------------------------------
* New configure option --disable-doc.
* Fix the use of nanosleep.
* Portability fixes for OpenBSD and macOS. [#2910]
* Portability fix for systems not defining INADDR_LOOPBACK. [#2447]
* Improve descriptor passing test to fix a Cygwin build
problem. [#3384]
Noteworthy changes in version 2.4.3 (2016-07-14) [C7/A7/R3]
------------------------------------------------
* Allow socket redirection with assuan_socket_connect.
* Speedup spawning programs on Linux
* Fix minor memory leaks
* Portability fixes for Solaris and AIX.
Noteworthy changes in version 2.4.2 (2015-12-02) [C7/A7/R2]
------------------------------------------------
* The nPth version of the connect system hook does now wrap the call
with npth_unprotec/npth_protect to avoid blocking during a connect.
* Add feature to assuan_sock_connect_byname to test for SOCKS5
availability.
Noteworthy changes in version 2.4.1 (2015-11-23) [C7/A7/R1]
------------------------------------------------
* In Tor mode fallback to port 9150 if 9050 is not listening.
* Allow building with older mingw-w64 versions.
Noteworthy changes in version 2.4.0 (2015-11-03) [C7/A7/R0]
------------------------------------------------
* New flags "socks" and "tor-mode" for assuan_sock_{set,get}_flag.
* New function assuan_sock_connect_byname.
* Require at least libgpg-error 1.17.
* Interface changes relative to the 2.3.0 release:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
assuan_sock_connect_byname NEW.
ASSUAN_SOCK_TOR NEW.
ASSUAN_SOCK_SOCKS NEW.
assuan_sock_set_flag EXTENDED.
assuan_sock_get_flag EXTENDED.
Noteworthy changes in version 2.3.0 (2015-08-28) [C6/A6/R0]
------------------------------------------------
* Now wipes out the memory of the context structure before freeing.
The context may have stored sensitive data in its line buffers.
* Fixed a problem with the data length limit in assuan_inquire.
* Returns GPG_ERR_SOURCE_ASSUAN with errors from functions w/o a
context.
* Two new functions to tweak the behaviour of the socket wrappers.
* Experimental code to support Cygwin's local sockets.
* By default build without a build timestamp.
* Interface changes relative to the 2.2.1 release:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
assuan_sock_set_flag NEW.
assuan_sock_get_flag NEW.
Noteworthy changes in version 2.2.1 (2015-05-12) [C5/A5/R1]
------------------------------------------------
* Documentation updates.
* Fixed building for Windows with newer versions of Mingw.
Noteworthy changes in version 2.2.0 (2014-12-11) [C5/A5/R0]
------------------------------------------------
* Added support for socket redirection.
* Interface changes relative to the 2.1.3 release:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
assuan_sock_set_sockaddr_un NEW.
Noteworthy changes in version 2.1.3 (2014-11-07) [C4/A4/R3]
------------------------------------------------
* Performance fix for Windows.
Noteworthy changes in version 2.1.2 (2014-08-17) [C4/A4/R2]
------------------------------------------------
* Fixed portability bugs for Solaris and AIX.
* Added support for ppc64le.
Noteworthy changes in version 2.1.1 (2013-06-24) [C4/A4/R1]
------------------------------------------------
* Limited support for 64 bit Windows. This is sufficient for use by
GpgEX.
Noteworthy changes in version 2.1.0 (2013-02-22)
------------------------------------------------
* Support for the nPth library.
* Add assuan_check_version and two version macros.
* Interface changes relative to the 2.0.3 release:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ASSUAN_SYSTEM_NPTH_IMPL NEW macro.
ASSUAN_SYSTEM_NPTH NEW macro.
__assuan_read NEW (private).
__assuan_write NEW (private).
__assuan_recvmsg NEW (private).
__assuan_sendmsg NEW (private).
__assuan_waitpid NEW (private).
ASSUAN_VERSION NEW macro.
ASSUAN_VERSION_NUMBER NEW macro.
assuan_check_version NEW.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Noteworthy changes in version 2.0.3 (2011-12-20)
------------------------------------------------
* Make assuan_get_pid work correctly for pipe server.
* Interface changes relative to the 2.0.2 release:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ASSUAN_FORCE_CLOSE NEW.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Noteworthy changes in version 2.0.2 (2011-06-16)
------------------------------------------------
* A new flag may now be used to convey comments via assuan_transact.
* A new flag value may now be used to disable logging.
* The gpgcedev.c driver now provides a log device.
* It is now possible to overwrite socket and connect functions in
struct assuan_system_hooks.
* Interface changes relative to the 2.0.1 release:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ASSUAN_CONVEY_COMMENTS NEW.
ASSUAN_NO_LOGGING NEW.
assuan_system_hooks_t CHANGED: Added socket and connect members.
ASSUAN_SYSTEM_HOOKS_VERSION CHANGED: Bumped to 2.
assuan_register_pre_cmd_notify NEW.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Noteworthy changes in version 2.0.1 (2010-08-09)
------------------------------------------------
* Support for WindowsCE.
* Input and output notification handler can now really access the
parsed fd as stated in the manual.
* Cleaned up the logging.
* Interface changes relative to the 2.0.0 release:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
assuan_free NEW.
_assuan_w32ce_create_pipe NEW.
ASSUAN_LOG_CONTROL NEW.
ASSUAN_NO_LOGGING NEW.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Noteworthy changes in version 2.0.0 (2010-01-08)
------------------------------------------------
* Now using libtool and builds a DSO.
* Lots of interface cleanups. See below for details of the most
important changes. Here is a quick note on how to upgrade:
For each invocation of the connect or server functions, allocate a
context with assuan_new and use that. Instead of assuan_disconnect
or assuan_deinit_server, call assuan_release. Use
assuan_set_gpg_err_source instead of assuan_set_assuan_err_source.
If you use assuan_pipe_connect with NAME of NULL, you have to
provide a non-NULL ARGV argument and check that against "server" or
"client" to determine which end you got after fork(). If you use
the assuan sock interface, you must call assuan_sock_init after
setting global context defaults. Add a NULL as the last arg to
assuan_register_command.
* Pth support has changed. This now follows the same style as
libgcrypt by setting system hook callbacks.
* Interface changes relative to the 1.0.5 release:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_ASSUAN_ONLY_GPG_ERRORS REMOVED
assuan_set_assuan_err_source REMOVED: Use assuan_set_gpg_err_source.
assuan_set_gpg_err_source NEW
assuan_get_gpg_err_source NEW
assuan_strerror REMOVED
ASSUAN_* Error values removed.
assuan_error_t REMOVED
AssuanError REMOVED
assuan_init_connected_socket_server REMOVED
assuan_pipe_connect2 REMOVED
AssuanCommand REMOVED
assuan_flag_t CHANGED: From enum to unsigned int.
ASSUAN_CONTENT REMOVED
assuan_disconnect REMOVED: Use assuan_release.
assuan_deinit_server REMOVED: Use assuan_release.
assuan_get_malloc_hooks NEW
assuan_set_log_cb NEW
assuan_get_log_cb NEW
assuan_new_ext NEW
assuan_new NEW
assuan_release NEW
assuan_init_socket_server CHANGED: Take ctx arg instead of pointer to ctx.
CHANGED: As assuan_init_socket_server_ext was.
assuan_init_socket_server_ext REMOVED
assuan_socket_connect CHANGED: Take ctx arg instead of pointer to ctx.
CHANGED: Is what assuan_socket_connect_ext was.
assuan_socket_connect_ext REMOVED
assuan_pipe_connect CHANGED: Take ctx arg instead of pointer to ctx.
If NAME is NULL, ARGV will contain fork result.
CHANGED: Is now what assuan_pipe_connect_ext was.
CHANGED: Child fds are now assuan_fd_t.
assuan_pipe_connect_ext REMOVED
assuan_init_pipe_server CHANGED: Take ctx arg instead of pointer to ctx.
CHANGED: Swallows fds (are closed at end).
CHANGED: Take assuan_fd_t.
assuan_fdopen NEW
assuan_set_io_hooks REMOVED: Use assuan_system_hooks interface.
assuan_io_hooks_t REMOVED: Use assuan_system_hooks interface.
assuan_io_monitor_t CHANGED: Add a hook data argument.
assuan_get_command_name NEW
assuan_msghdr_t NEW
ASSUAN_INVALID_PID NEW
ASSUAN_NO_FIXSIGNALS NEW
ASSUAN_SYSTEM_HOOKS_VERSION NEW
assuan_system_hooks_t NEW
assuan_set_system_hooks NEW
assuan_ctx_set_system_hooks NEW
ASSUAN_SYSTEM_PTH_IMPL NEW
ASSUAN_SYSTEM_PTH_DECL NEW
ASSUAN_SYSTEM_PTH NEW
assuan_sock_init NEW
assuan_sock_deinit NEW
assuan_handler_t NEW
assuan_register_command CHANGED: Add arg HELP_STRING.
assuan_register_bye_notify CHANGED: Handler gets line and returns err now.
assuan_register_reset_notify CHANGED: Handler gets line and returns err now.
assuan_register_cancel_notify CHANGED: Handler gets line and returns err now.
assuan_register_input_notify CHANGED: Handler returns error now.
assuan_register_output_notify CHANGED: Handler returns error now.
assuan_process_next CHANGED: New DONE argument instead EOF return.
ASSUAN_PIPE_CONNECT_FDPASSING NEW
ASSUAN_PIPE_CONNECT_DETACHED NEW
ASSUAN_SOCKET_SERVER_FDPASSING NEW
ASSUAN_SOCKET_SERVER_ACCEPTED NEW
ASSUAN_SOCKET_CONNECT_FDPASSING NEW
assuan_peercred_t NEW
assuan_get_peercred CHANGED: Return assuan_peercred_t.
assuan_client_read_response NEW
assuan_client_parse_response NEW
assuan_fd_from_posix_fd NEW
ASSUAN_SPAWN_DETACHED NEW
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Noteworthy changes in version 1.0.5 (2008-05-25)
------------------------------------------------
* Minor fixes.
* Build library for GNU/Linux as PIC.
Noteworthy changes in version 1.0.4 (2007-12-12)
------------------------------------------------
* New socket wrapper functions to support Unix domain sockets under
Windows.
* New hook feature to enhance the internal I/O functions.
Noteworthy changes in version 1.0.3 (2007-08-24)
------------------------------------------------
* New type assuan_fd_t and constant ASSUAN_INVALID_FD for better W32
support. It does not change the semantics under Unix. Under W32
all file descriptors are now guaranteed to be system handles.
* New functions assuan_process_done and assuan_inquire_ext to support
external event loops.
* Changed the license of the library code back to LGPLv2.1 to support
a bunch of GPLv2(only) software which does not allow the use of
LGPLv3. Note that this is only a temporary change and authors of
GPLv2(only) software are asked to switch to GPLv3 or to add an
exception which allow the use of LPGLv3 software.
Noteworthy changes in version 1.0.2 (2007-07-05)
------------------------------------------------
* Changed license to LGPLv3.
* New flag ASSUAN_CONFIDENTIAL to return the state of
confidential logging.
* Better support for W32.
* Assorted bug fixed and code cleanups.
Noteworthy changes in version 1.0.1 (2006-11-22)
------------------------------------------------
* New function: assuan_set_io_monitor.
* New function: assuan_register_post_cmd_notify.
* Fixed a memory leak.
Noteworthy changes in version 1.0.0 (2006-10-31)
------------------------------------------------
* Finished the manual.
Noteworthy changes in version 0.9.3 (2006-10-10)
------------------------------------------------
* Portability fixes.
* Pth is not anymore linked by means of weak symbol tricks. It is
now required to link to the pth version of libassuan. New autoconf
macros are provided to to check for this. The pth version is only
build if Pth is available.
* configure does now check that descripotor passing is available. A
way to check at runtime for this is also provided
Noteworthy changes in version 0.9.2 (2006-10-04)
------------------------------------------------
* A fix to make CANCEL work again in Pinentries.
Noteworthy changes in version 0.9.1 (2006-10-04)
------------------------------------------------
* Minor bug fixes
* Portability fixes.
Noteworthy changes in version 0.9.0 (2006-09-14)
------------------------------------------------
* Internal cleanups to make inclusion of the code into libraries
easier.
* Made clear that the software is under the LGPL.
* New function assuan_set_assuan_err_source. All gpg-error enabled
software should call this right at startup to switch libassuan into
the gpg-error style mode. All error codes are then returned as
gpg-error style codes (GPG_ERR_ASS_* as well as others).
If the new macro _ASSUAN_ONLY_GPG_ERRORS is defned all old
definitions are excluded from assuan.h.
* Logging of hex strings is now limited to 16 bytes. To enable
printing of the full data, a new environment variable
ASSUAN_FULL_LOGGING may be set to any value.
* Removed the assuan_domain_* functions.
* New functions assuan_pipe_connect_ext and assuan_socket_connect_ext
to allow connections on a socketpair and to pass descriptors.
* New function assuan_get_peercred.
Noteworthy changes in version 0.6.10 (2005-06-20)
-------------------------------------------------
* New functions assuan_get_flag and assuan_set_flag.
* Add flag ASSUAN_NO_WAITPID.
Noteworthy changes in version 0.6.9 (2004-12-22)
------------------------------------------------
* Ported to W32 based systems.
Noteworthy changes in version 0.6.8 (2004-11-25)
------------------------------------------------
* assuan_write_status does now return an error code.
* Fixes for C89 compatibility and some first takes on a W32 port.
Noteworthy changes in version 0.6.7 (2004-09-27)
------------------------------------------------
* Minor build fixes.
Noteworthy changes in version 0.6.6 (2004-06-08)
------------------------------------------------
* assuan_set_hello_line may now take a multi line argument where the
first lines are send as comment lines and the last one as a OK
line.
Noteworthy changes in version 0.6.5 (2004-04-29)
------------------------------------------------
* Pass the client's pid to a pipe server.
Noteworthy changes in version 0.6.4 (2004-02-20)
------------------------------------------------
* Will now also build on systems not providing funopen or
fopencookie.
* Some smaller build fixes.
Noteworthy changes in version 0.6.3 (2004-01-29)
------------------------------------------------
* Fixed a data corruption bug in assuan_get_data_fp.
* New function assuan_pipe_connect2.
Noteworthy changes in version 0.6.2 (2003-12-18)
------------------------------------------------
* New function assuan_set_assuan_log_prefix to store a log prefix to
be used when no context is available. The existing function
assuan_get_assuan_log_context is not anymore declared as user
overridable.
* Documentation cleanups.
Noteworthy changes in version 0.6.1 (2003-11-17)
------------------------------------------------
* Fixed a bug in assuan_inquire which led to an Invalid_Value error
for large inquiry parameters.
* Fixed a bug in the client socket connect code.
Noteworthy changes in version 0.6.0 (2003-08-06)
------------------------------------------------
* Initial release as a standalone library.
Copyright 2003, 2004, 2006, 2007, 2011,
2013 Free Software Foundation, Inc.
This file is free software; as a special exception the author gives
unlimited permission to copy and/or distribute it, with or without
modifications, as long as this notice is preserved.
This file is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
diff --git a/README b/README
index dd41094..82e5784 100644
--- a/README
+++ b/README
@@ -1,52 +1,52 @@
Libassuan
===========
Copyright (C) 2001-2013 Free Software Foundation, Inc.
- Copyright (C) 2001-2018 g10 Code GmbH
+ Copyright (C) 2001-2020 g10 Code GmbH
This is a general purpose IPC library which is for example used
GnuPG, GPGME and some other software.
See COPYING.LIB on how to share, modify and distribute the
software itself (LGPLv2.1+) and COPYING for the documentation
(GPLv3+).
Please send bug report to the gnupg-devel mailing list or enter
them into the gnupg bug tracker at https://bugs.gnupg.org using the
category "libassuan".
The primary FTP site is https://gnupg.org/ftp/gcrypt/libassuan.
Notes for Windows CE:
----------------------
Libassuan supports WindowsCE (tested with WindowsMobile 6.5). To
install it, copy libassuan-0.dll into a location where DLL are found
and install the included gpgcedev driver: First copy "gpgcedev.dll"
into the root directory, second run the included program gpgcemgr on
the device: "gpgcemgr --register". This creates the necessary
registry keys. In case the copy step fails, the driver may still be
in use: Close all applications using that driver, run "gpgcemgr
--deactivate" to deactivate the running driver and try again.
Registry keys created by "gpgcemgr --register" are:
Drivers\\GnuPG_Device\dll -> "gpgcedev.dll"
Drivers\\GnuPG_Device\prefix -> "GPG"
Drivers\\GnuPG_Device\Index -> 1 (dword)
Contact
-------
See the file AUTHORS.
Commercial grade support for Libassuan and GnuPG is available; for
a listing of offers see https://www.gnupg.org/service.html .
Maintaining and improving this software is costly. Since 2001,
g10 Code GmbH, a German company owned and headed by GnuPG's
principal author Werner Koch, is bearing the majority of these
costs. To help them carry on this work, they need your support.
See https://gnupg.org/donate/ .
diff --git a/configure.ac b/configure.ac
index ced32e4..57596e5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,488 +1,488 @@
# configure.ac - for libassuan
# Copyright (C) 2001, 2002, 2003, 2006, 2007, 2009,
# 2011, 2012, 2013 Free Software Foundation, Inc.
# Copyright (C) 2013, 2014, 2015 g10 Code GmbH
#
# This file is part of Assuan.
#
# Assuan is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of
# the License, or (at your option) any later version.
#
# Assuan is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, see .
# SPDX-License-Identifier: LGPL-2.1+
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
min_automake_version="1.14"
# To build a release you need to create a tag with the version number
# (git tag -s libassuan-n.m.k) and run "./autogen.sh --force". Please
# bump the version number immediately after the release and do another
# commit and push so that the git magic is able to work. See below
# for the LT versions.
m4_define([mym4_package],[libassuan])
m4_define([mym4_major], [2])
m4_define([mym4_minor], [5])
m4_define([mym4_micro], [4])
# To start a new development series, i.e a new major or minor number
# you need to mark an arbitrary commit before the first beta release
# with an annotated tag. For example a 2.1 branch starts off with
# the tag "foo-2.1-base". This is used as the base for counting
# beta numbers before the first release of a series.
# Below is m4 magic to extract and compute the git revision number,
# the decimalized short revision number, a beta version string and a
# flag indicating a development version (mym4_isbeta). Note that the
# m4 processing is done by autoconf and not during the configure run.
m4_define([mym4_verslist], m4_split(m4_esyscmd([./autogen.sh --find-version] \
mym4_package mym4_major mym4_minor mym4_micro),[:]))
m4_define([mym4_isbeta], m4_argn(2, mym4_verslist))
m4_define([mym4_version], m4_argn(4, mym4_verslist))
m4_define([mym4_revision], m4_argn(7, mym4_verslist))
m4_define([mym4_revision_dec], m4_argn(8, mym4_verslist))
m4_esyscmd([echo ]mym4_version[>VERSION])
AC_INIT([mym4_package],[mym4_version], [https://bugs.gnupg.org])
# LT Version numbers, remember to change them just *before* a release.
# (Code changed: REVISION++)
# (Interfaces added/removed/changed: CURRENT++, REVISION=0)
# (Interfaces added: AGE++)
# (Interfaces removed/changed: AGE=0)
#
LIBASSUAN_LT_CURRENT=8
LIBASSUAN_LT_AGE=8
-LIBASSUAN_LT_REVISION=3
+LIBASSUAN_LT_REVISION=4
# If the API is changed in an incompatible way: increment the next counter.
LIBASSUAN_CONFIG_API_VERSION=2
##############################################
AC_SUBST(LIBASSUAN_LT_CURRENT)
AC_SUBST(LIBASSUAN_LT_AGE)
AC_SUBST(LIBASSUAN_LT_REVISION)
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([serial-tests dist-bzip2 no-dist-gzip])
AM_MAINTAINER_MODE
AC_CONFIG_SRCDIR(src/assuan.h.in)
AC_CONFIG_MACRO_DIR(m4)
AM_CONFIG_HEADER(config.h)
AC_CANONICAL_HOST
AM_SILENT_RULES
AB_INIT
AC_GNU_SOURCE
# Taken from mpfr-4.0.1, then modified for LDADD_FOR_TESTS_KLUDGE
dnl Under Linux, make sure that the old dtags are used if LD_LIBRARY_PATH
dnl is defined. The issue is that with the new dtags, LD_LIBRARY_PATH has
dnl the precedence over the run path, so that if a compatible MPFR library
dnl is installed in some directory from $LD_LIBRARY_PATH, then the tested
dnl MPFR library will be this library instead of the MPFR library from the
dnl build tree. Other OS with the same issue might be added later.
dnl
dnl References:
dnl https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=859732
dnl http://lists.gnu.org/archive/html/libtool/2017-05/msg00000.html
dnl
dnl We need to check whether --disable-new-dtags is supported as alternate
dnl linkers may be used (e.g., with tcc: CC=tcc LD=tcc).
dnl
case $host in
*-*-linux*)
if test -n "$LD_LIBRARY_PATH"; then
saved_LDFLAGS="$LDFLAGS"
LDADD_FOR_TESTS_KLUDGE="-Wl,--disable-new-dtags"
LDFLAGS="$LDFLAGS $LDADD_FOR_TESTS_KLUDGE"
AC_MSG_CHECKING(whether --disable-new-dtags is supported by the linker)
AC_LINK_IFELSE([AC_LANG_SOURCE([[
int main (void) { return 0; }
]])],
[AC_MSG_RESULT(yes (use it since LD_LIBRARY_PATH is set))],
[AC_MSG_RESULT(no)
LDADD_FOR_TESTS_KLUDGE=""
])
LDFLAGS="$saved_LDFLAGS"
fi
;;
esac
AC_SUBST([LDADD_FOR_TESTS_KLUDGE])
VERSION_NUMBER=m4_esyscmd(printf "0x%02x%02x%02x" mym4_major \
mym4_minor mym4_micro)
AC_SUBST(VERSION_NUMBER)
# Don't default to build static libs.
LT_PREREQ([2.2.6])
LT_INIT([win32-dll disable-static])
LT_LANG([Windows Resource])
# For now we hardcode the use of version scripts. It would be better
# to write a test for this or even implement this within libtool.
have_ld_version_script=no
check_descriptor_passing=yes
case "${host}" in
*-*-cygwin*)
check_descriptor_passing=no
;;
*-*-linux*)
have_ld_version_script=yes
;;
*-*-gnu*)
have_ld_version_script=yes
;;
*-apple-darwin*)
AC_DEFINE(_XOPEN_SOURCE, 500, Activate POSIX interface on MacOS X)
AC_DEFINE(_DARWIN_C_SOURCE, 900000L,
Expose all libc features (__DARWIN_C_FULL))
;;
esac
AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
AH_TOP([
#ifndef _ASSUAN_CONFIG_H_INCLUDED
#define _ASSUAN_CONFIG_H_INCLUDED
/* Enable gpg-error's strerror macro under W32CE. */
#define GPG_ERR_ENABLE_ERRNO_MACROS 1
/* Provide the es_ macro for estream. */
#define GPGRT_ENABLE_ES_MACROS 1
])
AH_BOTTOM([
#endif /*_ASSUAN_CONFIG_H_INCLUDED*/
])
# Checks for programs.
missing_dir=`cd $ac_aux_dir && pwd`
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CPP
AM_PROG_CC_C_O
if test "x$ac_cv_prog_cc_c89" = "xno" ; then
AC_MSG_ERROR([[No C-89 compiler found]])
fi
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
#AC_ARG_PROGRAM
# We need to compile and run a program on the build machine. A
# comment in libgpg-error says that the AC_PROG_CC_FOR_BUILD macro in
# the AC archive is broken for autoconf 2.57. Given that there is no
# newer version of that macro, we assume that it is also broken for
# autoconf 2.61 and thus we use a simple but usually sufficient
# approach.
AC_MSG_CHECKING(for cc for build)
if test "$cross_compiling" = "yes"; then
CC_FOR_BUILD="${CC_FOR_BUILD-cc}"
else
CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
fi
AC_MSG_RESULT($CC_FOR_BUILD)
AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
if test "$GCC" = yes; then
CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
AC_MSG_CHECKING([if gcc supports -Wpointer-arith])
_gcc_cflags_save=$CFLAGS
CFLAGS="-Wpointer-arith"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],_gcc_wopt=yes,_gcc_wopt=no)
AC_MSG_RESULT($_gcc_wopt)
CFLAGS=$_gcc_cflags_save;
if test x"$_gcc_wopt" = xyes ; then
CFLAGS="$CFLAGS -Wpointer-arith"
fi
fi
#
# Options depending on the host OS.
#
have_dosish_system=no
have_w32_system=no
have_w64_system=no
have_w32ce_system=no
case "${host}" in
*-linux*)
if test "$GCC" = yes; then
CFLAGS="$CFLAGS -fPIC -DPIC"
fi
;;
x86_64-*mingw32*)
have_dosish_system=yes
have_w32_system=yes
have_w64_system=yes
;;
*-mingw32ce*)
have_dosish_system=yes
have_w32_system=yes
have_w32ce_system=yes
;;
*-mingw32*)
have_dosish_system=yes
have_w32_system=yes
;;
*-solaris*)
AC_DEFINE(_XOPEN_SOURCE, 500, Activate extensions on Solaris)
AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, Activate extensions on Solaris)
AC_DEFINE(__EXTENSIONS__, 1, Activate extensions on Solaris)
;;
esac
if test "$have_dosish_system" = yes; then
AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
[Defined if we run on some of the PCDOS like systems
(DOS, Windoze. OS/2) with special properties like
no file modes])
fi
if test "$have_w32_system" = yes; then
AC_DEFINE(HAVE_W32_SYSTEM,1,[Defined if we run on a W32 API based system])
if test "$have_w64_system" = yes; then
AC_DEFINE(HAVE_W64_SYSTEM,1,
[Defined if we run on a 64 bit W32 API based system])
fi
if test "$have_w32ce_system" = yes; then
AC_DEFINE(HAVE_W32CE_SYSTEM,1,[Defined if we run on WindowsCE])
fi
fi
AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes)
AM_CONDITIONAL(HAVE_W64_SYSTEM, test "$have_w64_system" = yes)
#
# Provide information about the build.
#
BUILD_REVISION="mym4_revision"
AC_SUBST(BUILD_REVISION)
AC_DEFINE_UNQUOTED(BUILD_REVISION, "$BUILD_REVISION",
[GIT commit id revision used to build this package])
changequote(,)dnl
BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
changequote([,])dnl
BUILD_FILEVERSION="${BUILD_FILEVERSION}mym4_revision_dec"
AC_SUBST(BUILD_FILEVERSION)
AC_ARG_ENABLE([build-timestamp],
AC_HELP_STRING([--enable-build-timestamp],
[set an explicit build timestamp for reproducibility.
(default is the current time in ISO-8601 format)]),
[if test "$enableval" = "yes"; then
BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
else
BUILD_TIMESTAMP="$enableval"
fi],
[BUILD_TIMESTAMP=""])
AC_SUBST(BUILD_TIMESTAMP)
AC_DEFINE_UNQUOTED(BUILD_TIMESTAMP, "$BUILD_TIMESTAMP",
[The time this package was configured for a build])
#
# Check for network libraries. They are needed for tests.
#
AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt,
[NETLIBS="-lsocket $NETLIBS"]))
AC_SUBST(NETLIBS)
if test "$have_w32_system" = yes; then
if test "$have_w32ce_system" = yes; then
NETLIBS="-lws2 $NETLIBS"
else
# FIXME: Check why we need to use ws2_32 and document that.
NETLIBS="-lws2_32 $NETLIBS"
fi
fi
#
# Provide info for src/libassuan-config.in
#
LIBASSUAN_CONFIG_LIBS="-lassuan"
LIBASSUAN_CONFIG_CFLAGS=""
LIBASSUAN_CONFIG_HOST="$host"
AC_SUBST(LIBASSUAN_CONFIG_LIBS)
AC_SUBST(LIBASSUAN_CONFIG_CFLAGS)
AC_SUBST(LIBASSUAN_CONFIG_HOST)
AC_SUBST(LIBASSUAN_CONFIG_API_VERSION)
#
# Checks for header files.
#
AC_HEADER_STDC
AC_CHECK_HEADERS([string.h locale.h sys/uio.h stdint.h inttypes.h \
sys/types.h sys/stat.h unistd.h sys/time.h fcntl.h \
sys/select.h ucred.h sys/ucred.h])
AC_TYPE_UINTPTR_T
AC_TYPE_UINT16_T
#
# Checks for typedefs, structures, and compiler characteristics.
#
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_TYPE_SIGNAL
AC_DECL_SYS_SIGLIST
gl_HEADER_SYS_SOCKET
gl_TYPE_SOCKLEN_T
if test $check_descriptor_passing != yes; then
use_descriptor_passing=no
else
AC_CHECK_MEMBER(struct cmsghdr.cmsg_len,
[use_descriptor_passing=yes],
[use_descriptor_passing=no
AC_MSG_WARN([
***
*** Data structure for sending ancillary data missing.
*** Descriptor passing won't work.
***])],[
#include
#include
#include
#include
#include
#include
#if HAVE_SYS_UIO_H
#include
#endif
#include
])
fi
if test "$use_descriptor_passing" = "yes"; then
AC_DEFINE(USE_DESCRIPTOR_PASSING, 1,
[Defined if descriptor passing is supported])
fi
AM_CONDITIONAL(USE_DESCRIPTOR_PASSING, test "$use_descriptor_passing" = "yes")
# Checking for libgpg-error.
AM_PATH_GPG_ERROR(1.17,, AC_MSG_ERROR([libgpg-error was not found]))
#
# Checks for library functions.
#
AC_CHECK_FUNCS([flockfile funlockfile inet_pton stat getaddrinfo \
getrlimit ])
# If we didn't find inet_pton, it might be in -lsocket (which might
# require -lnsl)
if test X"$ac_cv_func_inet_pton" != X"yes" ; then
AC_SEARCH_LIBS([inet_pton],[socket],[],[],[-lnsl])
if test X"$ac_cv_search_inet_pton" != X"no" ; then
AC_DEFINE([HAVE_INET_PTON],1,[Define to 1 if you have `inet_pton'.])
fi
fi
# On some systems (e.g. Solaris) nanosleep requires linking to librl.
# Given that we use nanosleep only as an optimization over a select
# based wait function we want it only if it is available in libc.
_save_libs="$LIBS"
AC_SEARCH_LIBS([nanosleep], [],
[AC_DEFINE(HAVE_NANOSLEEP,1,
[Define to 1 if you have the `nanosleep' function in libc.])])
LIBS="$_save_libs"
# Check for funopen
AC_CHECK_FUNCS(funopen)
if test $ac_cv_func_funopen != yes; then
# No funopen but we can implement that in terms of fopencookie.
AC_CHECK_FUNCS(fopencookie)
if test $ac_cv_func_fopencookie = yes; then
AC_LIBOBJ([funopen])
else
AC_MSG_WARN([
***
*** No implementation of fopencookie or funopen available.
*** The assuan_get_data_fp function won't work; see the
*** manual for details. GnuPG does not require this feature.
***])
fi
fi
AC_REPLACE_FUNCS(isascii)
AC_REPLACE_FUNCS(putc_unlocked)
AC_REPLACE_FUNCS(memrchr)
AC_REPLACE_FUNCS(stpcpy)
AC_CHECK_HEADERS(unistd.h)
AC_REPLACE_FUNCS(setenv)
#
# Check for the getsockopt SO_PEERCRED, etc.
#
AC_CHECK_MEMBER(struct sockpeercred.pid,
[AC_DEFINE(HAVE_STRUCT_SOCKPEERCRED_PID, 1,
Define if struct sockpeercred contains the pid member.)],
[], [#include
#include ])
# (Open)Solaris
AC_CHECK_FUNCS([getpeerucred])
# FreeBSD
AC_CHECK_FUNCS([getpeereid])
#
# Extra features
#
build_doc=yes
AC_ARG_ENABLE([doc], AC_HELP_STRING([--disable-doc],
[do not build the documentation]),
build_doc=$enableval, build_doc=yes)
AM_CONDITIONAL([BUILD_DOC], [test "x$build_doc" != xno])
#
# Create the config files.
#
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([m4/Makefile])
AC_CONFIG_FILES([src/Makefile])
AC_CONFIG_FILES([doc/Makefile])
AC_CONFIG_FILES([tests/Makefile])
AC_CONFIG_FILES([src/libassuan-config], [chmod +x src/libassuan-config])
AC_CONFIG_FILES([src/versioninfo.rc])
AC_CONFIG_FILES([src/libassuan.pc])
AC_OUTPUT
echo "
Libassuan v${VERSION} has been configured as follows:
Revision: mym4_revision (mym4_revision_dec)
Platform: $host
"
diff --git a/src/assuan.h.in b/src/assuan.h.in
index c4a7e82..59196c4 100644
--- a/src/assuan.h.in
+++ b/src/assuan.h.in
@@ -1,626 +1,626 @@
/* assuan.h - Definitions for the Assuan IPC library -*- c -*-
* Copyright (C) 2001-2013 Free Software Foundation, Inc.
- * Copyright (C) 2001-2019 g10 Code GmbH
+ * Copyright (C) 2001-2020 g10 Code GmbH
*
* This file is part of Assuan.
*
* Assuan is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* Assuan is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, see .
* SPDX-License-Identifier: LGPL-2.1-or-later
*
* @configure_input@
*/
/* Compile time configuration:
*
* #define _ASSUAN_NO_SOCKET_WRAPPER
*
* Do not include the definitions for the socket wrapper feature.
*/
#ifndef ASSUAN_H
#define ASSUAN_H
#include
@include:sys/types.h@
@include:unistd.h@
#include
#ifndef _ASSUAN_NO_SOCKET_WRAPPER
@include:includes@
#endif /*!_ASSUAN_NO_SOCKET_WRAPPER*/
@include:types@
#include
#ifdef __cplusplus
extern "C"
{
#if 0
}
#endif
#endif
/* The version of this header should match the one of the library. Do
* not use this symbol in your application; use assuan_check_version
* instead. */
#define ASSUAN_VERSION @version@
/* The version number of this header. It may be used to handle minor
* API incompatibilities. */
#define ASSUAN_VERSION_NUMBER @version-number@
/* Check for compiler features. */
#if __GNUC__
#define _ASSUAN_GCC_VERSION (__GNUC__ * 10000 \
+ __GNUC_MINOR__ * 100 \
+ __GNUC_PATCHLEVEL__)
#if _ASSUAN_GCC_VERSION > 30100
#define _ASSUAN_DEPRECATED __attribute__ ((__deprecated__))
#endif
#endif
#ifndef _ASSUAN_DEPRECATED
#define _ASSUAN_DEPRECATED
#endif
#define ASSUAN_LINELENGTH 1002 /* 1000 + [CR,]LF */
struct assuan_context_s;
typedef struct assuan_context_s *assuan_context_t;
@include:fd-t@
assuan_fd_t assuan_fdopen (int fd);
@include:sock-nonce@
/*
* Global interface.
*/
struct assuan_malloc_hooks
{
void *(*malloc) (size_t cnt);
void *(*realloc) (void *ptr, size_t cnt);
void (*free) (void *ptr);
};
typedef struct assuan_malloc_hooks *assuan_malloc_hooks_t;
/* Categories for log messages. */
#define ASSUAN_LOG_INIT 1
#define ASSUAN_LOG_CTX 2
#define ASSUAN_LOG_ENGINE 3
#define ASSUAN_LOG_DATA 4
#define ASSUAN_LOG_SYSIO 5
#define ASSUAN_LOG_CONTROL 8
/* If MSG is NULL, return true/false depending on if this category is
* logged. This is used to probe before expensive log message
* generation (buffer dumps). */
typedef int (*assuan_log_cb_t) (assuan_context_t ctx, void *hook,
unsigned int cat, const char *msg);
/* Return or check the version number. */
const char *assuan_check_version (const char *req_version);
/* Set the default gpg error source. */
void assuan_set_gpg_err_source (gpg_err_source_t errsource);
/* Get the default gpg error source. */
gpg_err_source_t assuan_get_gpg_err_source (void);
/* Set the default malloc hooks. */
void assuan_set_malloc_hooks (assuan_malloc_hooks_t malloc_hooks);
/* Get the default malloc hooks. */
assuan_malloc_hooks_t assuan_get_malloc_hooks (void);
/* Set the default log callback handler. */
void assuan_set_log_cb (assuan_log_cb_t log_cb, void *log_cb_data);
/* Get the default log callback handler. */
void assuan_get_log_cb (assuan_log_cb_t *log_cb, void **log_cb_data);
/* Create a new Assuan context. The initial parameters are all needed
* in the creation of the context. */
gpg_error_t assuan_new_ext (assuan_context_t *ctx, gpg_err_source_t errsource,
assuan_malloc_hooks_t malloc_hooks,
assuan_log_cb_t log_cb, void *log_cb_data);
/* Create a new context with default arguments. */
gpg_error_t assuan_new (assuan_context_t *ctx);
/* Release all resources associated with the given context. */
void assuan_release (assuan_context_t ctx);
/* Release the memory at PTR using the allocation handler of the
* context CTX. This is a convenience function. */
void assuan_free (assuan_context_t ctx, void *ptr);
/* Set user-data in a context. */
void assuan_set_pointer (assuan_context_t ctx, void *pointer);
/* Get user-data in a context. */
void *assuan_get_pointer (assuan_context_t ctx);
/* Definitions of flags for assuan_set_flag(). */
typedef unsigned int assuan_flag_t;
/* When using a pipe server, by default Assuan will wait for the
* forked process to die in assuan_release. In certain cases this
* is not desirable. By setting this flag, the waitpid will be
* skipped and the caller is responsible to cleanup a forked
* process. */
#define ASSUAN_NO_WAITPID 1
/* This flag indicates whether Assuan logging is in confidential mode.
You can use assuan_{begin,end}_condidential to change the mode. */
#define ASSUAN_CONFIDENTIAL 2
/* This flag suppresses fix up of signal handlers for pipes. */
#define ASSUAN_NO_FIXSIGNALS 3
/* This flag changes assuan_transact to return comment lines via the
* status callback. The default is to skip comment lines. */
#define ASSUAN_CONVEY_COMMENTS 4
/* This flag disables logging for one context. */
#define ASSUAN_NO_LOGGING 5
/* This flag forces a connection close. */
#define ASSUAN_FORCE_CLOSE 6
/* For context CTX, set the flag FLAG to VALUE. Values for flags
* are usually 1 or 0 but certain flags might allow for other values;
* see the description of the type assuan_flag_t for details. */
void assuan_set_flag (assuan_context_t ctx, assuan_flag_t flag, int value);
/* Return the VALUE of FLAG in context CTX. */
int assuan_get_flag (assuan_context_t ctx, assuan_flag_t flag);
/* Same as assuan_set_flag (ctx, ASSUAN_CONFIDENTIAL, 1). */
void assuan_begin_confidential (assuan_context_t ctx);
/* Same as assuan_set_flag (ctx, ASSUAN_CONFIDENTIAL, 0). */
void assuan_end_confidential (assuan_context_t ctx);
/* Direction values for assuan_set_io_monitor. */
#define ASSUAN_IO_FROM_PEER 0
#define ASSUAN_IO_TO_PEER 1
/* Return flags of I/O monitor. */
#define ASSUAN_IO_MONITOR_NOLOG 1
#define ASSUAN_IO_MONITOR_IGNORE 2
/* The IO monitor gets to see all I/O on the context, and can return
* ASSUAN_IO_MONITOR_* bits to control actions on it. */
typedef unsigned int (*assuan_io_monitor_t) (assuan_context_t ctx, void *hook,
int inout, const char *line,
size_t linelen);
/* Set the IO monitor function. */
void assuan_set_io_monitor (assuan_context_t ctx,
assuan_io_monitor_t io_monitor, void *hook_data);
/* The system hooks. See assuan_set_system_hooks et al. */
#define ASSUAN_SYSTEM_HOOKS_VERSION 2
#define ASSUAN_SPAWN_DETACHED 128
struct assuan_system_hooks
{
/* Always set to ASSUAN_SYTEM_HOOKS_VERSION. */
int version;
/* Sleep for the given number of microseconds. */
void (*usleep) (assuan_context_t ctx, unsigned int usec);
/* Create a pipe with an inheritable end. */
int (*pipe) (assuan_context_t ctx, assuan_fd_t fd[2], int inherit_idx);
/* Close the given file descriptor, created with _assuan_pipe or one
of the socket functions. */
int (*close) (assuan_context_t ctx, assuan_fd_t fd);
ssize_t (*read) (assuan_context_t ctx, assuan_fd_t fd, void *buffer,
size_t size);
ssize_t (*write) (assuan_context_t ctx, assuan_fd_t fd,
const void *buffer, size_t size);
int (*recvmsg) (assuan_context_t ctx, assuan_fd_t fd, assuan_msghdr_t msg,
int flags);
int (*sendmsg) (assuan_context_t ctx, assuan_fd_t fd,
const assuan_msghdr_t msg, int flags);
/* If NAME is NULL, don't exec, just fork. FD_CHILD_LIST is
modified to reflect the value of the FD in the peer process (on
Windows). */
int (*spawn) (assuan_context_t ctx, pid_t *r_pid, const char *name,
const char **argv,
assuan_fd_t fd_in, assuan_fd_t fd_out,
assuan_fd_t *fd_child_list,
void (*atfork) (void *opaque, int reserved),
void *atforkvalue, unsigned int flags);
/* If action is 0, like waitpid. If action is 1, just release the PID? */
pid_t (*waitpid) (assuan_context_t ctx, pid_t pid,
int action, int *status, int options);
int (*socketpair) (assuan_context_t ctx, int _namespace, int style,
int protocol, assuan_fd_t filedes[2]);
int (*socket) (assuan_context_t ctx, int _namespace, int style, int protocol);
int (*connect) (assuan_context_t ctx, int sock, struct sockaddr *addr, socklen_t length);
};
typedef struct assuan_system_hooks *assuan_system_hooks_t;
/*
* Configuration of the default log handler.
*/
/* Set the prefix to be used at the start of a line emitted by assuan
* on the log stream. The default is the empty string. Note, that
* this function is not thread-safe and should in general be used
* right at startup. */
void assuan_set_assuan_log_prefix (const char *text);
/* Return a prefix to be used at the start of a line emitted by assuan
* on the log stream. The default implementation returns the empty
* string, i.e. "". */
const char *assuan_get_assuan_log_prefix (void);
/* Global default log stream. */
void assuan_set_assuan_log_stream (FILE *fp);
/* Set the per context log stream for the default log handler. */
void assuan_set_log_stream (assuan_context_t ctx, FILE *fp);
/* The type for assuan command handlers. */
typedef gpg_error_t (*assuan_handler_t) (assuan_context_t, char *);
/*-- assuan-handler.c --*/
gpg_error_t assuan_register_command (assuan_context_t ctx,
const char *cmd_string,
assuan_handler_t handler,
const char *help_string);
gpg_error_t assuan_register_pre_cmd_notify (assuan_context_t ctx,
gpg_error_t (*fnc)(assuan_context_t,
const char *cmd));
gpg_error_t assuan_register_post_cmd_notify (assuan_context_t ctx,
void (*fnc)(assuan_context_t,
gpg_error_t));
gpg_error_t assuan_register_bye_notify (assuan_context_t ctx,
assuan_handler_t handler);
gpg_error_t assuan_register_reset_notify (assuan_context_t ctx,
assuan_handler_t handler);
gpg_error_t assuan_register_cancel_notify (assuan_context_t ctx,
assuan_handler_t handler);
gpg_error_t assuan_register_input_notify (assuan_context_t ctx,
assuan_handler_t handler);
gpg_error_t assuan_register_output_notify (assuan_context_t ctx,
assuan_handler_t handler);
gpg_error_t assuan_register_option_handler (assuan_context_t ctx,
gpg_error_t (*fnc)(assuan_context_t,
const char*,
const char*));
gpg_error_t assuan_process (assuan_context_t ctx);
gpg_error_t assuan_process_next (assuan_context_t ctx, int *done);
gpg_error_t assuan_process_done (assuan_context_t ctx, gpg_error_t rc);
int assuan_get_active_fds (assuan_context_t ctx, int what,
assuan_fd_t *fdarray, int fdarraysize);
const char *assuan_get_command_name (assuan_context_t ctx);
FILE *assuan_get_data_fp (assuan_context_t ctx);
gpg_error_t assuan_set_okay_line (assuan_context_t ctx, const char *line);
gpg_error_t assuan_write_status (assuan_context_t ctx,
const char *keyword, const char *text);
/* Negotiate a file descriptor. If LINE contains "FD=N", returns N
* assuming a local file descriptor. If LINE contains "FD" reads a
* file descriptor via CTX and stores it in *RDF (the CTX must be
* capable of passing file descriptors). Under Windows the returned
* FD is a libc-type one. */
gpg_error_t assuan_command_parse_fd (assuan_context_t ctx, char *line,
assuan_fd_t *rfd);
/*-- assuan-listen.c --*/
gpg_error_t assuan_set_hello_line (assuan_context_t ctx, const char *line);
gpg_error_t assuan_accept (assuan_context_t ctx);
assuan_fd_t assuan_get_input_fd (assuan_context_t ctx);
assuan_fd_t assuan_get_output_fd (assuan_context_t ctx);
gpg_error_t assuan_close_input_fd (assuan_context_t ctx);
gpg_error_t assuan_close_output_fd (assuan_context_t ctx);
/*-- assuan-pipe-server.c --*/
gpg_error_t assuan_init_pipe_server (assuan_context_t ctx,
assuan_fd_t filedes[2]);
/*-- assuan-socket-server.c --*/
#define ASSUAN_SOCKET_SERVER_FDPASSING 1
#define ASSUAN_SOCKET_SERVER_ACCEPTED 2
gpg_error_t assuan_init_socket_server (assuan_context_t ctx,
assuan_fd_t listen_fd,
unsigned int flags);
void assuan_set_sock_nonce (assuan_context_t ctx, assuan_sock_nonce_t *nonce);
/*-- assuan-pipe-connect.c --*/
#define ASSUAN_PIPE_CONNECT_FDPASSING 1
#define ASSUAN_PIPE_CONNECT_DETACHED 128
gpg_error_t assuan_pipe_connect (assuan_context_t ctx,
const char *name,
const char *argv[],
assuan_fd_t *fd_child_list,
void (*atfork) (void *, int),
void *atforkvalue,
unsigned int flags);
/*-- assuan-socket-connect.c --*/
#define ASSUAN_SOCKET_CONNECT_FDPASSING 1
gpg_error_t assuan_socket_connect (assuan_context_t ctx, const char *name,
pid_t server_pid, unsigned int flags);
/*-- assuan-socket-connect.c --*/
gpg_error_t assuan_socket_connect_fd (assuan_context_t ctx, int fd,
unsigned int flags);
/*-- context.c --*/
pid_t assuan_get_pid (assuan_context_t ctx);
struct _assuan_peercred
{
#ifdef _WIN32
/* Empty struct not allowed on some compilers, so, put this (not valid). */
pid_t pid;
#else
pid_t pid;
uid_t uid;
gid_t gid;
#endif
};
typedef struct _assuan_peercred *assuan_peercred_t;
gpg_error_t assuan_get_peercred (assuan_context_t ctx,
assuan_peercred_t *peercred);
/*
* Client interface.
*/
/* Client response codes. */
#define ASSUAN_RESPONSE_ERROR 0
#define ASSUAN_RESPONSE_OK 1
#define ASSUAN_RESPONSE_DATA 2
#define ASSUAN_RESPONSE_INQUIRE 3
#define ASSUAN_RESPONSE_STATUS 4
#define ASSUAN_RESPONSE_END 5
#define ASSUAN_RESPONSE_COMMENT 6
typedef int assuan_response_t;
/* This already de-escapes data lines. */
gpg_error_t assuan_client_read_response (assuan_context_t ctx,
char **line, int *linelen);
gpg_error_t assuan_client_parse_response (assuan_context_t ctx,
char *line, int linelen,
assuan_response_t *response,
int *off);
/*-- assuan-client.c --*/
gpg_error_t
assuan_transact (assuan_context_t ctx,
const char *command,
gpg_error_t (*data_cb)(void *, const void *, size_t),
void *data_cb_arg,
gpg_error_t (*inquire_cb)(void*, const char *),
void *inquire_cb_arg,
gpg_error_t (*status_cb)(void*, const char *),
void *status_cb_arg);
/*-- assuan-inquire.c --*/
gpg_error_t assuan_inquire (assuan_context_t ctx, const char *keyword,
unsigned char **r_buffer, size_t *r_length,
size_t maxlen);
gpg_error_t assuan_inquire_ext (assuan_context_t ctx, const char *keyword,
size_t maxlen,
gpg_error_t (*cb) (void *cb_data,
gpg_error_t rc,
unsigned char *buf,
size_t buf_len),
void *cb_data);
/*-- assuan-buffer.c --*/
gpg_error_t assuan_read_line (assuan_context_t ctx,
char **line, size_t *linelen);
int assuan_pending_line (assuan_context_t ctx);
gpg_error_t assuan_write_line (assuan_context_t ctx, const char *line);
gpg_error_t assuan_send_data (assuan_context_t ctx,
const void *buffer, size_t length);
/* The file descriptor must be pending before assuan_receivefd is
* called. This means that assuan_sendfd should be called *before* the
* trigger is sent (normally via assuan_write_line ("INPUT FD")). */
gpg_error_t assuan_sendfd (assuan_context_t ctx, assuan_fd_t fd);
gpg_error_t assuan_receivefd (assuan_context_t ctx, assuan_fd_t *fd);
/*-- assuan-util.c --*/
gpg_error_t assuan_set_error (assuan_context_t ctx, gpg_error_t err,
const char *text);
/*-- assuan-socket.c --*/
/* This flag is used with assuan_sock_connect_byname to
* connect via SOCKS. */
#define ASSUAN_SOCK_SOCKS 1
/* This flag is used with assuan_sock_connect_byname to force a
connection via Tor even if the socket subsystem has not been
swicthed into Tor mode. This flags overrides ASSUAN_SOCK_SOCKS. */
#define ASSUAN_SOCK_TOR 2
/* These are socket wrapper functions to support an emulation of Unix
* domain sockets on Windows. */
gpg_error_t assuan_sock_init (void);
void assuan_sock_deinit (void);
int assuan_sock_close (assuan_fd_t fd);
assuan_fd_t assuan_sock_new (int domain, int type, int proto);
int assuan_sock_set_flag (assuan_fd_t sockfd, const char *name, int value);
int assuan_sock_get_flag (assuan_fd_t sockfd, const char *name, int *r_value);
int assuan_sock_connect (assuan_fd_t sockfd,
struct sockaddr *addr, int addrlen);
assuan_fd_t assuan_sock_connect_byname (const char *host, unsigned short port,
int reserved,
const char *credentials,
unsigned int flags);
int assuan_sock_bind (assuan_fd_t sockfd, struct sockaddr *addr, int addrlen);
int assuan_sock_set_sockaddr_un (const char *fname, struct sockaddr *addr,
int *r_redirected);
int assuan_sock_get_nonce (struct sockaddr *addr, int addrlen,
assuan_sock_nonce_t *nonce);
int assuan_sock_check_nonce (assuan_fd_t fd, assuan_sock_nonce_t *nonce);
void assuan_sock_set_system_hooks (assuan_system_hooks_t system_hooks);
/* Set the default system callbacks. This is irreversible. */
void assuan_set_system_hooks (assuan_system_hooks_t system_hooks);
/* Set the per context system callbacks. This is irreversible. */
void assuan_ctx_set_system_hooks (assuan_context_t ctx,
assuan_system_hooks_t system_hooks);
/* Change the system hooks for the socket interface.
* This is not thread-safe. */
void assuan_sock_set_system_hooks (assuan_system_hooks_t system_hooks);
void __assuan_usleep (assuan_context_t ctx, unsigned int usec);
int __assuan_pipe (assuan_context_t ctx, assuan_fd_t fd[2], int inherit_idx);
int __assuan_close (assuan_context_t ctx, assuan_fd_t fd);
int __assuan_spawn (assuan_context_t ctx, pid_t *r_pid, const char *name,
const char **argv, assuan_fd_t fd_in, assuan_fd_t fd_out,
assuan_fd_t *fd_child_list,
void (*atfork) (void *opaque, int reserved),
void *atforkvalue, unsigned int flags);
int __assuan_socketpair (assuan_context_t ctx, int _namespace, int style,
int protocol, assuan_fd_t filedes[2]);
int __assuan_socket (assuan_context_t ctx, int _namespace, int style, int protocol);
int __assuan_connect (assuan_context_t ctx, int sock, struct sockaddr *addr, socklen_t length);
ssize_t __assuan_read (assuan_context_t ctx, assuan_fd_t fd, void *buffer, size_t size);
ssize_t __assuan_write (assuan_context_t ctx, assuan_fd_t fd, const void *buffer, size_t size);
int __assuan_recvmsg (assuan_context_t ctx, assuan_fd_t fd, assuan_msghdr_t msg, int flags);
int __assuan_sendmsg (assuan_context_t ctx, assuan_fd_t fd, const assuan_msghdr_t msg, int flags);
pid_t __assuan_waitpid (assuan_context_t ctx, pid_t pid, int nowait, int *status, int options);
/* Standard system hooks for the legacy GNU Pth. */
#define ASSUAN_SYSTEM_PTH_IMPL \
static void _assuan_pth_usleep (assuan_context_t ctx, unsigned int usec) \
{ (void) ctx; pth_usleep (usec); } \
static ssize_t _assuan_pth_read (assuan_context_t ctx, assuan_fd_t fd, \
void *buffer, size_t size) \
{ (void) ctx; return pth_read (fd, buffer, size); } \
static ssize_t _assuan_pth_write (assuan_context_t ctx, assuan_fd_t fd, \
const void *buffer, size_t size) \
{ (void) ctx; return pth_write (fd, buffer, size); } \
@include:sys-pth-impl@
static pid_t _assuan_pth_waitpid (assuan_context_t ctx, pid_t pid, \
int nowait, int *status, int options) \
{ (void) ctx; \
if (!nowait) return pth_waitpid (pid, status, options); \
else return 0; } \
\
struct assuan_system_hooks _assuan_system_pth = \
{ ASSUAN_SYSTEM_HOOKS_VERSION, _assuan_pth_usleep, __assuan_pipe, \
__assuan_close, _assuan_pth_read, _assuan_pth_write, \
_assuan_pth_recvmsg, _assuan_pth_sendmsg, \
__assuan_spawn, _assuan_pth_waitpid, __assuan_socketpair, \
__assuan_socket, __assuan_connect }
extern struct assuan_system_hooks _assuan_system_pth;
#define ASSUAN_SYSTEM_PTH &_assuan_system_pth
/* Standard system hooks for nPth. */
#define ASSUAN_SYSTEM_NPTH_IMPL \
static void _assuan_npth_usleep (assuan_context_t ctx, unsigned int usec) \
{ npth_unprotect(); \
__assuan_usleep (ctx, usec); \
npth_protect(); } \
static ssize_t _assuan_npth_read (assuan_context_t ctx, assuan_fd_t fd, \
void *buffer, size_t size) \
{ ssize_t res; (void) ctx; npth_unprotect(); \
res = __assuan_read (ctx, fd, buffer, size); \
npth_protect(); return res; } \
static ssize_t _assuan_npth_write (assuan_context_t ctx, assuan_fd_t fd, \
const void *buffer, size_t size) \
{ ssize_t res; (void) ctx; npth_unprotect(); \
res = __assuan_write (ctx, fd, buffer, size); \
npth_protect(); return res; } \
static int _assuan_npth_recvmsg (assuan_context_t ctx, assuan_fd_t fd, \
assuan_msghdr_t msg, int flags) \
{ int res; (void) ctx; npth_unprotect(); \
res = __assuan_recvmsg (ctx, fd, msg, flags); \
npth_protect(); return res; } \
static int _assuan_npth_sendmsg (assuan_context_t ctx, assuan_fd_t fd, \
const assuan_msghdr_t msg, int flags) \
{ int res; (void) ctx; npth_unprotect(); \
res = __assuan_sendmsg (ctx, fd, msg, flags); \
npth_protect(); return res; } \
static pid_t _assuan_npth_waitpid (assuan_context_t ctx, pid_t pid, \
int nowait, int *status, int options) \
{ pid_t res; (void) ctx; npth_unprotect(); \
res = __assuan_waitpid (ctx, pid, nowait, status, options); \
npth_protect(); return res; } \
static int _assuan_npth_connect (assuan_context_t ctx, int sock, \
struct sockaddr *addr, socklen_t len)\
{ int res; npth_unprotect(); \
res = __assuan_connect (ctx, sock, addr, len); \
npth_protect(); return res; } \
static int _assuan_npth_close (assuan_context_t ctx, assuan_fd_t fd) \
{ int res; npth_unprotect(); \
res = __assuan_close (ctx, fd); \
npth_protect(); return res; } \
\
struct assuan_system_hooks _assuan_system_npth = \
{ ASSUAN_SYSTEM_HOOKS_VERSION, _assuan_npth_usleep, __assuan_pipe, \
_assuan_npth_close, _assuan_npth_read, _assuan_npth_write, \
_assuan_npth_recvmsg, _assuan_npth_sendmsg, \
__assuan_spawn, _assuan_npth_waitpid, __assuan_socketpair, \
__assuan_socket, _assuan_npth_connect }
extern struct assuan_system_hooks _assuan_system_npth;
#define ASSUAN_SYSTEM_NPTH &_assuan_system_npth
@include:w32ce-add@
#ifdef __cplusplus
}
#endif
#endif /* ASSUAN_H */
diff --git a/src/sysutils.c b/src/sysutils.c
index b3679d7..6c09e47 100644
--- a/src/sysutils.c
+++ b/src/sysutils.c
@@ -1,140 +1,140 @@
/* sysutils.c - System utilities
* Copyright (C) 2010 Free Software Foundation, Inc.
*
* This file is part of Assuan.
*
* Assuan is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* Assuan is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, see .
* SPDX-License-Identifier: LGPL-2.1+
*/
#ifdef HAVE_CONFIG_H
#include
#endif
#include
#include
#include
#include
#ifdef HAVE_W32_SYSTEM
# ifdef HAVE_WINSOCK2_H
# include
# endif
# include
# ifdef HAVE_W32CE_SYSTEM
# include
# endif /*HAVE_W32CE_SYSTEM*/
#endif /*HAVE_W32_SYSTEM*/
#include "assuan-defs.h"
/* This is actually a dummy function to make sure that is module is
not empty. Some compilers barf on empty modules. */
const char *
_assuan_sysutils_blurb (void)
{
static const char blurb[] =
"\n\n"
"This is Libassuan " PACKAGE_VERSION " - The GnuPG IPC Library\n"
"Copyright 2001-2013 Free Software Foundation, Inc.\n"
- "Copyright 2001-2019 g10 Code GmbH\n"
+ "Copyright 2001-2020 g10 Code GmbH\n"
"\n"
"SPDX-License-Identifier: LGPL-2.1-or-later\n"
"(" BUILD_REVISION " " BUILD_TIMESTAMP ")\n"
"\n\n";
return blurb;
}
/* Return a string from the Win32 Registry or NULL in case of error.
The returned string is allocated using a plain malloc and thus the
caller needs to call the standard free(). The string is looked up
under HKEY_LOCAL_MACHINE. */
#ifdef HAVE_W32CE_SYSTEM
static char *
w32_read_registry (const wchar_t *dir, const wchar_t *name)
{
HKEY handle;
DWORD n, nbytes;
wchar_t *buffer = NULL;
char *result = NULL;
if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, dir, 0, KEY_READ, &handle))
return NULL; /* No need for a RegClose, so return immediately. */
nbytes = 1;
if (RegQueryValueEx (handle, name, 0, NULL, NULL, &nbytes))
goto out;
buffer = malloc ((n=nbytes+2));
if (!buffer)
goto out;
if (RegQueryValueEx (handle, name, 0, NULL, (PBYTE)buffer, &n))
{
free (buffer);
buffer = NULL;
goto out;
}
n = WideCharToMultiByte (CP_UTF8, 0, buffer, nbytes, NULL, 0, NULL, NULL);
if (n < 0 || (n+1) <= 0)
goto out;
result = malloc (n+1);
if (!result)
goto out;
n = WideCharToMultiByte (CP_UTF8, 0, buffer, nbytes, result, n, NULL, NULL);
if (n < 0)
{
free (result);
result = NULL;
goto out;
}
result[n] = 0;
out:
free (buffer);
RegCloseKey (handle);
return result;
}
#endif /*HAVE_W32CE_SYSTEM*/
#ifdef HAVE_W32CE_SYSTEM
/* Replacement for getenv which takes care of the our use of getenv.
The code is not thread safe but we expect it to work in all cases
because it is called for the first time early enough. */
char *
_assuan_getenv (const char *name)
{
static int initialized;
static char *val_debug;
static char *val_full_logging;
if (!initialized)
{
val_debug = w32_read_registry (L"\\Software\\GNU\\libassuan",
L"debug");
val_full_logging = w32_read_registry (L"\\Software\\GNU\\libassuan",
L"full_logging");
initialized = 1;
}
if (!strcmp (name, "ASSUAN_DEBUG"))
return val_debug;
else if (!strcmp (name, "ASSUAN_FULL_LOGGING"))
return val_full_logging;
else
return NULL;
}
#endif /*HAVE_W32CE_SYSTEM*/
diff --git a/src/versioninfo.rc.in b/src/versioninfo.rc.in
index 8df9073..2e03af5 100644
--- a/src/versioninfo.rc.in
+++ b/src/versioninfo.rc.in
@@ -1,52 +1,52 @@
/* versioninfo.rc.in - for assuan
* Copyright (C) 2005 g10 Code GmbH
*
* This file is free software; as a special exception the author gives
* unlimited permission to copy and/or distribute it, with or without
* modifications, as long as this notice is preserved.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* SPDX-License-Identifier: FSFULLR
*/
/* This file is processed by configure to create versioninfo.rc */
#line __LINE__ "versioninfo.rc.in"
#include
VS_VERSION_INFO VERSIONINFO
FILEVERSION @BUILD_FILEVERSION@
PRODUCTVERSION @BUILD_FILEVERSION@
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x21L
#else
FILEFLAGS 0x20L
#endif
FILEOS 0x40004L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "Provided under the terms of the GNU Lesser General Public License.\0"
VALUE "CompanyName", "g10 Code GmbH\0"
VALUE "FileDescription", "Assuan - GnuPG IPC\0"
VALUE "FileVersion", "@LIBASSUAN_LT_CURRENT@.@LIBASSUAN_LT_AGE@.@LIBASSUAN_LT_REVISION@.@BUILD_REVISION@\0"
VALUE "InternalName", "libassuan\0"
- VALUE "LegalCopyright", "Copyright © 2001-2019 g10 Code GmbH\0"
+ VALUE "LegalCopyright", "Copyright © 2001-2020 g10 Code GmbH\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "libassuan.dll\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "Assuan\0"
VALUE "ProductVersion", "@VERSION@\0"
VALUE "SpecialBuild", "@BUILD_TIMESTAMP@\0"
END
END
END