summaryrefslogtreecommitdiffstats
path: root/src/socket_wrapper.c
Commit message (Collapse)AuthorAgeFilesLines
...
* swrap: extend input checks in swrap_bind()Michael Adam2014-06-011-2/+48
| | | | | | | 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>
* Update the todo list.Andreas Schneider2014-06-011-0/+1
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* swrap: add check for rpc/rpc.h - needed on freebsd for bindresvportMichael Adam2014-06-011-0/+3
| | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* swrap: Add support for bindresvport().Andreas Schneider2014-05-311-0/+87
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* swrap: Add missing family check in bind().Andreas Schneider2014-05-311-0/+5
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* swrap: Setup myname in swrap_socket() for getsockname().Andreas Schneider2014-05-311-0/+35
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* swrap: Make sure cmbuf is not NULL.Andreas Schneider2014-05-271-1/+1
| | | | | | | CID 63532 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* swrap: We need to pass a pointer-pointer to not leak memory.Andreas Schneider2014-05-271-11/+11
| | | | | | | CID 63533 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* swrap: Support more socket options in getsockopt().Andreas Schneider2014-05-261-5/+46
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* swrap: Call swrap_msghdr_filter_cmsghdr in swrap_sendmsg_before().Andreas Schneider2014-05-261-2/+31
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* swrap: Add swrap_msghdr_filter_cmsg_pktinfo().Andreas Schneider2014-05-261-7/+26
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* swrap: Add swrap_sendmsg_filter_cmsg_socket().Andreas Schneider2014-05-261-1/+35
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* swrap: Add swrap_sendmsg_copy_cmsg().Andreas Schneider2014-05-261-1/+41
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* swrap: Add swrap_sendmsg_filter_cmsghdr().Andreas Schneider2014-05-261-0/+27
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* swrap: Implement support for IP_RECVDSTADDR on BSD.Andreas Schneider2014-05-261-1/+22
| | | | | | Pair-Programmed-With: Michael Adam <obnox@samba.org> Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Michael Adam <obnox@samba.org>
* swrap: Check if the in_pktinfo structure is available.Andreas Schneider2014-05-261-1/+1
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* swrap: Silence a warning on OpenIndiana.Andreas Schneider2014-05-261-0/+2
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* swrap: Properly cache the handle also in LIBC_SO case.Pino Toscano2014-05-261-0/+2
| | | | | | | | | | 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>
* swrap: Truncate the address if the buffer is to small.Andreas Schneider2014-05-221-2/+14
| | | | | Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Michael Adam <obnox@samba.org>
* swrap: Process control messages in recvmsg().Andreas Schneider2014-05-221-1/+40
| | | | | | | 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>
* swrap: Call swrap_msghdr_socket_info in swrap_recvmsg_after().Andreas Schneider2014-05-221-5/+17
| | | | | | | 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>
* swrap: Add swrap_msghdr_socket_info().Andreas Schneider2014-05-221-0/+11
| | | | | | | | 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>
* swrap: Add swrap_msghdr_add_pktinfo().Andreas Schneider2014-05-221-0/+65
| | | | | | | | 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>
* swrap: Add swrap_msghdr_add_cmsghdr().Andreas Schneider2014-05-211-0/+71
| | | | | | | | 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>
* swrap: Add IP_PKTINFO support in setsockopt.Andreas Schneider2014-05-211-0/+21
| | | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Correctly set the bind iface address on connect().Andreas Schneider2014-05-081-0/+57
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: use LIBC_SO from GNU libc, if availablePino Toscano2014-05-081-0/+8
| | | | | | | | | 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>
* swrap: Fall back to RTLD_NEXT if we can't find libc.Andreas Schneider2014-05-051-4/+4
| | | | | | | 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>
* Fix some typos.Jakub Wilk2014-05-051-4/+4
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=10566 Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* swrap: Use the loaded libc open() directly.Andreas Schneider2014-04-251-2/+14
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* swrap: Do not leak memory in swrap_recvmsg_after().Andreas Schneider2014-04-141-3/+4
| | | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jakub Hrozek <jhrozek@redhat.com> Reviewed-by: Simo Sorce <idra@samba.org>
* src: Add a public socket_wrapper_enabled() function.socket_wrapper-1.0.0Andreas Schneider2014-02-011-1/+9
| | | | Reviewed-by: Jeremy Allison <jra@samba.org>
* src: Fix va arg passing in open().Andreas Schneider2014-01-291-7/+15
| | | | Reviewed-by: Stefan Metzmacher <metze@samba.org>
* src: Handle stale fds in dup() and dup2().Andreas Schneider2014-01-281-0/+6
| | | | Reviewed-by: Stefan Metzmacher <metze@samba.org>
* src: Add timerfd_create() to handle stale fds.Andreas Schneider2014-01-281-0/+38
| | | | Reviewed-by: Stefan Metzmacher <metze@samba.org>
* src: Add eventfd() to handle stale fds.Andreas Schneider2014-01-281-0/+38
| | | | Reviewed-by: Stefan Metzmacher <metze@samba.org>
* src: Add signalfd() to handle stale fds.Andreas Schneider2014-01-281-0/+38
| | | | Reviewed-by: Stefan Metzmacher <metze@samba.org>
* src: Add socketpair() to handle stale fds.Andreas Schneider2014-01-281-0/+30
| | | | Reviewed-by: Stefan Metzmacher <metze@samba.org>
* src: Add pipe() to handle stale fds.Andreas Schneider2014-01-281-0/+30
| | | | Reviewed-by: Stefan Metzmacher <metze@samba.org>
* src: Check for stale fds in swrap_accept().Andreas Schneider2014-01-281-0/+4
| | | | Reviewed-by: Stefan Metzmacher <metze@samba.org>
* src: Check for stale fds in swrap_socket().Andreas Schneider2014-01-281-1/+9
| | | | Reviewed-by: Stefan Metzmacher <metze@samba.org>
* src: Handle stale fds in swrap_recvmsg_after().Andreas Schneider2014-01-281-9/+16
| | | | Reviewed-by: Stefan Metzmacher <metze@samba.org>
* src: Handle stale fds in swrap_sendmsg_after().Andreas Schneider2014-01-281-7/+13
| | | | Reviewed-by: Stefan Metzmacher <metze@samba.org>
* src: Try to recover when reading from a fd returns ENOTSOCK.Nalin Dahyabhai2014-01-281-8/+25
| | | | | | | | | When attempting to read from a descriptor, if an underlying autobind fails because it's not a socket, stop intercepting uses of that descriptor. Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* src: Try to recover when writing to fd returns ENOTSOCK.Nalin Dahyabhai2014-01-281-9/+32
| | | | | | | | | When attempting to write to a descriptor, if an underlying autobind fails because it's not a socket, stop intercepting uses of that descriptor. Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* src: Try to recover when sockets are closed elsewhere.Nalin Dahyabhai2014-01-281-0/+61
| | | | | | | | | | | There are methods for closing descriptors (libc-internal code paths, direct syscalls) which close descriptors in ways that we can't intercept, so try to recover when we notice that that's happened: * If we see a descriptor being handed back from open() that we thought was a socket, stop intercepting uses of that descriptor. Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* src: Use swrap_recvmsg_(before|after) for swrap_readv().Andreas Schneider2014-01-281-53/+27
| | | | Reviewed-by: Stefan Metzmacher <metze@samba.org>
* src: Fix warnings on Solaris.Andreas Schneider2014-01-211-5/+7
|
* src: Initialize sockaddr_un.Andreas Schneider2014-01-211-1/+1
| | | | Fixes a valgrind warning.
* src: Make sure the memory is zeroed.Andreas Schneider2014-01-211-1/+4
|