Ensure that timeouts apply to TCP socket connexions.
commit5b55e4429caed27b32aac4bc5930f2672a43f273
authorRoland C. Dowdeswell <elric@imrryr.org>
Fri, 20 Jan 2012 17:11:54 +0000 (20 17:11 +0000)
committerLove Hornquist Astrand <lha@h5l.org>
Fri, 20 Jan 2012 17:49:20 +0000 (20 09:49 -0800)
tree26552995176eb3fff266f195b1e468b260bb8379
parent0924834587f3db21e19f261b4ba5a82ecbf361e8
Ensure that timeouts apply to TCP socket connexions.

Currently the Heimdal code calls connect(2) on TCP connexions to
the KDC without setting O_NONBLOCK.  This code implements a
timed_connect() function which will in the case of SOCK_STREAM
sockets put the socket into non-blocking mode prior to calling
connect and use select(2) to apply the configured timeout to connect
completion.  This does not entirely solve the problem of potential
timeouts in the code as it is still possible to block while writing
to the socket.  A proper implementation would also likely start
new connexions after a short interval before timing out existing
connexions and return the results from the first KDC which successfully
responds but we did not do that yet.

Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
lib/krb5/send_to_kdc.c