rpc_server: Don't rely on TCP-bind() to return EADDRINUSE
commitaa147153c10b94e2db40d772677efacd5d0b31ee
authorVolker Lendecke <vl@samba.org>
Sat, 12 Jun 2021 10:45:30 +0000 (12 12:45 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 15 Jun 2021 18:11:35 +0000 (15 18:11 +0000)
tree55b57a5e581349a3f029f196ad31a8ac5d858194
parent582030bae25c65b2ae7176d427923c24b7e54220
rpc_server: Don't rely on TCP-bind() to return EADDRINUSE

socket_wrapper can't do EADDRINUSE because unix domain sockets don't
do it.

This currently works correctly because right now all RPC servers
either use explicit ports or all listen on the same socket.

The new code uses a static variable, so it only helps if a single
process listens for multiple RPC sockets. It won't work if multiple
processes start listening. But in case samba-dcerpcd goes in this will
be exactly the right thing to do.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/rpc_server/rpc_sock_helper.c