[PATCH] Disable AF_UNIX handshake with setsockopt(..., SO_PEERCRED, ...)
Christian Franke
Christian.Franke@t-online.de
Fri Oct 10 16:36:00 GMT 2014
Corinna Vinschen wrote:
> I was just looking into applying your patch when I got thinking over the
> change in select.cc once more. You're setting the connect_state from
> connect_pending to connected there when there's something to read on the
> socket.
>
> This puzzles me. A completed connection attempt should set the
> write_selected flag (see function peek_socket).
No, peek_socket() does not change write_selected. It sets write_read if
write_selected is set.
> The AF_LOCAL handling
> in the
>
> if (me->write_selected && me->write_ready)
>
> case in set_bits should cover this. What situation is your special case
> covering which is not already covered by the write_selected case?
If only read status is requested via select()/poll(), write_selected is
always false and the connect_pending=>connected transition is never done.
After a nonblocking connect(), postfix calls poll() with pollfd.events =
POLLIN only. If poll() succeeds, it calls recv(). This fails with
ENOTCONN because the state is still connect_pending.
Christian
More information about the Cygwin-patches
mailing list