winbind: fix smbd hanging on Solaris when winbindd closes socket.
commit32932b40c0ad95711200af4287d581ddbcfe2182
authorMichael Adam <obnox@samba.org>
Mon, 27 Oct 2008 13:28:44 +0000 (27 14:28 +0100)
committerKarolin Seeger <kseeger@samba.org>
Tue, 9 Dec 2008 10:39:03 +0000 (9 11:39 +0100)
tree492f251c844f5bec33e623207c22d44742d5a66a
parentcbdd3767854e72f64aa5385176a246cc49f9f389
winbind: fix smbd hanging on Solaris when winbindd closes socket.

On some versions of Solaris, we observed a strange effect of close(2)
on a socket: After the server (here winbindd) called close, the client fd
was not marked as readable for select. And a write call to the fd did
not produce an error EPIPE but just returned as if successful.

So while winbindd had called remove_client(), the corresponding smbd
still thought that it was connected, but failed to retrieve answers
for its queries.

This patch works around the problem by forcing the client fd to
the readable state: Just write one byte into the socket before
closing.

Michael
(cherry picked from commit 6cd1575e1cf7564f7c7c56eedf58af8dcb709f44)
source/winbindd/winbindd.c