obnox/cwrap/socket_wrapper.git
7 years agotests: Clean-up max_sockets test case master
Anoop C S [Fri, 23 Sep 2016 07:08:31 +0000 (12:38 +0530)]
tests: Clean-up max_sockets test case

Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-by: Michael Adam <obnox@samba.org>
7 years agoswrap: Fix use-after-free
Anoop C S [Tue, 25 Oct 2016 17:03:10 +0000 (22:33 +0530)]
swrap: Fix use-after-free

This was introduced by commit 9ce583b6cd6f55d473e5b54794fb06450997ebc8

Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agoswrap: fix SWRAP_DLIST_ADD_AFTER
Anoop C S [Tue, 25 Oct 2016 13:56:20 +0000 (15:56 +0200)]
swrap: fix SWRAP_DLIST_ADD_AFTER

Pair-Programmed-With: Michael Adam <obnox@samba.org>

Signed-off-by: Anoop C S <anoopcs@redhat.com>
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agoswrap: fix use-after-free in swrap_remove_stale()
Michael Adam [Tue, 25 Oct 2016 11:46:18 +0000 (13:46 +0200)]
swrap: fix use-after-free in swrap_remove_stale()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agoswrap: slightly cleanup logic in swrap_close
Michael Adam [Tue, 25 Oct 2016 11:42:05 +0000 (13:42 +0200)]
swrap: slightly cleanup logic in swrap_close

This moves the libc_close() to one central point, thereby
grouping the fd-related operations together and the the
socket-info related operations after that.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agoswrap: fix use-after-free in swrap_close
Michael Adam [Tue, 25 Oct 2016 11:41:29 +0000 (13:41 +0200)]
swrap: fix use-after-free in swrap_close

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agoswrap: Fix build on Solaris
Andreas Schneider [Sat, 22 Oct 2016 11:42:41 +0000 (13:42 +0200)]
swrap: Fix build on Solaris

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
7 years agoswrap: Mark flags in swrap_accept4 as unused
Andreas Schneider [Fri, 21 Oct 2016 06:04:02 +0000 (08:04 +0200)]
swrap: Mark flags in swrap_accept4 as unused

This removes a compiler warning on non-Linux systems.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
7 years agoswrap: Fix the build on BSD and Solaris
Andreas Schneider [Fri, 21 Oct 2016 05:56:24 +0000 (07:56 +0200)]
swrap: Fix the build on BSD and Solaris

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
7 years agoswrap: Handle threads that fork
Andreas Schneider [Thu, 20 Oct 2016 08:37:18 +0000 (10:37 +0200)]
swrap: Handle threads that fork

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
7 years agocmake: Check for constructor attribute
Andreas Schneider [Thu, 20 Oct 2016 08:35:50 +0000 (10:35 +0200)]
cmake: Check for constructor attribute

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
7 years agoswrap: Make symbol loading thread-safe
Andreas Schneider [Thu, 20 Oct 2016 08:22:40 +0000 (10:22 +0200)]
swrap: Make symbol loading thread-safe

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
7 years agocmake: Link pthread library headers
Michael Adam [Sun, 18 Sep 2016 18:28:06 +0000 (20:28 +0200)]
cmake: Link pthread library headers

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agoswrap: Fix strict-aliasing issues while loading symbols
Andreas Schneider [Thu, 20 Oct 2016 08:56:35 +0000 (10:56 +0200)]
swrap: Fix strict-aliasing issues while loading symbols

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
7 years agotests: Add a test for max_sockets
Michael Adam [Thu, 22 Sep 2016 00:13:20 +0000 (02:13 +0200)]
tests: Add a test for max_sockets

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agoswrap: Introduce a freelist in the socket_info array
Michael Adam [Wed, 14 Sep 2016 11:24:47 +0000 (13:24 +0200)]
swrap: Introduce a freelist in the socket_info array

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agoswrap: Replace linked list of socket_info with preallocated array of structures
Anoop C S [Thu, 25 Aug 2016 06:11:12 +0000 (11:41 +0530)]
swrap: Replace linked list of socket_info with preallocated array of structures

Pair-Programmed-With: Michael Adam <obnox@samba.org>

Signed-off-by: Anoop C S <anoopcs@redhat.com>
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agoswrap: Optimization in (commented out) check_addr_port_in_use()
Michael Adam [Tue, 16 Aug 2016 11:38:50 +0000 (13:38 +0200)]
swrap: Optimization in (commented out) check_addr_port_in_use()

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agoswrap: Improve vfcntl to add the dup'd fd after the source fd
Michael Adam [Tue, 16 Aug 2016 09:04:43 +0000 (11:04 +0200)]
swrap: Improve vfcntl to add the dup'd fd after the source fd

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agoswrap: Improve dup2 to add the dup'd fd after the source fd
Michael Adam [Tue, 16 Aug 2016 09:04:12 +0000 (11:04 +0200)]
swrap: Improve dup2 to add the dup'd fd after the source fd

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agoswrap: Improve dup to add the dup'd fd after the source fd
Michael Adam [Tue, 16 Aug 2016 09:03:27 +0000 (11:03 +0200)]
swrap: Improve dup to add the dup'd fd after the source fd

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agoswrap: Add SWRAP_DLIST_ADD_AFTER macro
Michael Adam [Tue, 16 Aug 2016 09:00:50 +0000 (11:00 +0200)]
swrap: Add SWRAP_DLIST_ADD_AFTER macro

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agoswrap: Untangle socket_info_fd from socket_info structure.
Anoop C S [Wed, 10 Aug 2016 11:02:19 +0000 (16:32 +0530)]
swrap: Untangle socket_info_fd from socket_info structure.

This reverses the dependency of socket_info on socket_info_fd:
Instead of maintaining the list of socket_info structures,
and keeping a list of referencing fds (created by dup),
we now maintain the list of fds with pointers to the
corresponding socket_info structures, and count the
references in the socket_info.

This makes the treatment of the lists more obvious,
especially seen in the removing part.

This change is a preparatory step for implementing
fd-passing in socket-wrapper.

Pair-programmed-with: Michael Adam <obnox@samba.org>
Signed-off-by: Anoop C S <anoopcs@redhat.com>
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agoswrap: remove ununsed members from struct swrap.
Michael Adam [Fri, 19 Aug 2016 11:34:50 +0000 (13:34 +0200)]
swrap: remove ununsed members from struct swrap.

These were used in removed swrap_init().

Pair-Programmed-With: Anoop C S <anoopcs@redhat.com>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agoswrap: Add test case to validate oldfd = newfd case in dup2()
Anoop C S [Mon, 22 Aug 2016 14:07:47 +0000 (19:37 +0530)]
swrap: Add test case to validate oldfd = newfd case in dup2()

Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agoswrap: Treat the case of fd == newfd correctly in dup2()
Michael Adam [Tue, 16 Aug 2016 08:59:40 +0000 (10:59 +0200)]
swrap: Treat the case of fd == newfd correctly in dup2()

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agoswrap: Delay addition of child socket_info_fd into socket_info list
Anoop C S [Thu, 11 Aug 2016 14:54:54 +0000 (20:24 +0530)]
swrap: Delay addition of child socket_info_fd into socket_info list

In swrap_accept() we used to add new child socket_info_fd[child_fi]
into newly created child socket_info struture[child_si] without
considering the fact that we may return early in case of errors from
subsequent calls to libc_getsockname() and sockaddr_convert_from_un()
during which we free child_fi and child_si and return. So it is better
to delay the addition of child_fi into child_si->fds until child_si
is completely initialized.

Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agoswrap: Remove redunant check in swrap_socket
Anoop C S [Thu, 11 Aug 2016 14:50:17 +0000 (20:20 +0530)]
swrap: Remove redunant check in swrap_socket

The very same check is also being made inside swrap_remove_stale().
So we can get rid of this early if condition.

Pair-programmed-with: Michael Adam <obnox@samba.org>
Signed-off-by: Anoop C S <anoopcs@redhat.com>
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agoswrap: Simplify swrap_remove_stale by early return
Anoop C S [Thu, 11 Aug 2016 13:57:17 +0000 (19:27 +0530)]
swrap: Simplify swrap_remove_stale by early return

Pair-programmed-with: Michael Adam <obnox@samba.org>
Signed-off-by: Anoop C S <anoopcs@redhat.com>
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
7 years agoBump version to 1.1.7
Andreas Schneider [Fri, 20 May 2016 06:58:18 +0000 (08:58 +0200)]
Bump version to 1.1.7

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 years agotests: Add test_connect_sendto_null_ipv4() test
Andreas Schneider [Tue, 17 May 2016 08:01:38 +0000 (10:01 +0200)]
tests: Add test_connect_sendto_null_ipv4() test

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 years agotests: Add a udp test case for sendto() after a connect()
Richard Sharpe [Thu, 12 May 2016 00:10:54 +0000 (17:10 -0700)]
tests: Add a udp test case for sendto() after a connect()

Here, we do the same as net ads dns gethostbyname. That is, we
connect on a UDP socket and then send a sendto with a dest address (the
same as the one we connected on.) and then a recvfrom etc.

Signed-of-by: Richard Sharpe <rsharpe@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 years agoswrap: Fix sendto() with connected sockets
Richard Sharpe [Thu, 12 May 2016 00:03:46 +0000 (17:03 -0700)]
swrap: Fix sendto() with connected sockets

Let the socket wrapper code work with the net ads dns gethostbyname etc
code (lib/addn/dnssock.c) which uses connect on a UDP socket before then
using sendto and recvfrom.

Here, we make sure we don't error out in that case.

Tested by creating a test case for this and then observing that:

1. The test case works when the socket wrapper lib is not being used
   ie, run the test directly after defining some SHELL variables.

2. That the test case fails when run with the un modified socket
   wrapper code.

3. Apply this fix and observe that it runs correctly.

Pair-Programmed-With: Andreas Schneider <asn@samba.org>
Signed-off-by: Richard Sharpe <rsharpe@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 years agoswrap: Allow to open RAW sockets when loaded
Andreas Schneider [Tue, 26 Apr 2016 16:10:52 +0000 (18:10 +0200)]
swrap: Allow to open RAW sockets when loaded

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
7 years agoswrap: Add support for accept4()
Andreas Schneider [Tue, 3 May 2016 12:59:34 +0000 (14:59 +0200)]
swrap: Add support for accept4()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
7 years agoswrap: Add support for running on OpenBSD
Andreas Schneider [Tue, 3 May 2016 12:43:21 +0000 (14:43 +0200)]
swrap: Add support for running on OpenBSD

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
8 years agoBump version to 1.1.6
Andreas Schneider [Tue, 15 Mar 2016 10:15:07 +0000 (11:15 +0100)]
Bump version to 1.1.6

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 years agoswrap: Fix buliding on unix systems without AF_NETLINK
Andreas Schneider [Thu, 25 Feb 2016 17:01:49 +0000 (18:01 +0100)]
swrap: Fix buliding on unix systems without AF_NETLINK

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 years agoswrap: Use calloc() instead of malloc and memset
Andreas Schneider [Tue, 23 Feb 2016 10:22:58 +0000 (11:22 +0100)]
swrap: Use calloc() instead of malloc and memset

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 years agoswrap: Allow to open NETLINK sockets when loaded
Andreas Schneider [Thu, 5 Nov 2015 13:44:26 +0000 (14:44 +0100)]
swrap: Allow to open NETLINK sockets when loaded

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 years agotests: Add test for ephemeral port binding in listen()
Andreas Schneider [Wed, 4 Nov 2015 10:22:25 +0000 (11:22 +0100)]
tests: Add test for ephemeral port binding in listen()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 years agoswrap: Automatically bind an ephemeral port if needed
Andreas Schneider [Wed, 4 Nov 2015 10:21:23 +0000 (11:21 +0100)]
swrap: Automatically bind an ephemeral port if needed

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 years agotests: Add valgrind suppression file for dlopen() issues
Andreas Schneider [Wed, 28 Oct 2015 08:52:25 +0000 (09:52 +0100)]
tests: Add valgrind suppression file for dlopen() issues

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 years agoswrap: Add a wrapper for write()
Andreas Schneider [Wed, 28 Oct 2015 09:30:32 +0000 (10:30 +0100)]
swrap: Add a wrapper for write()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 years agotorture: Use a short torture socket dir
Andreas Schneider [Tue, 27 Oct 2015 09:03:06 +0000 (10:03 +0100)]
torture: Use a short torture socket dir

This makes sure we do not run into a regression.

Thanks to Grigorij Demidov <grigorii.demidov@nic.cz>

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 years agoswrap: Fix recvmsg() with UDP
Andreas Schneider [Tue, 27 Oct 2015 08:26:40 +0000 (09:26 +0100)]
swrap: Fix recvmsg() with UDP

This worked if the unix path was bigger than sizeof(struct sockaddr_in6).
With a short unix socket pathname the buffer was to small to store the
address and convert_un_in() failed.

Thanks to Grigorij Demidov <grigorii.demidov@nic.cz>

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 years agoswrap: Fix compare of signed and unsigned integer expressions
Andreas Schneider [Fri, 16 Oct 2015 14:52:46 +0000 (16:52 +0200)]
swrap: Fix compare of signed and unsigned integer expressions

Make sure the values are compared as the same type. iov_len is size_t on
Linux and int on Solaris.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 years agotests: Fix compile warning
Andreas Schneider [Fri, 16 Oct 2015 14:50:00 +0000 (16:50 +0200)]
tests: Fix compile warning

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 years agoBump version to 1.1.5
Andreas Schneider [Wed, 14 Oct 2015 09:37:55 +0000 (11:37 +0200)]
Bump version to 1.1.5

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
8 years agoswrap: Simplify cmspace calculation in swrap_sendmsg_copy_cmsg()
Ralph Boehme [Thu, 8 Oct 2015 01:25:53 +0000 (03:25 +0200)]
swrap: Simplify cmspace calculation in swrap_sendmsg_copy_cmsg()

With cmsg->cmsg_len = CMSG_LEN(len) =>

CMSG_ALIGN(cmsg->cmsg_len) =

CMSG_ALIGN(CMSG_LEN(len)) =

CMSG_ALIGN(CMSG_ALIGN(sizeof(struct cmsghdr)) + len) =

CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len) =

CMSG_SPACE(len) =

CMSG_SPACE(CMSG_ALIGN(sizeof(struct cmsghdr)) + len - CMSG_ALIGN(sizeof(struct cmsghdr))) =

CMSG_SPACE(CMSG_LEN(len) - CMSG_ALIGN(sizeof(struct cmsghdr))) =

CMSG_SPACE(cmsg->cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr)))

:)

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
8 years agotests: Add a unit test for wrap_sendmsg_filter_cmsghdr()
Ralph Boehme [Tue, 13 Oct 2015 14:38:26 +0000 (16:38 +0200)]
tests: Add a unit test for wrap_sendmsg_filter_cmsghdr()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
8 years agotests: Add test for TCP_NODELAY setsockopt()
Andreas Schneider [Thu, 8 Oct 2015 09:02:10 +0000 (11:02 +0200)]
tests: Add test for TCP_NODELAY setsockopt()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
8 years agotests: Add test for TCP_NODELAY getsockopt()
Andreas Schneider [Mon, 14 Sep 2015 20:07:09 +0000 (22:07 +0200)]
tests: Add test for TCP_NODELAY getsockopt()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
8 years agoswrap: Add support for TCP_NODELAY in getsockopt()
Andreas Schneider [Mon, 14 Sep 2015 20:06:52 +0000 (22:06 +0200)]
swrap: Add support for TCP_NODELAY in getsockopt()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
8 years agoswrap: Add support for TCP_NODELAY in setsockopt()
Andreas Schneider [Thu, 8 Oct 2015 08:51:02 +0000 (10:51 +0200)]
swrap: Add support for TCP_NODELAY in setsockopt()

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
8 years agoBump version to 1.1.4
Andreas Schneider [Mon, 24 Aug 2015 15:53:28 +0000 (17:53 +0200)]
Bump version to 1.1.4

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
8 years agoswrap: Call dlclose() in the destructor
Andreas Schneider [Mon, 17 Aug 2015 10:14:44 +0000 (12:14 +0200)]
swrap: Call dlclose() in the destructor

Signed-off-by: Andreas Schneider <asn@samba.org>
8 years agotests: Rename s_addr to send_addr
Andreas Schneider [Mon, 17 Aug 2015 10:06:30 +0000 (12:06 +0200)]
tests: Rename s_addr to send_addr

The preprocessor on Solaris replaces s_addr with S_un.S_addr.

Signed-off-by: Andreas Schneider <asn@samba.org>
8 years agotests: Fix memset() call in new tests
Andreas Schneider [Wed, 12 Aug 2015 06:48:56 +0000 (08:48 +0200)]
tests: Fix memset() call in new tests

Signed-off-by: Andreas Schneider <asn@samba.org>
8 years agotests: Fix passing pointer of incompatible type
Andreas Schneider [Wed, 12 Aug 2015 06:37:39 +0000 (08:37 +0200)]
tests: Fix passing pointer of incompatible type

Signed-off-by: Andreas Schneider <asn@samba.org>
8 years agoswrap: Fix signed comparsion warnings
Andreas Schneider [Wed, 12 Aug 2015 06:37:07 +0000 (08:37 +0200)]
swrap: Fix signed comparsion warnings

Signed-off-by: Andreas Schneider <asn@samba.org>
8 years agoswrap: Add enviornment variable to specify mtu size
Andreas Schneider [Tue, 11 Aug 2015 10:11:16 +0000 (12:11 +0200)]
swrap: Add enviornment variable to specify mtu size

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 years agotests: Add tcp sendmsg/recvmsg test
Andreas Schneider [Tue, 11 Aug 2015 09:40:30 +0000 (11:40 +0200)]
tests: Add tcp sendmsg/recvmsg test

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 years agoswrap: Fix TCP support with sendmsg/recvmsg
Andreas Schneider [Tue, 11 Aug 2015 09:39:52 +0000 (11:39 +0200)]
swrap: Fix TCP support with sendmsg/recvmsg

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 years agotests: Tests for msg_name(len) in sendmsg/revcmsg
Andreas Schneider [Mon, 10 Aug 2015 14:09:16 +0000 (16:09 +0200)]
tests: Tests for msg_name(len) in sendmsg/revcmsg

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 years agotests: Fix testname of sendmsg tests
Andreas Schneider [Mon, 10 Aug 2015 11:39:09 +0000 (13:39 +0200)]
tests: Fix testname of sendmsg tests

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 years agoswrap: Correctly update the msg_name in recvmsg()
Andreas Schneider [Wed, 5 Aug 2015 13:02:49 +0000 (15:02 +0200)]
swrap: Correctly update the msg_name in recvmsg()

This has been found while debugging nsupdate.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 years agotests: Migrate to new cmocka API
Andreas Schneider [Thu, 6 Aug 2015 14:08:32 +0000 (16:08 +0200)]
tests: Migrate to new cmocka API

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
8 years agoUpdate TODO
Andreas Schneider [Wed, 15 Jul 2015 13:18:08 +0000 (15:18 +0200)]
Update TODO

9 years agoRegenerate manpage.
Andreas Schneider [Mon, 20 Apr 2015 06:58:00 +0000 (08:58 +0200)]
Regenerate manpage.

Signed-off-by: Andreas Schneider <asn@samba.org>
9 years agodoc: Add a specific date to manpage
Jelmer Vernooij [Sat, 18 Apr 2015 23:58:15 +0000 (23:58 +0000)]
doc: Add a specific date to manpage

This makes builds for socket wrapper reproducible.

Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
9 years agocmake: Drop test results via https.
Andreas Schneider [Wed, 25 Feb 2015 10:11:32 +0000 (11:11 +0100)]
cmake: Drop test results via https.

Signed-off-by: Andreas Schneider <asn@samba.org>
9 years agoBump version to 1.1.3
Andreas Schneider [Mon, 23 Feb 2015 14:24:26 +0000 (15:24 +0100)]
Bump version to 1.1.3

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoUpdate ChangeLog
Andreas Schneider [Mon, 23 Feb 2015 14:23:47 +0000 (15:23 +0100)]
Update ChangeLog

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoswrap: If we remove the socket_info also unlink the unix socket
Andreas Schneider [Tue, 3 Feb 2015 16:07:18 +0000 (17:07 +0100)]
swrap: If we remove the socket_info also unlink the unix socket

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agotorture: Increase time to wait for pid file.
Andreas Schneider [Tue, 16 Dec 2014 14:26:32 +0000 (15:26 +0100)]
torture: Increase time to wait for pid file.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoswrap: Do not leak the socket_info we just removed.
Andreas Schneider [Fri, 24 Oct 2014 09:22:15 +0000 (11:22 +0200)]
swrap: Do not leak the socket_info we just removed.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agocmake: Treat no_sanitize_address attribute warnings as error.
Andreas Schneider [Thu, 23 Oct 2014 05:23:36 +0000 (07:23 +0200)]
cmake: Treat no_sanitize_address attribute warnings as error.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agosrc: Add support for running with address sanitizer.
Andreas Schneider [Mon, 20 Oct 2014 07:13:36 +0000 (09:13 +0200)]
src: Add support for running with address sanitizer.

It address sanitzer will complain about our hack with variable function
attributes. This disables the checking of it.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
9 years agotorture: Check the return code of kill().
Andreas Schneider [Thu, 2 Oct 2014 04:28:10 +0000 (06:28 +0200)]
torture: Check the return code of kill().

CID #73654

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
9 years agoswrap: Fix the loop for older gcc versions.
Andreas Schneider [Wed, 1 Oct 2014 14:59:29 +0000 (16:59 +0200)]
swrap: Fix the loop for older gcc versions.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoBump version to 1.1.2.
Andreas Schneider [Wed, 1 Oct 2014 10:56:21 +0000 (12:56 +0200)]
Bump version to 1.1.2.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agoswrap: Add support for eventfd with unsigned count variable.
Andreas Schneider [Wed, 1 Oct 2014 10:51:56 +0000 (12:51 +0200)]
swrap: Add support for eventfd with unsigned count variable.

The prototype in glibc 2.20.90 changed.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agoswrap: Add a trace message for swrap_socket().
Andreas Schneider [Wed, 1 Oct 2014 10:48:13 +0000 (12:48 +0200)]
swrap: Add a trace message for swrap_socket().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agoswrap: Implement fcntl() to catch F_DUPFD.
Andreas Schneider [Thu, 11 Sep 2014 08:17:06 +0000 (10:17 +0200)]
swrap: Implement fcntl() to catch F_DUPFD.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agoswrap: Include the function name in the debug output.
Andreas Schneider [Thu, 11 Sep 2014 06:30:04 +0000 (08:30 +0200)]
swrap: Include the function name in the debug output.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agotests: Add missing breaks in sockaddr assert functions.
Andreas Schneider [Wed, 3 Sep 2014 07:04:02 +0000 (09:04 +0200)]
tests: Add missing breaks in sockaddr assert functions.

CID #72657
CID #72656

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agoswrap: Fix out of bound access.
Andreas Schneider [Wed, 3 Sep 2014 06:59:26 +0000 (08:59 +0200)]
swrap: Fix out of bound access.

CID #72659

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agotests: Pass the sockaddr structure to system functions.
Andreas Schneider [Tue, 2 Sep 2014 10:17:15 +0000 (12:17 +0200)]
tests: Pass the sockaddr structure to system functions.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agoecho_srv: Silence alignment warnings.
Andreas Schneider [Tue, 2 Sep 2014 10:13:25 +0000 (12:13 +0200)]
echo_srv: Silence alignment warnings.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agoswrap: Silence alignment warnings.
Andreas Schneider [Tue, 2 Sep 2014 10:00:13 +0000 (12:00 +0200)]
swrap: Silence alignment warnings.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agoswrap: Fix type punning warnings when loading functions.
Andreas Schneider [Tue, 2 Sep 2014 09:55:58 +0000 (11:55 +0200)]
swrap: Fix type punning warnings when loading functions.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agoswrap: Fix access to struct members in log messages.
Andreas Schneider [Tue, 2 Sep 2014 09:16:04 +0000 (11:16 +0200)]
swrap: Fix access to struct members in log messages.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agoswrap: Fix whitespace errors.
Andreas Schneider [Mon, 1 Sep 2014 07:17:06 +0000 (09:17 +0200)]
swrap: Fix whitespace errors.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agoswrap: Update copyright notice.
Andreas Schneider [Fri, 29 Aug 2014 11:12:58 +0000 (13:12 +0200)]
swrap: Update copyright notice.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agoswrap: Wrap fopen to detect stale file descriptors.
Andreas Schneider [Wed, 27 Aug 2014 14:00:43 +0000 (16:00 +0200)]
swrap: Wrap fopen to detect stale file descriptors.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agoswrap: Use swrap_address in swrap_accept().
Andreas Schneider [Wed, 21 May 2014 13:14:56 +0000 (15:14 +0200)]
swrap: Use swrap_address in swrap_accept().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agoswrap: Remove unused sockaddr_dup() function.
Andreas Schneider [Wed, 21 May 2014 13:15:38 +0000 (15:15 +0200)]
swrap: Remove unused sockaddr_dup() function.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agoswrap: Use swrap_address in the socket_info struct.
Andreas Schneider [Wed, 21 May 2014 12:56:35 +0000 (14:56 +0200)]
swrap: Use swrap_address in the socket_info struct.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agoswrap: Use a sockaddr_un for the unix path in socket_info.
Andreas Schneider [Wed, 21 May 2014 12:06:05 +0000 (14:06 +0200)]
swrap: Use a sockaddr_un for the unix path in socket_info.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>