obnox/cwrap/socket_wrapper.git
9 years agoswrap: Rename swrap_pcap_dump_packet().
Andreas Schneider [Wed, 21 May 2014 09:01:46 +0000 (11:01 +0200)]
swrap: Rename swrap_pcap_dump_packet().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agoswrap: Rename swrap_pcap_get_fd().
Andreas Schneider [Wed, 21 May 2014 08:59:29 +0000 (10:59 +0200)]
swrap: Rename swrap_pcap_get_fd().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agoswrap: Rename swrap_marshall_packet().
Andreas Schneider [Wed, 21 May 2014 08:58:48 +0000 (10:58 +0200)]
swrap: Rename swrap_marshall_packet().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agoswrap: Rename swrap_packet_init().
Andreas Schneider [Wed, 21 May 2014 08:57:36 +0000 (10:57 +0200)]
swrap: Rename swrap_packet_init().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agoswrap: Rename socket_wrapper_pcap_file().
Andreas Schneider [Wed, 21 May 2014 08:55:48 +0000 (10:55 +0200)]
swrap: Rename socket_wrapper_pcap_file().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agoecho_srv: Fix type punning warnings.
Andreas Schneider [Fri, 29 Aug 2014 15:37:51 +0000 (17:37 +0200)]
echo_srv: Fix type punning warnings.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agotests: Fix type punning warnings.
Andreas Schneider [Fri, 29 Aug 2014 08:33:16 +0000 (10:33 +0200)]
tests: Fix type punning warnings.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agoswrap: Fix type punning warnings.
Andreas Schneider [Fri, 29 Aug 2014 08:25:51 +0000 (10:25 +0200)]
swrap: Fix type punning warnings.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agocmake: Set strict aliasing and strict overflow checks.
Andreas Schneider [Thu, 28 Aug 2014 13:22:35 +0000 (15:22 +0200)]
cmake: Set strict aliasing and strict overflow checks.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
9 years agoAdd #define __APPLE_USE_RFC_3542 to CFLAGS
Jakub Hrozek [Tue, 29 Jul 2014 06:19:34 +0000 (08:19 +0200)]
Add #define __APPLE_USE_RFC_3542 to CFLAGS

Unless __APPLE_USE_RFC_3542 is defined on OSX, constants from RFC 3542
such as IPV6_RECVPKTINFO are not usable.

The patch adds the #define unconditionally -- on other platforms, the
constant is harmless.

Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoDefine _GNU_SOURCE on one place only.
Jakub Hrozek [Wed, 13 Aug 2014 07:44:30 +0000 (09:44 +0200)]
Define _GNU_SOURCE on one place only.

There were several _GNU_SOURCE definitions scaterred in the build
system. This patch always adds -D_GNU_SOURCE to the CFLAGS if building
on a UNIX platform.

Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoProvide a compatible declaration of CMSG_ALIGN
Jakub Hrozek [Thu, 3 Jul 2014 21:13:29 +0000 (23:13 +0200)]
Provide a compatible declaration of CMSG_ALIGN

Some platforms (like OSX) do support some of the CMGS macros, but don't
have a CMSG_ALIGN macro of their own.

Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoSO_PROTOCOL is platform-dependent
Jakub Hrozek [Tue, 1 Jul 2014 22:01:04 +0000 (00:01 +0200)]
SO_PROTOCOL is platform-dependent

SO_PROTOCOL is not defined on all platforms. In particular, OSX doesn't
include it and so far I haven't found any compatible declaration.

Signed-off-by: Jakub Hrozek <jakub.hrozek@gmail.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoswrap: fix another discard const warning in swrap_bind()
Michael Adam [Tue, 3 Jun 2014 19:50:11 +0000 (21:50 +0200)]
swrap: fix another discard const warning in swrap_bind()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
9 years agoswrap: fix discard const warning in swrap_bind()
Michael Adam [Tue, 3 Jun 2014 19:49:12 +0000 (21:49 +0200)]
swrap: fix discard const warning in swrap_bind()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
9 years agoswrap: fix discard const warning in swrap_remove_stale()
Michael Adam [Tue, 3 Jun 2014 19:48:01 +0000 (21:48 +0200)]
swrap: fix discard const warning in swrap_remove_stale()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
9 years agoswrap: fix build when neither HAVE_STRUCT_IN_PKTINFO nor IP_RECVDSTADDR is defined
Michael Adam [Tue, 3 Jun 2014 13:52:43 +0000 (15:52 +0200)]
swrap: fix build when neither HAVE_STRUCT_IN_PKTINFO nor IP_RECVDSTADDR is defined

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
9 years agotorture: add HAVE_IPV6 guard to torture_server_address()
Michael Adam [Wed, 4 Jun 2014 07:35:02 +0000 (09:35 +0200)]
torture: add HAVE_IPV6 guard to torture_server_address()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
9 years agocmake: Add more build warnings and errors.
Andreas Schneider [Tue, 3 Jun 2014 13:52:43 +0000 (15:52 +0200)]
cmake: Add more build warnings and errors.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agofix .gitignore for vi backup files
Michael Adam [Thu, 5 Jun 2014 22:55:11 +0000 (00:55 +0200)]
fix .gitignore for vi backup files

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
9 years agodoc: Add a socket_wrapper manpage.
Andreas Schneider [Wed, 9 Jul 2014 08:15:30 +0000 (10:15 +0200)]
doc: Add a socket_wrapper manpage.

9 years agoBump version to 1.1.1
Andreas Schneider [Thu, 5 Jun 2014 21:41:09 +0000 (23:41 +0200)]
Bump version to 1.1.1

9 years agoswrap: Disable incomplete bind checks for EADDRINUSE.
Andreas Schneider [Thu, 5 Jun 2014 21:47:40 +0000 (23:47 +0200)]
swrap: Disable incomplete bind checks for EADDRINUSE.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agotests: Disable addr_in_use bind test while the swrap code is incomplete.
Andreas Schneider [Thu, 5 Jun 2014 21:46:31 +0000 (23:46 +0200)]
tests: Disable addr_in_use bind test while the swrap code is incomplete.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoBump version to 1.1.0.
Andreas Schneider [Mon, 2 Jun 2014 12:39:04 +0000 (14:39 +0200)]
Bump version to 1.1.0.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agotests: Fix conflicting variable name on Solaris.
Andreas Schneider [Mon, 2 Jun 2014 06:36:49 +0000 (08:36 +0200)]
tests: Fix conflicting variable name on Solaris.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agotests: Fix building without bindresvport().
Andreas Schneider [Mon, 2 Jun 2014 06:30:50 +0000 (08:30 +0200)]
tests: Fix building without bindresvport().

This fixes the build on Solaris.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agotests: add new test test_bind_ipv4_addr_in_use()
Michael Adam [Sat, 31 May 2014 01:35:22 +0000 (03:35 +0200)]
tests: add new test test_bind_ipv4_addr_in_use()

This tests binding an address that is already in use.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
9 years agotests: extend the ipv6 bind test
Michael Adam [Sat, 31 May 2014 01:31:56 +0000 (03:31 +0200)]
tests: extend the ipv6 bind test

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
9 years agotests: greatly extend the ipv4 bind test
Michael Adam [Sat, 31 May 2014 01:31:29 +0000 (03:31 +0200)]
tests: greatly extend the ipv4 bind test

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
9 years agoswrap: check whether an address:port is already in use in swrap_bind()
Michael Adam [Fri, 30 May 2014 12:20:40 +0000 (14:20 +0200)]
swrap: check whether an address:port is already in use in swrap_bind()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
9 years agoswrap: implement check_addr_port_in_use()
Michael Adam [Fri, 30 May 2014 12:20:17 +0000 (14:20 +0200)]
swrap: implement check_addr_port_in_use()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
9 years agoswrap: fix AF_UNSPEC special case in swrap_bind()
Michael Adam [Fri, 30 May 2014 11:21:00 +0000 (13:21 +0200)]
swrap: fix AF_UNSPEC special case in swrap_bind()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
9 years agoswrap: extend input checks in swrap_bind()
Michael Adam [Fri, 30 May 2014 11:06:02 +0000 (13:06 +0200)]
swrap: extend input checks in swrap_bind()

Not only check family, but depending on family, also check the length.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
9 years agoUpdate the todo list.
Andreas Schneider [Wed, 28 May 2014 08:04:04 +0000 (10:04 +0200)]
Update the todo list.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agotests: Avoid using getenv() to retrieve the path.
Andreas Schneider [Wed, 28 May 2014 07:46:57 +0000 (09:46 +0200)]
tests: Avoid using getenv() to retrieve the path.

CID 17221

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoswrap: add check for rpc/rpc.h - needed on freebsd for bindresvport
Michael Adam [Sat, 31 May 2014 23:48:15 +0000 (01:48 +0200)]
swrap: add check for rpc/rpc.h - needed on freebsd for bindresvport

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
9 years agotests: Add tests for bindresvport().
Andreas Schneider [Wed, 28 May 2014 07:46:40 +0000 (09:46 +0200)]
tests: Add tests for bindresvport().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoswrap: Add support for bindresvport().
Andreas Schneider [Tue, 20 May 2014 18:04:02 +0000 (20:04 +0200)]
swrap: Add support for bindresvport().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agotests: Add tests for bind().
Andreas Schneider [Wed, 21 May 2014 07:15:10 +0000 (09:15 +0200)]
tests: Add tests for bind().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoswrap: Add missing family check in bind().
Andreas Schneider [Wed, 21 May 2014 06:30:53 +0000 (08:30 +0200)]
swrap: Add missing family check in bind().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agotests: Add test that getsockname is correct after socket().
Andreas Schneider [Tue, 27 May 2014 18:53:51 +0000 (20:53 +0200)]
tests: Add test that getsockname is correct after socket().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoswrap: Setup myname in swrap_socket() for getsockname().
Andreas Schneider [Tue, 27 May 2014 18:43:51 +0000 (20:43 +0200)]
swrap: Setup myname in swrap_socket() for getsockname().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agotorture: Wait for the pidfile and then start the tests.
Andreas Schneider [Fri, 30 May 2014 11:59:43 +0000 (13:59 +0200)]
torture: Wait for the pidfile and then start the tests.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoecho_srv: Write pidfile after we setup the listeners.
Andreas Schneider [Fri, 30 May 2014 11:57:25 +0000 (13:57 +0200)]
echo_srv: Write pidfile after we setup the listeners.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoREADME.install: improvements and fixes.
Michael Adam [Tue, 27 May 2014 12:05:45 +0000 (14:05 +0200)]
README.install: improvements and fixes.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
9 years agoAdd README.install - instructions for building and installing.
Michael Adam [Tue, 27 May 2014 05:57:20 +0000 (07:57 +0200)]
Add README.install - instructions for building and installing.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
9 years agotests: Fix possible format string attack.
Andreas Schneider [Tue, 27 May 2014 07:35:00 +0000 (09:35 +0200)]
tests: Fix possible format string attack.

Well, there is really not attack on a test but we want to silence
Coverity :)

CID 17221

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoswrap: Make sure cmbuf is not NULL.
Andreas Schneider [Tue, 27 May 2014 07:09:24 +0000 (09:09 +0200)]
swrap: Make sure cmbuf is not NULL.

CID 63532

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoswrap: We need to pass a pointer-pointer to not leak memory.
Andreas Schneider [Tue, 27 May 2014 07:08:32 +0000 (09:08 +0200)]
swrap: We need to pass a pointer-pointer to not leak memory.

CID 63533

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agotests: Add more tests for socket options.
Andreas Schneider [Thu, 22 May 2014 09:32:22 +0000 (11:32 +0200)]
tests: Add more tests for socket options.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoswrap: Support more socket options in getsockopt().
Andreas Schneider [Thu, 22 May 2014 09:18:08 +0000 (11:18 +0200)]
swrap: Support more socket options in getsockopt().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoecho_srv: Add support for IP_SENDSRCADDR.
Andreas Schneider [Fri, 23 May 2014 12:36:23 +0000 (14:36 +0200)]
echo_srv: Add support for IP_SENDSRCADDR.

Pair-Programmed-With: Michael Adam <obnox@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
9 years agoswrap: Call swrap_msghdr_filter_cmsghdr in swrap_sendmsg_before().
Andreas Schneider [Fri, 23 May 2014 12:35:59 +0000 (14:35 +0200)]
swrap: Call swrap_msghdr_filter_cmsghdr in swrap_sendmsg_before().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoswrap: Add swrap_msghdr_filter_cmsg_pktinfo().
Andreas Schneider [Fri, 23 May 2014 12:35:34 +0000 (14:35 +0200)]
swrap: Add swrap_msghdr_filter_cmsg_pktinfo().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoswrap: Add swrap_sendmsg_filter_cmsg_socket().
Andreas Schneider [Fri, 23 May 2014 13:44:23 +0000 (15:44 +0200)]
swrap: Add swrap_sendmsg_filter_cmsg_socket().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoswrap: Add swrap_sendmsg_copy_cmsg().
Andreas Schneider [Fri, 23 May 2014 13:48:33 +0000 (15:48 +0200)]
swrap: Add swrap_sendmsg_copy_cmsg().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoswrap: Add swrap_sendmsg_filter_cmsghdr().
Andreas Schneider [Fri, 23 May 2014 13:42:14 +0000 (15:42 +0200)]
swrap: Add swrap_sendmsg_filter_cmsghdr().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoecho_srv: Implement support for IP_RECVDSTADDR on BSD.
Andreas Schneider [Mon, 26 May 2014 09:07:45 +0000 (11:07 +0200)]
echo_srv: Implement support for IP_RECVDSTADDR on BSD.

Pair-Programmed-With: Michael Adam <obnox@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
9 years agoswrap: Implement support for IP_RECVDSTADDR on BSD.
Andreas Schneider [Mon, 26 May 2014 09:00:09 +0000 (11:00 +0200)]
swrap: Implement support for IP_RECVDSTADDR on BSD.

Pair-Programmed-With: Michael Adam <obnox@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
9 years agoecho_srv: Fix building on OpenIndiana.
Andreas Schneider [Fri, 23 May 2014 07:26:13 +0000 (09:26 +0200)]
echo_srv: Fix building on OpenIndiana.

Solaris doesn't have support for auxillary messages.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoswrap: Check if the in_pktinfo structure is available.
Andreas Schneider [Fri, 23 May 2014 08:01:21 +0000 (10:01 +0200)]
swrap: Check if the in_pktinfo structure is available.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoswrap: Silence a warning on OpenIndiana.
Andreas Schneider [Fri, 23 May 2014 07:20:31 +0000 (09:20 +0200)]
swrap: Silence a warning on OpenIndiana.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agotests: Fix assert_sockaddr_equal() file and line output.
Andreas Schneider [Wed, 21 May 2014 12:52:21 +0000 (14:52 +0200)]
tests: Fix assert_sockaddr_equal() file and line output.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agocmake: Add some warnings were we should error out.
Andreas Schneider [Fri, 23 May 2014 06:50:47 +0000 (08:50 +0200)]
cmake: Add some warnings were we should error out.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
9 years agoswrap: Properly cache the handle also in LIBC_SO case.
Pino Toscano [Thu, 8 May 2014 14:26:43 +0000 (16:26 +0200)]
swrap: Properly cache the handle also in LIBC_SO case.

Small regression introduced by me in commit
0fa56909442c3cfea6a697681ea0e89ba5a0aa0f.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=10572

Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agocmake: Fix a typo in socket_wrapper-config.cmake.in.
Andreas Schneider [Thu, 22 May 2014 12:56:09 +0000 (14:56 +0200)]
cmake: Fix a typo in socket_wrapper-config.cmake.in.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agocmake: Require cmocka versin 0.4.1.
Andreas Schneider [Thu, 22 May 2014 06:49:07 +0000 (08:49 +0200)]
cmake: Require cmocka versin 0.4.1.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agotests: Add test for different length passed to get(sock|peer)name.
Andreas Schneider [Wed, 14 May 2014 16:08:38 +0000 (18:08 +0200)]
tests: Add test for different length passed to get(sock|peer)name.

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agoswrap: Truncate the address if the buffer is to small.
Andreas Schneider [Wed, 14 May 2014 15:44:07 +0000 (17:44 +0200)]
swrap: Truncate the address if the buffer is to small.

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agotests: Add support to sending IP_PKTINFO in echo_srv.
Andreas Schneider [Wed, 14 May 2014 09:28:33 +0000 (11:28 +0200)]
tests: Add support to sending IP_PKTINFO in echo_srv.

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agotests: Add support to receive IP_PKTINFO in echo_srv.
Andreas Schneider [Wed, 14 May 2014 08:11:37 +0000 (10:11 +0200)]
tests: Add support to receive IP_PKTINFO in echo_srv.

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agoswrap: Process control messages in recvmsg().
Andreas Schneider [Tue, 13 May 2014 14:06:13 +0000 (16:06 +0200)]
swrap: Process control messages in recvmsg().

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agoswrap: Call swrap_msghdr_socket_info in swrap_recvmsg_after().
Andreas Schneider [Tue, 13 May 2014 14:05:44 +0000 (16:05 +0200)]
swrap: Call swrap_msghdr_socket_info in swrap_recvmsg_after().

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agoswrap: Add swrap_msghdr_socket_info().
Andreas Schneider [Tue, 13 May 2014 14:02:26 +0000 (16:02 +0200)]
swrap: Add swrap_msghdr_socket_info().

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Pair-Programmed-With: Michael Adam <obnox@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
10 years agoswrap: Add swrap_msghdr_add_pktinfo().
Andreas Schneider [Tue, 13 May 2014 14:01:25 +0000 (16:01 +0200)]
swrap: Add swrap_msghdr_add_pktinfo().

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Pair-Programmed-With: Michael Adam <obnox@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
10 years agoswrap: Add swrap_msghdr_add_cmsghdr().
Andreas Schneider [Wed, 22 Jan 2014 17:45:51 +0000 (18:45 +0100)]
swrap: Add swrap_msghdr_add_cmsghdr().

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Pair-Programmed-With: Michael Adam <obnox@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
10 years agoswrap: Add IP_PKTINFO support in setsockopt.
Andreas Schneider [Wed, 22 Jan 2014 18:09:51 +0000 (19:09 +0100)]
swrap: Add IP_PKTINFO support in setsockopt.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agocmake: Add check for HAVE_STRUCT_IN6_PKTINFO.
Andreas Schneider [Wed, 22 Jan 2014 19:06:59 +0000 (20:06 +0100)]
cmake: Add check for HAVE_STRUCT_IN6_PKTINFO.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agocmake: Build swrap with _GNU_SOURCE.
Andreas Schneider [Mon, 12 May 2014 23:56:17 +0000 (01:56 +0200)]
cmake: Build swrap with _GNU_SOURCE.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agotests: Add test to verify that the binded iface address is correct.
Andreas Schneider [Tue, 15 Apr 2014 12:11:06 +0000 (14:11 +0200)]
tests: Add test to verify that the binded iface address is correct.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoswrap: Correctly set the bind iface address on connect().
Andreas Schneider [Wed, 7 May 2014 16:31:00 +0000 (18:31 +0200)]
swrap: Correctly set the bind iface address on connect().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoswrap: use LIBC_SO from GNU libc, if available
Pino Toscano [Thu, 8 May 2014 11:37:02 +0000 (13:37 +0200)]
swrap: use LIBC_SO from GNU libc, if available

Look for gnu/lib-names.h and use the LIBC_SO define to dlopen libc, so
the right library is loaded without manually searching for libc.so.N.

Signed-off-by: Pino Toscano <toscano.pino@tiscali.it>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoBump version to 1.0.2.
Andreas Schneider [Mon, 5 May 2014 07:35:36 +0000 (09:35 +0200)]
Bump version to 1.0.2.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoswrap: Fall back to RTLD_NEXT if we can't find libc.
Andreas Schneider [Tue, 29 Apr 2014 09:07:06 +0000 (11:07 +0200)]
swrap: Fall back to RTLD_NEXT if we can't find libc.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=10572

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoFix some typos.
Jakub Wilk [Tue, 29 Apr 2014 08:55:04 +0000 (10:55 +0200)]
Fix some typos.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=10566

Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoswrap: Use the loaded libc open() directly.
Andreas Schneider [Fri, 25 Apr 2014 06:37:37 +0000 (08:37 +0200)]
swrap: Use the loaded libc open() directly.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agoecho_srv: Fix possible resouce leaks on error in socket_dup().
Andreas Schneider [Mon, 14 Apr 2014 19:57:15 +0000 (21:57 +0200)]
echo_srv: Fix possible resouce leaks on error in socket_dup().

CID: #17217

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agotests: Fix use of tainted string in test_ioctl.
Andreas Schneider [Mon, 14 Apr 2014 19:54:17 +0000 (21:54 +0200)]
tests: Fix use of tainted string in test_ioctl.

CID: #17221

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agocmake: Fix policy check.
Andreas Schneider [Fri, 25 Apr 2014 11:57:38 +0000 (13:57 +0200)]
cmake: Fix policy check.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agocmake: Install cmake config in the correct directory.
Andreas Schneider [Wed, 16 Apr 2014 13:44:10 +0000 (15:44 +0200)]
cmake: Install cmake config in the correct directory.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
10 years agoecho_srv: Improve reopening low fds.
Andreas Schneider [Thu, 10 Apr 2014 09:54:03 +0000 (11:54 +0200)]
echo_srv: Improve reopening low fds.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Reviewed-by: Simo Sorce <idra@samba.org>
10 years agoecho_srv: Don't leak client_sock on failures in echo_tcp
Jakub Hrozek [Thu, 10 Apr 2014 09:41:31 +0000 (11:41 +0200)]
echo_srv: Don't leak client_sock on failures in echo_tcp

Signed-off-by: Jakub Hrozek <jhrozek@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Simo Sorce <idra@samba.org>
10 years agotests: Fix an out of bound access.
Andreas Schneider [Thu, 10 Apr 2014 08:49:01 +0000 (10:49 +0200)]
tests: Fix an out of bound access.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Reviewed-by: Simo Sorce <idra@samba.org>
10 years agotests: Fix a possible resource leak on error in sockopt test.
Andreas Schneider [Thu, 10 Apr 2014 08:46:18 +0000 (10:46 +0200)]
tests: Fix a possible resource leak on error in sockopt test.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Reviewed-by: Simo Sorce <idra@samba.org>
10 years agoswrap: Do not leak memory in swrap_recvmsg_after().
Andreas Schneider [Thu, 10 Apr 2014 08:42:51 +0000 (10:42 +0200)]
swrap: Do not leak memory in swrap_recvmsg_after().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Reviewed-by: Simo Sorce <idra@samba.org>
10 years agoecho_srv: Fix resource leak of fd in pidfile().
Andreas Schneider [Thu, 10 Apr 2014 08:40:32 +0000 (10:40 +0200)]
echo_srv: Fix resource leak of fd in pidfile().

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Reviewed-by: Simo Sorce <idra@samba.org>
10 years agoecho_srv: Fix resource leak of s2 on error.
Andreas Schneider [Thu, 10 Apr 2014 08:30:40 +0000 (10:30 +0200)]
echo_srv: Fix resource leak of s2 on error.

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Reviewed-by: Simo Sorce <idra@samba.org>
10 years agoecho_srv: Fix resource leak of sock.
Andreas Schneider [Thu, 10 Apr 2014 08:28:46 +0000 (10:28 +0200)]
echo_srv: Fix resource leak of sock.

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Reviewed-by: Simo Sorce <idra@samba.org>
10 years agotests: Fix creating remove_cmd.
Andreas Schneider [Thu, 10 Apr 2014 08:23:14 +0000 (10:23 +0200)]
tests: Fix creating remove_cmd.

Found by Coverity.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
Reviewed-by: Simo Sorce <idra@samba.org>