swrap: make swrap_accept() more resilient against races related to already disconnect...
authorStefan Metzmacher <metze@samba.org>
Fri, 5 Feb 2021 11:13:12 +0000 (12:13 +0100)
committerAndreas Schneider <asn@samba.org>
Fri, 5 Feb 2021 13:11:31 +0000 (14:11 +0100)
commite72898ad92a52a595d4733210483e9689cb5d390
treee99fc74e8168dd246f3ae2dd0c5195d4967c4c9e
parentc3f7465f9cf453ff3bd53750db4024deaba02fb5
swrap: make swrap_accept() more resilient against races related to already disconnected sockets

Callers of accept() expect to get ECONNABORTED instead of a disconnected
socket.

Even on Linux we have a potential race calling libc_getsockname()
after accept(), so we map ENOTCONN to ECONNABORTED.

We should do all syscalls in order to have peer and sockname, before
doing in memory things like calling sockaddr_convert_from_un().

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