summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* swrap: fix use-after-free in swrap_closeMichael Adam2016-10-251-2/+4
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* swrap: Fix build on SolarisAndreas Schneider2016-10-251-1/+1
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* swrap: Mark flags in swrap_accept4 as unusedAndreas Schneider2016-10-211-0/+4
| | | | | | | This removes a compiler warning on non-Linux systems. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* swrap: Fix the build on BSD and SolarisAndreas Schneider2016-10-211-0/+2
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* swrap: Handle threads that forkAndreas Schneider2016-10-201-0/+43
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* cmake: Check for constructor attributeAndreas Schneider2016-10-203-0/+19
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* swrap: Make symbol loading thread-safeAndreas Schneider2016-10-201-3/+22
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* cmake: Link pthread library headersMichael Adam2016-10-202-2/+3
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* swrap: Fix strict-aliasing issues while loading symbolsAndreas Schneider2016-10-201-143/+221
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* tests: Add a test for max_socketsMichael Adam2016-10-202-1/+112
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* swrap: Introduce a freelist in the socket_info arrayMichael Adam2016-10-201-7/+37
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* swrap: Replace linked list of socket_info with preallocated array of structuresAnoop C S2016-10-201-28/+120
| | | | | | | | 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>
* swrap: Optimization in (commented out) check_addr_port_in_use()Michael Adam2016-10-201-0/+6
| | | | | | | | 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>
* swrap: Improve vfcntl to add the dup'd fd after the source fdMichael Adam2016-10-201-7/+7
| | | | | | | | 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>
* swrap: Improve dup2 to add the dup'd fd after the source fdMichael Adam2016-10-201-5/+6
| | | | | | | | 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>
* swrap: Improve dup to add the dup'd fd after the source fdMichael Adam2016-10-201-5/+6
| | | | | | | | 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>
* swrap: Add SWRAP_DLIST_ADD_AFTER macroMichael Adam2016-10-201-0/+14
| | | | | | | | 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>
* swrap: Untangle socket_info_fd from socket_info structure.Anoop C S2016-10-201-58/+76
| | | | | | | | | | | | | | | | | | | | 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>
* swrap: remove ununsed members from struct swrap.Michael Adam2016-08-231-5/+0
| | | | | | | | | | 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>
* swrap: Add test case to validate oldfd = newfd case in dup2()Anoop C S2016-08-232-0/+51
| | | | | | Signed-off-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* swrap: Treat the case of fd == newfd correctly in dup2()Michael Adam2016-08-231-0/+10
| | | | | | | | 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>
* swrap: Delay addition of child socket_info_fd into socket_info listAnoop C S2016-08-121-2/+1
| | | | | | | | | | | | | | 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>
* swrap: Remove redunant check in swrap_socketAnoop C S2016-08-121-4/+1
| | | | | | | | | | 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>
* swrap: Simplify swrap_remove_stale by early returnAnoop C S2016-08-121-14/+16
| | | | | | | 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>
* Bump version to 1.1.7socket_wrapper-1.1.7Andreas Schneider2016-05-202-2/+8
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* tests: Add test_connect_sendto_null_ipv4() testAndreas Schneider2016-05-171-0/+52
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* tests: Add a udp test case for sendto() after a connect()Richard Sharpe2016-05-171-0/+52
| | | | | | | | | | 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>
* swrap: Fix sendto() with connected socketsRichard Sharpe2016-05-171-9/+28
| | | | | | | | | | | | | | | | | | | | | | | 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>
* swrap: Allow to open RAW sockets when loadedAndreas Schneider2016-05-171-0/+3
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* swrap: Add support for accept4()Andreas Schneider2016-05-033-2/+43
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org>
* swrap: Add support for running on OpenBSDAndreas Schneider2016-05-033-0/+13
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org>
* Bump version to 1.1.6socket_wrapper-1.1.6Andreas Schneider2016-03-152-2/+8
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Fix buliding on unix systems without AF_NETLINKAndreas Schneider2016-03-021-0/+2
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* swrap: Use calloc() instead of malloc and memsetAndreas Schneider2016-02-241-6/+8
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Allow to open NETLINK sockets when loadedAndreas Schneider2016-02-241-0/+1
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* tests: Add test for ephemeral port binding in listen()Andreas Schneider2015-11-042-0/+116
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Automatically bind an ephemeral port if neededAndreas Schneider2015-11-041-0/+8
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* tests: Add valgrind suppression file for dlopen() issuesAndreas Schneider2015-10-281-0/+16
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Add a wrapper for write()Andreas Schneider2015-10-281-0/+60
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* torture: Use a short torture socket dirAndreas Schneider2015-10-271-1/+1
| | | | | | | | | 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>
* swrap: Fix recvmsg() with UDPAndreas Schneider2015-10-271-0/+10
| | | | | | | | | | | 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>
* swrap: Fix compare of signed and unsigned integer expressionsAndreas Schneider2015-10-191-2/+4
| | | | | | | | 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>
* tests: Fix compile warningAndreas Schneider2015-10-191-1/+1
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* Bump version to 1.1.5socket_wrapper-1.1.5Andreas Schneider2015-10-152-2/+6
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* swrap: Simplify cmspace calculation in swrap_sendmsg_copy_cmsg()Ralph Boehme2015-10-141-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* tests: Add a unit test for wrap_sendmsg_filter_cmsghdr()Ralph Boehme2015-10-142-1/+122
| | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* tests: Add test for TCP_NODELAY setsockopt()Andreas Schneider2015-10-141-0/+11
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* tests: Add test for TCP_NODELAY getsockopt()Andreas Schneider2015-10-141-0/+38
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* swrap: Add support for TCP_NODELAY in getsockopt()Andreas Schneider2015-10-141-0/+23
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* swrap: Add support for TCP_NODELAY in setsockopt()Andreas Schneider2015-10-141-0/+30
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>