From b881d2ee78f685aea7ae8b67b3e0fb3c4f5205ed Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 27 Oct 2008 14:28:44 +0100 Subject: [s3]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 --- source3/winbindd/winbindd.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source3/winbindd') diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index 5d4f21a820..ac2a87ffce 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -727,12 +727,17 @@ static void new_connection(int listen_sock, bool privileged) static void remove_client(struct winbindd_cli_state *state) { + char c = 0; + /* It's a dead client - hold a funeral */ if (state == NULL) { return; } - + + /* tell client, we are closing ... */ + write(state->sock, &c, sizeof(c)); + /* Close socket */ close(state->sock); -- cgit