libassuan.git
3 months agotests: Exclude tests for Windows build. master
NIIBE Yutaka [Tue, 27 Mar 2018 05:26:43 +0000 (14:26 +0900)]
tests: Exclude tests for Windows build.

* tests/Makefile.am [HAVE_W32_SYSTEM] (TESTS, testtools): Fix.

--

pipeconnect and socks5 should be changed if we run it on Windows.  If
so, pipeconnect should use _open_osfhandle to get HANDLE for pipe.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
4 months agoSilence two minor warning on Windows.
NIIBE Yutaka [Mon, 26 Feb 2018 02:33:44 +0000 (11:33 +0900)]
Silence two minor warning on Windows.

* src/assuan-defs.h [HAVE_W64_SYSTEM] (SOCKET2HANDLE): Care for size
of integer.
* src/stpcpy.c: No K&R anymore.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
4 months agoFix previous commit.
NIIBE Yutaka [Fri, 23 Feb 2018 00:48:34 +0000 (09:48 +0900)]
Fix previous commit.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
4 months agoBetter credential support for other OSes.
NIIBE Yutaka [Tue, 20 Feb 2018 01:48:52 +0000 (10:48 +0900)]
Better credential support for other OSes.

* configure.ac (HAVE_UCRED_H, HAVE_SYS_UCRED_H): Check these headers
unconditionally.
(HAVE_SO_PEERCRED, HAVE_LOCAL_PEEREID): Remove.
(HAVE_STRUCT_SOCKPEERCRED_PID): New.
(HAVE_GETPEEREID): New.
* src/assuan-socket-server.c (accept_connection_bottom): Add
support for OpenBSD, macOS, and FreeBSD.

--

Code in gpg-agent/command-ssh.c are integrated.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
7 months agoPost release updates
Werner Koch [Thu, 7 Dec 2017 14:58:43 +0000 (15:58 +0100)]
Post release updates

--

7 months agoRelease 2.5.1 libassuan-2.5.1
Werner Koch [Thu, 7 Dec 2017 14:54:01 +0000 (15:54 +0100)]
Release 2.5.1

Signed-off-by: Werner Koch <wk@gnupg.org>
7 months agoFix regression in ASSUAN_SYSTEM_NPTH_IMPL.
Werner Koch [Thu, 7 Dec 2017 14:08:20 +0000 (15:08 +0100)]
Fix regression in ASSUAN_SYSTEM_NPTH_IMPL.

* src/assuan.h.in (ASSUAN_SYSTEM_NPTH_IMPL): A void fucntion can't
assign.
--

Fixes-commit: a627350eed5dc32bac41195462f27dee1987b0f5
Signed-off-by: Werner Koch <wk@gnupg.org>
7 months agoPost release updates
Werner Koch [Thu, 7 Dec 2017 13:17:07 +0000 (14:17 +0100)]
Post release updates

--

7 months agoRelease 2.5.0 libassuan-2.5.0
Werner Koch [Thu, 7 Dec 2017 13:09:08 +0000 (14:09 +0100)]
Release 2.5.0

Signed-off-by: Werner Koch <wk@gnupg.org>
7 months agoAllow change of system hooks for assuan_sock_...
NIIBE Yutaka [Thu, 7 Dec 2017 12:41:46 +0000 (13:41 +0100)]
Allow change of system hooks for assuan_sock_...

* src/assuan-socket.c (assuan_sock_set_system_hooks): New.
* src/assuan.h.in (assuan_sock_set_system_hooks): New prototype.
* src/libassuan.def: Add new function.
* src/libassuan.vers: Add new function.
--

Co-authored-by: wk@gnupg.org
Signed-off-by: Werner Koch <wk@gnupg.org>
7 months agoUse wrapped __assuan_usleep for _assuan_npth_usleep.
NIIBE Yutaka [Wed, 6 Dec 2017 10:56:34 +0000 (19:56 +0900)]
Use wrapped __assuan_usleep for _assuan_npth_usleep.

* src/assuan.h.in (_assuan_npth_usleep): Wrap __assuan_usleep.

--

Assuan should support system hooks for nPth before npth_init.

Before the call of npth_init, npth_unprotect and npth_protect do
nothing, whiile npth_usleep may crash.

No use of npth_usleep is better.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
7 months agoPost release updates
Werner Koch [Fri, 1 Dec 2017 14:41:08 +0000 (15:41 +0100)]
Post release updates

--

7 months agoRelease 2.4.5 libassuan-2.4.5
Werner Koch [Fri, 1 Dec 2017 14:27:46 +0000 (15:27 +0100)]
Release 2.4.5

7 months agoWrap assuan_close for nPth.
NIIBE Yutaka [Thu, 30 Nov 2017 08:48:32 +0000 (17:48 +0900)]
Wrap assuan_close for nPth.

* src/assuan.h.in (_assuan_npth_close): New.
(_assuan_system_npth): Use _assuan_npth_close.

--

In some situation, closesocket on Windows may block.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
7 months agotests: Fix build.
Ben Kibbey [Mon, 20 Nov 2017 18:44:47 +0000 (10:44 -0800)]
tests: Fix build.

* tests/fdpassing.c: Include config.h to define GPGRT_ENABLE_ES_MACROS.

Signed-off-by: Ben Kibbey <bjk@luxsci.net>
8 months agoPost release updates.
Werner Koch [Thu, 16 Nov 2017 08:42:45 +0000 (09:42 +0100)]
Post release updates.

--

8 months agoRelease 2.4.4 libassuan-2.4.4
Werner Koch [Thu, 16 Nov 2017 08:29:25 +0000 (09:29 +0100)]
Release 2.4.4

Signed-off-by: Werner Koch <wk@gnupg.org>
8 months agoAdd special check version request \001\001
Werner Koch [Wed, 15 Nov 2017 17:44:09 +0000 (18:44 +0100)]
Add special check version request \001\001

* src/assuan.c (assuan_check_version): Handle version "\001\001"
* tests/version.c (main): Print extended version info.

Signed-off-by: Werner Koch <wk@gnupg.org>
8 months agoLet configure create the VERSION file.
Werner Koch [Wed, 15 Nov 2017 17:29:52 +0000 (18:29 +0100)]
Let configure create the VERSION file.

* autogen.sh: Update from Libgpg-error
* configure.ac: Create file VERSION.
* Makefile.am (dist-hook): Do not create VERSION.
(EXTRA_DIST): Add VERSION.
--

GnuPG-bug-id: 3283

8 months agoAdd an SPDX tag to all core files.
Werner Koch [Wed, 15 Nov 2017 16:07:06 +0000 (17:07 +0100)]
Add an SPDX tag to all core files.

--

8 months agoFix last commit.
Werner Koch [Wed, 15 Nov 2017 16:05:46 +0000 (17:05 +0100)]
Fix last commit.

* src/system-posix.c (__assuan_usleep): Its ysec and usecs
--

Copy+Paste without even compiling was pretty dumb.

Signed-off-by: Werner Koch <wk@gnupg.org>
8 months agoFix the nanosleep case of __assuan_usleep.
Werner Koch [Wed, 15 Nov 2017 14:43:24 +0000 (15:43 +0100)]
Fix the nanosleep case of __assuan_usleep.

* src/system-posix.c (__assuan_usleep): Handle full seconds.
--

This function would have failed for any value >= 1000000 because the
nsec field is limited to 999999999 and the function fails for larger
values.

Signed-off-by: Werner Koch <wk@gnupg.org>
10 months agoWe can't support fd passing, if the system doesn't support it.
NIIBE Yutaka [Wed, 6 Sep 2017 09:25:56 +0000 (18:25 +0900)]
We can't support fd passing, if the system doesn't support it.

* configure.ac (check_descriptor_passing): New.
(use_descriptor_passing): Use check_descriptor_passing.

--

GnuPG-bug-id: 3384
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
10 months agoDefine INADDR_LOOPBACK if not defined.
NIIBE Yutaka [Wed, 6 Sep 2017 06:24:10 +0000 (15:24 +0900)]
Define INADDR_LOOPBACK if not defined.

* src/assuan-socket.c (INADDR_LOOPBACK): Define.

--

INADDR_LOOPBACK is not defined in some systems.  When defined, its
byte-order is not clearly defined in any specifications.  So, best
portable way is not to use the macro INADDR_LOOPBACK at all but use
0x7f000001 directly.

Nevertheless, for systems which use libassuan, it's host byte-order.
So, adding the definition works.

GnuPG-bug-id: 2447
Suggested-by: Peter Dyballa
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
13 months agoconfigure: Add flag to disable documentation build.
Marcus Brinkmann [Mon, 19 Jun 2017 11:31:10 +0000 (13:31 +0200)]
configure: Add flag to disable documentation build.

* configure.ac: Add new option --disable-doc.
(BUILD_DOC): New automake conditional.
* Makefile.am (SUBDIRS): Make doc optional based on BUILD_DOC.
(DISTCHECK_CONFIGURE_FLAGS): New variable.

Signed-Off-By: Marcus Brinkmann <mb@g10code.com>
13 months agoUse gpgrt_free to release memory allocated by gpgrt_asprintf.
NIIBE Yutaka [Wed, 31 May 2017 11:18:53 +0000 (20:18 +0900)]
Use gpgrt_free to release memory allocated by gpgrt_asprintf.

* src/assuan-logging.c (_assuan_log_control_channel): Use gpgrt_free.
* src/debug.c (_assuan_debug, _assuan_debug_add, _assuan_debug_end):
Likewise.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
16 months agobuild: Use macOS' compatibility macros to enable all features.
Justus Winter [Wed, 8 Mar 2017 11:11:04 +0000 (12:11 +0100)]
build: Use macOS' compatibility macros to enable all features.

* configure.ac: On macOS, use the compatibility macros to expose every
feature of the libc.  This is the equivalent of _GNU_SOURCE on GNU
libc.
--
Not defining this leads to compilation errors or superfluous warnings
on macOS.

GnuPG-bug-id: 2910
Signed-off-by: Justus Winter <justus@g10code.com>
22 months agoEPROTO portability fix.
Ben Kibbey [Sun, 4 Sep 2016 18:22:25 +0000 (14:22 -0400)]
EPROTO portability fix.

* src/assuan-socket.c(socks5_connect): Return EPROTONOSUPPORT rather
than EPROTO.
--

OpenBSD, and maybe other systems, doesn't define EPROTO.

Signed-off-by: Ben Kibbey <bjk@luxsci.net>
2 years agoPost release updates
Werner Koch [Thu, 14 Jul 2016 08:14:19 +0000 (10:14 +0200)]
Post release updates

--

2 years agoRelease 2.4.3. libassuan-2.4.3
Werner Koch [Thu, 14 Jul 2016 08:05:34 +0000 (10:05 +0200)]
Release 2.4.3.

* configure.ac: Set LT version to C7/A7/R3.
* Makefile.am (distcheck-hook): New.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agobuild: Update config.{guess,sub} to {2016-05-15,2016-06-20}.
Werner Koch [Wed, 13 Jul 2016 17:01:28 +0000 (19:01 +0200)]
build: Update config.{guess,sub} to {2016-05-15,2016-06-20}.

* build-aux/config.guess: Update.
* build-aux/config.sub: Update.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoImprove test for inet_pton on Solaris.
Werner Koch [Wed, 13 Jul 2016 14:21:06 +0000 (16:21 +0200)]
Improve test for inet_pton on Solaris.

* configure.ac (HAVE_INET_PTON): Add a fallback test.
--

GnuPG-bug-id: 1476
Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoAllow socket redirection with assuan_socket_connect.
Werner Koch [Wed, 13 Jul 2016 14:11:45 +0000 (16:11 +0200)]
Allow socket redirection with assuan_socket_connect.

* src/assuan-socket-connect.c (assuan_socket_connect): Use
set_socketaddr function.
--

GnuPG-bug-id: 2253
Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoSpeedup closing fds before an exec.
Werner Koch [Wed, 13 Jul 2016 13:33:41 +0000 (15:33 +0200)]
Speedup closing fds before an exec.

* src/system-posix.c [__linux__]: Include dirent.h.
(get_max_fds) [__linux__]: Return the actual used highest fd.
--

This is the same code as introduced with the
GnuPG commit 512c56af43027149e8beacf259746b8d7bf9b1a2

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoFix distcheck.
Justus Winter [Tue, 5 Jul 2016 11:46:37 +0000 (13:46 +0200)]
Fix distcheck.

* tests/Makefile.am (EXTRA_DIST): Drop compiled test.

Signed-off-by: Justus Winter <justus@g10code.com>
2 years agoFix minor memory leaks
Werner Koch [Sat, 25 Jun 2016 14:59:16 +0000 (16:59 +0200)]
Fix minor memory leaks

* src/assuan-pipe-connect.c (socketpair_connect): Always free
CHILD_FDS.
* src/assuan-uds.c (uds_sendfd): Clear CONTROL_U to silence Valgrind.
* tests/fdpassing.c (main): Free FNAME.

* src/assuan-handler.c (dispatch_command): Remove dead assignment.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoImprove getting of max. number of open fds.
Werner Koch [Fri, 15 Jan 2016 14:17:26 +0000 (15:17 +0100)]
Improve getting of max. number of open fds.

* configure.ac (AC_CHECK_FUNCS): Add getrlimit.
* src/assuan-pipe-connect.c (MAX_OPEN_FDS): Remove non-used macro.
* src/system.c (MAX_OPEN_FDS): Remove non-used macro.
* src/system-posix.c: Include stdint.h, sys/time.h, sys/resource.h.
(MAX_OPEN_FDS): Remove non-used macro.
(get_max_fds): New.  Taken from gnupg/common/exechelp-posix.c.
(__assuan_spawn): Use it here.
--

This is related to
GnuPG-bug-id: 2071

Changing of get_max_fds from LPGLv3+ to LGPLv2+ approved by me as sole
author or that code.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoPost release updates.
Werner Koch [Wed, 2 Dec 2015 13:21:26 +0000 (14:21 +0100)]
Post release updates.

--

2 years agoRelease 2.4.2. libassuan-2.4.2
Werner Koch [Wed, 2 Dec 2015 12:49:20 +0000 (13:49 +0100)]
Release 2.4.2.

* configure.ac: Bump LT version to C7/A7/R2.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoFix typos found by codespell.
Justus Winter [Tue, 1 Dec 2015 13:00:27 +0000 (14:00 +0100)]
Fix typos found by codespell.

--
Signed-off-by: Justus Winter <justus@g10code.com>
2 years agoNew feature to test for SOCKS5 proxy availability.
Werner Koch [Fri, 27 Nov 2015 10:54:52 +0000 (11:54 +0100)]
New feature to test for SOCKS5 proxy availability.

* src/assuan-socket.c (socks5_connect): Add special treatment for
empty hostnames.
(_assuan_sock_connect_byname): Add feature to test for proxy
availibility.
* tests/socks5.c (main): Add option --have-proxy.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoProtect connect system hook against blocking (nPth).
Werner Koch [Thu, 26 Nov 2015 17:16:13 +0000 (18:16 +0100)]
Protect connect system hook against blocking (nPth).

* src/assuan.h.in (ASSUAN_SYSTEM_NPTH_IMPL): Add wrapper for connect.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoDo not use size_t with _assuan_read.
Werner Koch [Thu, 26 Nov 2015 15:33:42 +0000 (16:33 +0100)]
Do not use size_t with _assuan_read.

* src/assuan-socket.c (do_readn): Use ssize_t for N.

2 years agoPost release updates
Werner Koch [Mon, 23 Nov 2015 14:47:16 +0000 (15:47 +0100)]
Post release updates

--

2 years agoRelease 2.4.1. libassuan-2.4.1
Werner Koch [Mon, 23 Nov 2015 14:42:51 +0000 (15:42 +0100)]
Release 2.4.1.

* configure.ac: Bump LT version to C7/A7/R1.

2 years agoMake socks5 test case a bit more robust.
Werner Koch [Mon, 23 Nov 2015 14:04:11 +0000 (15:04 +0100)]
Make socks5 test case a bit more robust.

* tests/socks5.c (main): Call gpgrt_init.  Check for write and read
errors.  Allow building of some parts even w/o getaddrinfo.

2 years agoAlso try port 9150 in Tor mode.
Werner Koch [Sat, 21 Nov 2015 12:13:52 +0000 (13:13 +0100)]
Also try port 9150 in Tor mode.

* src/assuan-socket.c (TOR_PORT2): New.
(_assuan_sock_wsa2errno): Map WSAECONNREFUSED.
(socks5_connect): Fall back to TOR_PORT2.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoFix windows build with mingw-w64 2.0.x
Andre Heinecke [Fri, 13 Nov 2015 14:53:00 +0000 (15:53 +0100)]
Fix windows build with mingw-w64 2.0.x

* src/assuan-socket.c: Add errno values not defined by mingw-w64 2.0

2 years agoPost release updates.
Werner Koch [Tue, 3 Nov 2015 14:49:17 +0000 (15:49 +0100)]
Post release updates.

--

2 years agoRelease 2.4.0 libassuan-2.4.0
Werner Koch [Tue, 3 Nov 2015 14:42:10 +0000 (15:42 +0100)]
Release 2.4.0

* configure.ac: Bump LT version to C7/A7/Ro.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agow32: Use assuan_fd_t with the new socket functions.
Werner Koch [Tue, 3 Nov 2015 14:39:08 +0000 (15:39 +0100)]
w32: Use assuan_fd_t with the new socket functions.

* src/assuan-socket.c (socks5_connect): Use assuan_fd_t instead of
int.
(_assuan_sock_connect): Ditto.
(_assuan_sock_connect_byname): Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoUse asprintf function from libgpg-error.
Werner Koch [Tue, 3 Nov 2015 14:26:29 +0000 (15:26 +0100)]
Use asprintf function from libgpg-error.

* configure.ac: Require libgpg-error 1.17.
(vasprintf): Remove ac_replace.
* src/assuan-defs.h [!HAVE_VASPRINTF]: Remove replace wrapper.
* src/assuan-logging.c (_assuan_log_control_channel):
(_assuan_log_control_channel): s/asprintf/gpgrt_asprintf/.
* src/debug.c (_assuan_debug): s/vasprintf/gpgrt_vasprintf/.
(_assuan_debug_begin): Ditto.
(_assuan_debug_add): Ditto. s/asprintf/gpgrt_asprintf/.
--

We plan to move more code into libgpg-error/gpgrt anyway thus this is
a good start which also fixes this bug:

GnuPG-bug-id: 1477
Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoTests: Cope with broken HTTP servers.
Werner Koch [Mon, 26 Oct 2015 20:04:54 +0000 (21:04 +0100)]
Tests: Cope with broken HTTP servers.

* tests/socks5.c (main): Use GET instead of HEAD

2 years agoSupport hostname based SOCKS5 connection.
Werner Koch [Mon, 26 Oct 2015 13:35:41 +0000 (14:35 +0100)]
Support hostname based SOCKS5 connection.

* src/assuan.h.in (ASSUAN_SOCK_SOCKS): New.
(ASSUAN_SOCK_TOR): New.
(assuan_sock_connect_byname): New.
* src/libassuan.def, src/libassuan.vers: Add that function.

* src/assuan-socket.c (socks5_connect): Add args socksport,
credentials, hostname, and hostport.  Implement user/password
authentication and domainname address type.  Change callers
accordingly.
(_assuan_sock_connect_byname): New.
(assuan_sock_connect_byname): New.

* tests/socks5.c (main): Add options --byname, --user, and --pass.
--

The assuan_sock_connect_byname may eventually be extended to work
without Tor or SOCKS by using getaddrinfo.  Or we move that all to
libgpgrt (aka libgpg-error).

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoSupport SOCKS5 for assuan_sock_connect.
Werner Koch [Sun, 18 Oct 2015 14:24:34 +0000 (16:24 +0200)]
Support SOCKS5 for assuan_sock_connect.

* src/assuan-socket.c: Include netinet/in.h and arpa/inet.h.
(SOCKS_PORT, TOR_PORT): New constants.
(tor_mode): New variable.
(_assuan_sock_set_flag): Add flags "tor-mode" and "socks".
(_assuan_sock_get_flag): Ditto.
(do_readn, do_writen): Always build.
(socks5_connect): New.
(use_socks): New.
(_assuan_sock_connect): Divert to socks5_connect if requested.

* tests/socks5.c: New.
* configure.ac (AH_TOP): Define GPGRT_ENABLE_ES_MACROS.
(AC_CHECK_FUNC): Check for getaddrinfo.
* tests/Makefile.am (testtools): New. Add socks5.
(AM_LDFLAGS): Add -no-install for easier debugging.
--

A future extension might be a new assuan_sock_direct_connect call
takes the hostname as a string and returns a new socket.  This allows
the proxy to do the resolving.  However, in the long term these socket
wrapper should be moved to libgpgrt (aka libgpg-error).

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoPost release updates
Werner Koch [Fri, 28 Aug 2015 12:56:27 +0000 (14:56 +0200)]
Post release updates

2 years agoRelease 2.3.0 libassuan-2.3.0
Werner Koch [Fri, 28 Aug 2015 12:46:16 +0000 (14:46 +0200)]
Release 2.3.0

* configure.ac: Set LT version to C6/A6/R0.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoSupport Cygwin local sockets.
Werner Koch [Tue, 30 Jun 2015 14:24:52 +0000 (16:24 +0200)]
Support Cygwin local sockets.

* src/assuan-socket.c (cygwin_fdtable, cygwin_fdtable_cs): New.
(is_cygwin_fd, insert_cygwin_fd, delete_cygwin_fd): New.
(assuan_sock_init) [W32]: Init the CS.
(assuan_sock_deinit) [W32]: Deinit the CS.
(read_port_and_nonce): Add arg cygwin and detect Cygwin socket files.
(_assuan_sock_set_flag): Add "cygwin" flag.
(_assuan_sock_get_flag): Ditto.
(do_readn, do_writen): New.
(_assuan_sock_bind): Create a Cygwin socket file depending on a socket
flag.
(_assuan_sock_connect): Handle the cygwin socket protocol.
(_assuan_sock_check_nonce): Ditto.
--

This code has not been tested.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoRead up remaining lines in assuan_inquire after reaching MAXLEN
Werner Koch [Fri, 28 Aug 2015 08:22:39 +0000 (10:22 +0200)]
Read up remaining lines in assuan_inquire after reaching MAXLEN

* src/assuan-inquire.c (assuan_inquire): Clear return args on error.
Read up remaining lines after MAXLEN has been hit.
--

If we would stop immediately at MAXLEN, as we did, the client would
continue to send data which the server may consider as new Assuan
commands.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoAdd configure option --enable-build-timestamp.
Werner Koch [Tue, 25 Aug 2015 19:19:35 +0000 (21:19 +0200)]
Add configure option --enable-build-timestamp.

* configure.ac (BUILD_TIMESTAMP): Set to "<none>" by default.
--

This is based on
libgpg-error commit d620005fd1a655d591fccb44639e22ea445e4554
but changed to be disabled by default.  Check there for some
background.

Signed-off-by: Werner Koch <wk@gnupg.org>
2 years agoWipe the context before releasing as an extra safeguard.
Werner Koch [Fri, 7 Aug 2015 09:26:00 +0000 (11:26 +0200)]
Wipe the context before releasing as an extra safeguard.

* src/assuan-defs.h (wipememory2, wipememory): New.  Taken from GnuPG.
* src/assuan.c (assuan_release): Wipe the context.
--

The assuan context has buffers which may carry senitive information.
These buffers could be wiped out with each flush but that is too
expensive.  Thus we only wipe them when freeing the context.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoAdd assuan_sock_set_flag and assuan_sock_get_flag.
Werner Koch [Tue, 30 Jun 2015 14:03:57 +0000 (16:03 +0200)]
Add assuan_sock_set_flag and assuan_sock_get_flag.

* src/assuan-socket.c (_assuan_sock_set_flag): New.
(assuan_sock_set_flag): New.
(_assuan_sock_get_flag, assuan_sock_get_flag): New.
* src/assuan.h.in (assuan_sock_set_flag): New.
(assuan_sock_get_flag): New.
* src/libassuan.def: Add them.
* src/libassuan.vers: Add them.
--

These new functions are intended for a Cygwin socket emulation.  This
commit merely introduces a generic framework.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoReturn GPG_ERR_SOURCE_ASSUAN on errors with no CTX.
Werner Koch [Fri, 26 Jun 2015 10:06:31 +0000 (12:06 +0200)]
Return GPG_ERR_SOURCE_ASSUAN on errors with no CTX.

* src/assuan-defs.h (_assuan_error): Use error source Assuan if no CTX
is given.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoDo not segv if NULL is passed for CTX in sendfd and receivefd.
Werner Koch [Fri, 26 Jun 2015 10:04:20 +0000 (12:04 +0200)]
Do not segv if NULL is passed for CTX in sendfd and receivefd.

* src/assuan-buffer.c (assuan_sendfd): Check that CTX is not NULL.
(assuan_receivefd): Ditto.
--

This change is to align the behaviour with that of assuan_send_data.

Suggested-by: Andre Heinecke.
Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoFix documentation for assuan_inquire.
Neal H. Walfield [Mon, 1 Jun 2015 15:56:23 +0000 (17:56 +0200)]
Fix documentation for assuan_inquire.

* doc/assuan.texi (assuan_inquire): Fix and improve description of
this function.

3 years agoPost release updates
Werner Koch [Tue, 12 May 2015 11:53:30 +0000 (13:53 +0200)]
Post release updates

--

3 years agoRelease 2.2.1 libassuan-2.2.1
Werner Koch [Tue, 12 May 2015 11:45:22 +0000 (13:45 +0200)]
Release 2.2.1

3 years agoclean up assuan documentation
Daniel Kahn Gillmor [Thu, 7 May 2015 04:52:48 +0000 (00:52 -0400)]
clean up assuan documentation

* doc/assuan.texi: fix documentation

--

Reading up on assuan to create python bindings uncovered a few bugs in
the documentation.

3 years agoDocumentation cleanups.
Neal H. Walfield [Thu, 7 May 2015 12:51:04 +0000 (14:51 +0200)]
Documentation cleanups.

3 years agow32: Use -static-libgcc to avoid linking to libgcc_s_sjlj-1.dll.
Werner Koch [Fri, 30 Jan 2015 16:06:28 +0000 (17:06 +0100)]
w32: Use -static-libgcc to avoid linking to libgcc_s_sjlj-1.dll.

* src/Makefile.am (extra_ltoptions): New.
(libassuan_la_LDFLAGS): Use it.
--

Since gcc 4.8 there is a regression in that plain C programs may link
to libgcc_s.a which has a dependency on libgcc_s_sjlj.dll.  This is
for example triggered by using long long arithmetic on a 32 bit
Windows (e.g symbol __udivdi3).

This patch does not change anything right now but we add it anyway
in case long long will ever be used.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoUpdate config.* and other build-aux files
Werner Koch [Wed, 28 Jan 2015 09:00:04 +0000 (10:00 +0100)]
Update config.* and other build-aux files

--

3 years agoRequire the use of automake 1.14
Werner Koch [Wed, 28 Jan 2015 08:49:10 +0000 (09:49 +0100)]
Require the use of automake 1.14

* configure.ac (AM_INIT_AUTOMAKE): Add serial-tests.
* src/Makefile.am (INCLUDES): Rename to AM_CPPFLAGS and remove the
nonexistent ../include/.

3 years agow32: Fix assuan_connect_fd
Werner Koch [Wed, 28 Jan 2015 08:47:40 +0000 (09:47 +0100)]
w32: Fix assuan_connect_fd

* src/assuan-socket-connect.c (assuan_socket_connect_fd): Map fd to
assuan_fd_t.
--

This function is actually not used by GnuPG.  The function should have
taken an assuan_fd but given that it did not we use our usual mapping
from Windows libc fds to an assuan fd.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoFix gcc warning about unused values.
Werner Koch [Tue, 27 Jan 2015 17:51:55 +0000 (18:51 +0100)]
Fix gcc warning about unused values.

* src/debug.h: Remove traling ", 0" expression part where not useful.
--

gcc 4.9 detected this.  Probably taken from gpgme but used
differently.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agodoc: Fix syntax problems in lgpg.tex and gpl.texi
Werner Koch [Wed, 28 Jan 2015 09:10:47 +0000 (10:10 +0100)]
doc: Fix syntax problems in lgpg.tex and gpl.texi

--

3 years agoFix WSAEADDRINUSE EADDRINUSE mismatch.
Werner Koch [Tue, 27 Jan 2015 16:09:48 +0000 (17:09 +0100)]
Fix WSAEADDRINUSE EADDRINUSE mismatch.

* src/w32-sock-nonce.inc.h (EADDRINUSE): Avoid redefining.
* src/assuan-socket.c (_assuan_sock_bind): Set error to EADDRINUSE.
--

With the latest mingw-w64 EADDRINUSE is defined but to a different
value than WSAEADDRINUSE.  We need to use EADDRINUSE becuase that is
what applications expect.

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoComment updates
Werner Koch [Tue, 27 Jan 2015 16:06:16 +0000 (17:06 +0100)]
Comment updates

--

3 years agoPost release updates
Werner Koch [Thu, 11 Dec 2014 12:13:53 +0000 (13:13 +0100)]
Post release updates

--

3 years agoRelease 2.2.0 libassuan-2.2.0
Werner Koch [Thu, 11 Dec 2014 12:10:24 +0000 (13:10 +0100)]
Release 2.2.0

* configure.ac: Set LT version to C5/A5/R0.
(AM_INIT_AUTOMAKE): Add options.
* Makefile.am (AUTOMAKE_OPTIONS): Remove.

3 years agoDo not allow LFs in the redirected name.
Werner Koch [Fri, 28 Nov 2014 20:30:52 +0000 (21:30 +0100)]
Do not allow LFs in the redirected name.

* src/assuan-socket.c (eval_redirection): Stop parsing at the first
LF.
--

Avoiding LFs in file names is better for logging.

3 years agoImplement socket file redirection.
Werner Koch [Fri, 28 Nov 2014 15:41:16 +0000 (16:41 +0100)]
Implement socket file redirection.

* configure.ac (AC_CHECK_FUNC): Check for stat.
* src/assuan-socket.c (SUN_LEN): Add.
(eval_redirection): New.
(_assuan_sock_connect) [!W32]: Implement socket file redirection.
(_assuan_sock_set_sockaddr_un): New.
(assuan_sock_set_sockaddr_un): New.
--

This feature is useful to allow sockets with standard names even on
file system which do not supports socket and to help with shared home
directories.  For example to use GnuPG 2.1 with shared home
directories one will be abale to do:

 rm ~/.gnupg/S.gpg-agent || true
 printf "%%Assuan%%\nsocket=${HOME}/.gnupg/S.gpg-agent_${HOSTNAME}\n" \
       > ~/.gnupg/S.gpg-agent

Signed-off-by: Werner Koch <wk@gnupg.org>
3 years agoPost release updates.
Werner Koch [Fri, 7 Nov 2014 17:11:00 +0000 (18:11 +0100)]
Post release updates.

--

3 years agoRelease 2.1.3. libassuan-2.1.3
Werner Koch [Fri, 7 Nov 2014 17:02:49 +0000 (18:02 +0100)]
Release 2.1.3.

* configure.ac: Set LT version to C4/A4/R3.

3 years agow32: Remove I/O delays due to our 100ms delay after an EAGAIN.
Werner Koch [Fri, 7 Nov 2014 16:20:19 +0000 (17:20 +0100)]
w32: Remove I/O delays due to our 100ms delay after an EAGAIN.

* src/system-w32.c (__assuan_read): Retry using select.  Map
WSAECONNRESET to EPIPE.
(__assuan_write): Retry using select.
* src/assuan-buffer.c (readline) [W32]:  Return EOF instead of EPIPE.

3 years agoPost release updates
Werner Koch [Sun, 17 Aug 2014 11:57:47 +0000 (13:57 +0200)]
Post release updates

--

3 years agoRelease 2.1.2. libassuan-2.1.2
Werner Koch [Sun, 17 Aug 2014 11:49:23 +0000 (13:49 +0200)]
Release 2.1.2.

* configure.ac: Set LT version to C4/A4/R2.

3 years agoUpdate build system
Werner Koch [Sun, 17 Aug 2014 11:08:26 +0000 (13:08 +0200)]
Update build system

* autogen.sh: Add --find-version stuff.  Taken from GnuPG.
* configure.ac: Change accordingly

3 years agoUpdate copyright info
Werner Koch [Sun, 17 Aug 2014 11:05:02 +0000 (13:05 +0200)]
Update copyright info

--

3 years agoFix possible segv in a call to _assuan_debug.
Werner Koch [Thu, 14 Aug 2014 15:15:04 +0000 (17:15 +0200)]
Fix possible segv in a call to _assuan_debug.

* src/context.c (assuan_set_error): Do not pass NULL for %s in the
trace function.
--

This likely fixes
GnuPG-bug-id: 1659

4 years agoAvoid a vasprintf call if tracing has not been enabled.
Werner Koch [Wed, 25 Jun 2014 18:25:28 +0000 (20:25 +0200)]
Avoid a vasprintf call if tracing has not been enabled.

* src/debug.c (_assuan_debug): Check wether CAT want to be logged.

4 years agoFix NULL deref when tracing is enabled and malloc fails.
Werner Koch [Tue, 15 Apr 2014 14:40:48 +0000 (16:40 +0200)]
Fix NULL deref when tracing is enabled and malloc fails.

* src/debug.h (TRACE_ERR): Check CTX before a deref.
* src/assuan-defs.h (_assuan_error): Turn into an inline function and
check CTX before a deref.
--

Found by Hans-Christoph Steiner with cppcheck.

4 years agoUse the generic autogen.sh script.
Werner Koch [Thu, 9 Jan 2014 18:14:09 +0000 (19:14 +0100)]
Use the generic autogen.sh script.

* autogen.rc: New.
* Makefile.am (EXTRA_DIST): Add it.
* autogen.sh: Update from GnuPG.

4 years agoMove helper scripts to build-aux.
Werner Koch [Thu, 9 Jan 2014 18:14:09 +0000 (19:14 +0100)]
Move helper scripts to build-aux.

* compile, config.guess, config.rpath, config.sub, depcomp, ltmain.sh
* doc/mdate-sh, doc/texinfo.tex, install-sh, missing: Move to
build-aux/.
* Makefile.am (EXTRA_DIST): Remove config.rpath - it is implicitly
distributed.
* configure.ac (AC_CONFIG_AUX_DIR): New.
(AM_SILENT_RULES): New.

4 years agoUpdate libtool and autogen.sh.
Werner Koch [Mon, 6 Jan 2014 15:16:24 +0000 (16:16 +0100)]
Update libtool and autogen.sh.

--

This is the version from current libgpg-error which already has the
changes done here plus these:

  bf0d67db * Update libtool to support Android.
  dd05f379 * Fix libtool 2.4.2 to correctly detect .def files.
  6971fe55 * Update to libtool 2.4.2.

4 years agoAdd build support for ppc64le.
Werner Koch [Tue, 22 Oct 2013 12:26:53 +0000 (14:26 +0200)]
Add build support for ppc64le.

* config.guess, config.sub: Update to latest version (2013-11-29).
* m4/libtool.m4: Add patches for ppc64le.
--

We don't want to update libtool, thus we use patches supplied by IBM.

5 years agoPost release version bump.
Werner Koch [Mon, 24 Jun 2013 05:17:01 +0000 (07:17 +0200)]
Post release version bump.

--

5 years agoRelease 2.1.1. libassuan-2.1.1
Werner Koch [Mon, 24 Jun 2013 05:02:39 +0000 (07:02 +0200)]
Release 2.1.1.

* configure.ac: Set LT version to C4/A4/R1.

5 years agoChanges to support W64.
Werner Koch [Wed, 19 Jun 2013 11:29:18 +0000 (13:29 +0200)]
Changes to support W64.

* configure.ac (have_dosish_system): Set for W64.
* src/assuan-defs.h (SOCKET2HANDLE, HANDLE2SOCKET): Add versions for
W64.
* src/assuan-handler.c (assuan_command_parse_fd) [W64]: Use strtoull
to parse an FD.
--

Note that these changes are not complete but merely sufficient to
allow building of GpgEX.

5 years agoAdd hack to have different names for 64 bit Windows DLLs.
Werner Koch [Mon, 17 Jun 2013 14:11:23 +0000 (16:11 +0200)]
Add hack to have different names for 64 bit Windows DLLs.

* ltmain.sh: Prefix the SO number for W64 with a "6".
--

We need to stick to libtool 2.4.2 anyway, thus we take the easy way
and hack libtool instead of adding "-release 6" to the Makefile.  This
also avoids an extra dash before the 6 and thus yields a prettier name
than the one produced by the -release option.  The header files and
def files are supposed to be identical for w32 and w64 thus we don't
need to do any special code for them.

Having a different namespace for 64 bit DLLs is such a good idea that
I hope this or a similar feature will be provided by future libtool
versions.

5 years agoSupport building for w64.
Werner Koch [Mon, 17 Jun 2013 14:01:19 +0000 (16:01 +0200)]
Support building for w64.