summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* swrap: print out SOCKET_WRAPPER_PACKAGE and SOCKET_WRAPPER_VERSION on first useStefan Metzmacher2021-02-023-4/+8
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* src/socket_wrapper.c: Improve checks and debug output of socket_wrapper_dir()Andreas Schneider2021-01-291-2/+3
| | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* src/socket_wrapper.c: fix mutex fork handlingStefan Metzmacher2021-01-292-75/+92
| | | | | | | | | | | | | | We need to use pthread_mutex_init in the child handler... See https://sourceware.org/bugzilla/show_bug.cgi?id=2745 Valgrind tools like helgrind and drd don't understand this (at least in 3.15.0), they require a pthread_mutex_unlock() in the child in order work. Pair-Programmed-With: Andreas Schneider <asn@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Andreas Schneider <asn@samba.org>
* gitlab-ci: Add job for ThreadSanitizerAndreas Schneider2021-01-292-0/+30
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* cmake: Add ThreadSanitizer compile flagsAndreas Schneider2021-01-281-0/+12
| | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* src/socket_wrapper.c: always go through swrap_bind_symbol_all() protected by ↵Stefan Metzmacher2021-01-281-52/+55
| | | | | | pthread_once() Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* src/socket_wrapper.c: split out _swrap_bind_symbol_generic()Stefan Metzmacher2021-01-281-10/+6
| | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* src/socket_wrapper.c: remove unused swrap_bind_symbol_libnsl()Stefan Metzmacher2021-01-281-14/+0
| | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* socket_wrapper.c/tests: fall back to pragma init/fini for ↵Björn Jacke2020-11-042-1/+11
| | | | | | constructor/destructor if possible Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* configure: check for pragma init/fini for constructors/destructorsBjörn Jacke2020-11-042-0/+28
| | | | Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* Bump version to 1.2.5socket_wrapper-1.2.5Andreas Schneider2020-06-222-2/+7
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* socket_wrapper.c: let swrap_vioctl() handle SIOCOUTQ/TIOCOUTQ/FIONWRITE ↵Stefan Metzmacher2020-06-221-0/+18
| | | | | | | | | | | | | | | explicitly They are used to ask for the number of unacked bytes in the send queue, with AF_UNIX sockets get strange result, on linux 5.3 I get more bytes reported than I sent into the socket. All bytes reach the destination directly, so we can just always report 0 unacked bytes. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11897 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> (cherry picked from commit f317ebcdcdd626ed9e06de2eb60031306994c803)
* socket_wrapper.c: make FIONREAD handling more robust in swrap_vioctl()Stefan Metzmacher2020-06-221-3/+5
| | | | | | | | | | | We should only dereference the va args when the kernel already checked they are valid. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11897 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> (cherry picked from commit c95b7cb1d7b9348472276edceff71889aa676d25)
* test_echo_tcp_socket_options.c: add tests for TCP_INFOStefan Metzmacher2020-06-222-0/+82
| | | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> (cherry picked from commit a37c0175492fb1b35257b785c71dea4e4f6d4750)
* socket_wrapper.c: implement getsockopt(TCP_INFO) if the platform supports itStefan Metzmacher2020-06-223-0/+59
| | | | | | | | | | This just implements a few basics, which are required by Samba. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11897 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> (cherry picked from commit 300de6e099ea82ee5361918de8c3abb389e0782d)
* doc: Document SOCKET_WRAPPER_DIR_ALLOW_ORIGMartin Schwenke2020-06-222-1/+16
| | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Add SOCKET_WRAPPER_DIR_ALLOW_ORIG to allow fall backMartin Schwenke2020-06-221-2/+25
| | | | | | | | | | | Instead of failing when the path returned by realpath(3) is too long, if SOCKET_WRAPPER_DIR_ALLOW_ORIG is set then fall back to the original value. If this original path is too long or something else fails then abort. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Abort if socket wrapper directory is too long to be usableMartin Schwenke2020-06-221-0/+31
| | | | | | | | | | | | | | | | | If the socket wrapper directory path is too long to allow reliable construction of the required Unix domain socket paths then convert_in_un_alloc() can return ENFILE if paths are truncated in unfortunate ways. This can be very hard to debug since, for example, bind(2) should never return ENFILE. Instead, abort if the path returned by realpath(3) is unusable. The code structure is slightly weird but this accommodates an additional change. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Add abstractions to construct Unix domain socket pathsMartin Schwenke2020-06-221-16/+54
| | | | | | | | | These include overflow checks but the results of the checks are not yet used. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Abort on failure to use SOCKET_WRAPPER_DIRMartin Schwenke2020-06-221-1/+1
| | | | | | | | | | If SOCKET_WRAPPER_DIR is set the intention is to use socket wrapper. Returning NULL means socket wrapper is disabled. The only sure way to avoid running without socket wrapper is to abort. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* Revert "socket_wrapper.c: implement getsockopt(TCP_INFO) if the platform ↵Stefan Metzmacher2020-06-193-59/+0
| | | | | | | | | | supports it" This reverts commit 300de6e099ea82ee5361918de8c3abb389e0782d. This got merged automatically by gitlab without review. Signed-off-by: Stefan Metzmacher <metze@samba.org>
* Revert "test_echo_tcp_socket_options.c: add tests for TCP_INFO"Stefan Metzmacher2020-06-192-82/+0
| | | | | | | | This reverts commit a37c0175492fb1b35257b785c71dea4e4f6d4750. This got merged automatically by gitlab without review. Signed-off-by: Stefan Metzmacher <metze@samba.org>
* Revert "socket_wrapper.c: make FIONREAD handling more robust in swrap_vioctl()"Stefan Metzmacher2020-06-191-5/+3
| | | | | | | | This reverts commit c95b7cb1d7b9348472276edceff71889aa676d25. This got merged automatically by gitlab without review. Signed-off-by: Stefan Metzmacher <metze@samba.org>
* Revert "socket_wrapper.c: let swrap_vioctl() handle ↵Stefan Metzmacher2020-06-191-18/+0
| | | | | | | | | | SIOCOUTQ/TIOCOUTQ/FIONWRITE explicitly" This reverts commit f317ebcdcdd626ed9e06de2eb60031306994c803. This got merged automatically by gitlab without review. Signed-off-by: Stefan Metzmacher <metze@samba.org>
* Merge branch 'tcp_info' into 'master'Stefan Metzmacher2020-06-195-3/+164
|\ | | | | | | | | Add support for TCP_INFO and SIOCOUTQ/TIOCOUTQ/FIONWRITE See merge request cwrap/socket_wrapper!11
| * socket_wrapper.c: let swrap_vioctl() handle SIOCOUTQ/TIOCOUTQ/FIONWRITE ↵Stefan Metzmacher2020-06-191-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | explicitly They are used to ask for the number of unacked bytes in the send queue, with AF_UNIX sockets get strange result, on linux 5.3 I get more bytes reported than I sent into the socket. All bytes reach the destination directly, so we can just always report 0 unacked bytes. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11897 Signed-off-by: Stefan Metzmacher <metze@samba.org>
| * socket_wrapper.c: make FIONREAD handling more robust in swrap_vioctl()Stefan Metzmacher2020-06-191-3/+5
| | | | | | | | | | | | | | | | | | We should only dereference the va args when the kernel already checked they are valid. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11897 Signed-off-by: Stefan Metzmacher <metze@samba.org>
| * test_echo_tcp_socket_options.c: add tests for TCP_INFOStefan Metzmacher2020-06-192-0/+82
| | | | | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org>
| * socket_wrapper.c: implement getsockopt(TCP_INFO) if the platform supports itStefan Metzmacher2020-06-193-0/+59
|/ | | | | | | | This just implements a few basics, which are required by Samba. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11897 Signed-off-by: Stefan Metzmacher <metze@samba.org>
* tests: do not truncate pid to 16 bitsMike Gilbert2020-05-141-6/+4
| | | | | | | | | | On Linux, pid_t is a 32-bit type, and the kernel permits pids up to 22 bits in length. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14373 Signed-off-by: Mike Gilbert <floppym@gentoo.org> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* swrap: Remove extra new line towards end of SWRAP_LOG()Anoop C S2020-05-141-20/+20
| | | | | Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* Bump version to 1.2.4socket_wrapper-1.2.4Andreas Schneider2020-03-242-7/+15
| | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* Rename CHANGELOGAndreas Schneider2020-03-241-0/+0
| | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* gitlab-ci: Add ubuntu runnerAndreas Schneider2020-03-241-0/+19
| | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* gitlab-ci: Remove debian cross mips buildAndreas Schneider2020-03-241-25/+0
| | | | | | This isn't supported by Debian anymore. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* tests: Fix a compile warning on UbuntuAndreas Schneider2020-03-241-1/+3
| | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* tests: Fix a coverty warning in echo_srvAndreas Schneider2020-03-231-1/+3
| | | | | | CID #288875 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: add support for SOCKET_WRAPPER_IPV4_NETWORK=10.53.57.0Stefan Metzmacher2020-03-213-10/+42
| | | | | | | | | | | | | | With this 10.53.57.XX/8 addresses are used instead of 127.0.0.XX/8. Note the broadcast address is 127.255.255.255 or 10.255.255.255 (and not 10.53.57.255!). Some applications, e.g. Samba have some special behavior for loopback addresses. This allows more realistic tests and triggers the more common code paths. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* swrap: implement swrap_ipv4_{net,bcast,iface}() helper functionsStefan Metzmacher2020-03-211-9/+96
| | | | | | | This makes it easier to implement SOCKET_WRAPPER_IPV4_NETWORK in the next step. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* doc/socket_wrapper.1: clarify the possible values for ↵Stefan Metzmacher2020-03-212-7/+7
| | | | | | | | SOCKET_WRAPPER_DEFAULT_IFACE The valid range for <ID> starts with 1 (the default) and ends with 64. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* gitlab-ci: Whitelist metze to use the FreeBSD runnerAndreas Schneider2020-03-211-0/+1
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: provide _{socket,close,connect,...} symbols on FreeBSDStefan Metzmacher2020-03-193-2/+55
| | | | | | | Maybe that's not FreeBSD only, but at least this fixes the interaction of resolv_wrapper and socket_wrapper on FreeBSD 12. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* swrap: detect stale fd for socket(PF_UNIX) and accept()Stefan Metzmacher2020-03-191-1/+22
| | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* swrap: trace the SOCKET_WRAPPER_PCAP_FILE locationStefan Metzmacher2020-03-191-0/+1
| | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* swrap: Do not leak buf in swrap_sendmsg()socket_wrapper-1.2.3Andreas Schneider2019-03-211-0/+1
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* Bump version to 1.2.3Andreas Schneider2019-03-212-2/+6
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* swrap: Add missing NULL checks to socket_wrapper_dir()Andreas Schneider2019-03-211-0/+19
| | | | | | | | This return either malloc'ed memory or NULL. Make sure there is no problem. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* swrap: Print a warning if SOCKET_WRAPPER_DIR is not setAndreas Schneider2019-03-211-0/+1
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* Bump version to 1.2.2socket_wrapper-1.2.2Andreas Schneider2019-03-212-2/+7
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* swrap: Add paranoia NULL checksAndreas Schneider2019-03-211-0/+10
| | | | | | | csbuild complains about missing NULL checks here. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>