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, ...)


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
socket.

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?


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: pgpOKQH4a6jJM.pgp
Description: PGP signature


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