winbindd: cleanup client connection if the client closes the connection
authorUri Simchoni <urisimchoni@gmail.com>
Thu, 25 Jun 2015 05:59:20 +0000 (08:59 +0300)
committerJeremy Allison <jra@samba.org>
Wed, 15 Jul 2015 20:41:13 +0000 (22:41 +0200)
commit28e1cae4918213ba0cc7903a63d6200e69e5d1c7
treecf12fdf3cc81846547452043b77dddf67054518b
parent6da042d7c6e516cb9044f24f33df2a683c7de8fe
winbindd: cleanup client connection if the client closes the connection

This patch allows for early cleanup of client connections if the client
has given up.
Before this patch, any received request would be processed, and then only
upon transmitting the result to the client would winbindd find out the
client is no longer with us, possibly leading to a situation where the
same client tries over and over and increases the number of client
connections.

This patch monitors the client socket for readability while the request
is being processed, and closes the client connection if the socket
becomes readable. The client is not supposed to be writing anything to
the socket while it is waiting, so readability means either that the client
has closed the connection, or that it has broken the protocol.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11397

Signed-off-by: Uri Simchoni <urisimchoni@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/winbindd/winbindd.c