How about this patch?  Did anyone ever look at it?

Corinna?  Egor?

cgf

On Mon, Jul 29, 2002 at 06:47:29PM +0100, Conrad Scott wrote:
>And one more time with the patch attached as text rather than
>binary.
>
>This thread really should teach me something, I just wish I knew
>what :-(
>
>// Conrad
>

>2002-07-27  Conrad Scott  <[EMAIL PROTECTED]>
>
>       * fhandler.h
>       (fhandler_socket::connect_secret_initialized): New field.
>       (fhandler_socket::peer_sun_path): Ditto.
>       (fhandler_socket::set_peer_sun_path): New method.
>       (fhandler_socket::get_peer_sun_path): Ditto.
>       (fhandler_socket::set_connect_secret): Change return type to bool.
>       (fhandler_socket::get_connect_secret): Ditto.
>       (fhandler_socket::create_connect_secret): Ditto.
>       (fhandler_socket::check_peer_secret_event): Ditto.
>       (fhandler_socket::signal_secret_event): Remove method.
>       * fhandler_socket.cc (ENTROPY_SOURCE_NAME): Remove #define.
>       (get_inet_addr): Check that the UNIX domain sun_path refers to a
>       socket file.  Add the SOCKET_COOKIE string to the sscanf(3)
>       format.  Check the return value from sscanf(3) and set errno as
>       appropriate.  Add save_errno objects as appropriate.
>       (fhandler_socket::fhandler_socket): Initialize every field.
>       (fhandler_socket::~fhandler_socket): Call close_secret_event().
>       Free peer_sun_path if required.
>       (fhandler_socket::set_connect_secret): Change return type to bool.
>       Add asserts.  Use explicit destructor and free(3) rather than
>       delete.  Add tracing messages.  Set connect_secret_initialized as
>       appropriate.  Return true if the connect_secret has been
>       initialized.
>       (fhandler_socket::get_connect_secret): Add asserts.
>       (fhandler_socket::create_secret_event): Change return type to
>       bool.  Add asserts.  Add AF_LOCAL marker to tracing statements.
>       Change all tracing failure statements to syscall level.  Set errno
>       as appropriate.  Change the secret_event to be a semaphore.
>       (fhandler_socket::signal_secret_event): Remove method.
>       (fhandler_socket::close_secret_event): Wait for the secret event
>       (or an error) to be signalled before closing the event.
>       (fhandler_socket::check_peer_secret_event): Change return type to
>       bool.  Add asserts.  Add AF_LOCAL marker to tracing statements.
>       Set errno as appropriate.  Change all tracing failure statements
>       to syscall level.  Change to support new UNIX domain emulation
>       protocol.
>       (fhandler_socket::fixup_after_fork): Remove ineffective call to
>       fork_fixup.  Signal the secret_event to keep handle count and
>       signal count in sync.
>       (fhandler_socket::dup): Duplicate every field.  In particular,
>       explicitly duplicate the secret event handle and protect it.
>       (fhandler_socket::bind): Check that the requested address family
>       matches the socket's address family.  Change tracing messages to
>       use WSAGetLastError rather than errno.  For UNIX domain sockets,
>       create the secret event before creating the file system socket,
>       then immediately signal that event.
>       (fhandler_socket::connect): Remove the secret_check_failed and
>       in_progress flags.  Check that the requested address family
>       matches the socket's address family.  For the first connect on a
>       UNIX domain socket, check the that the server's secret event
>       exists; then bind the local socket and create its own secret
>       event.  Also set the peer sun path here.  Remove the old secret
>       event code.  Rewrite code that generates the errno for
>       non-blocking sockets to match SUSv3.  Change the code that sets
>       had_connect_or_listen likewise.
>       (fhandler_socket::accept): Remove the secret_check_failed and
>       in_progress flags.  Remove the old secret event code.  Check peer
>       secret event and do a hard reset on the accepted socket if it
>       fails.  Duplicate the peer sun path and the had_connect_or_listen
>       flag into the accepted fhandler.
>       (fhandler_socket::getsockname): Call ::getsockname() even for UNIX
>       domain sockets as an error check.
>       (fhandler_socket::getpeername): Add special case for UNIX domain
>       sockets as per the getsockname method.
>       (fhandler_socket::close): Close the secret event before, rather
>       than after, closing the underlying socket and return error status
>       as appropriate.
>       (fhandler_socket::set_sun_path): Add assert.  Free the previous
>       sun path as appropriate.
>       (fhandler_socket::set_peer_sun_path): New method.
>       * net.cc (cygwin_socket): Check for supported protocol families.

Reply via email to