s3: Fix bug 7844: Race in winbind
authorVolker Lendecke <vl@samba.org>
Mon, 6 Dec 2010 20:01:35 +0000 (21:01 +0100)
committerKarolin Seeger <kseeger@samba.org>
Mon, 24 Oct 2011 17:15:51 +0000 (19:15 +0200)
commit3ff0dc42874ece5240d6121e512ab81f3f2d0114
tree2c494d26096b4fade9db9979143d5c5efd769d18
parenta1ea93395614cf234f8fb31bbc3904e8cd45aa86
s3: Fix bug 7844: Race in winbind

If a child dies, the parent process right away closes the socket.
This is wrong, with tevent we still have events pending. This works
fine for epoll but does not for at least the FreeBSD select variant.
Tevent sticks a closed socket into the select masks. This then
returns an error EBADF. When this happens, the parent winbind dies
instead of forking a new child.

This moves the socket close from the SIGCHLD cleanup function to
the socket receiver. I could not reproduce the parent death anymore
and it did not create an obvious fd leak.
(cherry picked from commit da08c8ac7cf9e2833c39e7ef39caafa4ab34424d)
source3/winbindd/winbindd_dual.c