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

Corinna Vinschen corinna-cygwin@cygwin.com
Fri Oct 10 11:07:00 GMT 2014

On Oct  9 20:21, Christian Franke wrote:
> Corinna Vinschen wrote:
> >>+int
> >>+fhandler_socket::af_local_set_no_getpeereid ()
> >>+{
> >>+  if (get_addr_family () != AF_LOCAL || get_socket_type () != SOCK_STREAM)
> >>+    {
> >>+      set_errno (EINVAL);
> >>+      return -1;
> >>+    }
> >>+  if (connect_state () != unconnected)
> >          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'
> >
> >Wouldn't it make sense to allow this call in the "listener" state as well?
> It should work, but I don't see any real world use case.

Indeed.  Another question, though.

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

This puzzles me.  A completed connection attempt should set the
write_selected flag (see function peek_socket).  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?


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20141010/d3a44c40/attachment.sig>

More information about the Cygwin-patches mailing list