This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Disable AF_UNIX handshake with setsockopt(..., SO_PEERCRED, ...)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]