mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-03-01 12:35:44 +08:00
* fhandler_socket.cc (fhandler_socket::eid_pipe_name): Fix format
string. (fhandler_socket::connect): Set sun_path before running eid credential transaction. Run transaction only if OS connect was successful. (fhandler_socket::accept): Run transaction only if OS accept was successful.
This commit is contained in:
parent
8b7de010ab
commit
7d243cd43b
@ -1,4 +1,13 @@
|
||||
2005-03-08 Corinna Vinschen <corinna@vinschen.de>
|
||||
2005-03-09 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* fhandler_socket.cc (fhandler_socket::eid_pipe_name): Fix format
|
||||
string.
|
||||
(fhandler_socket::connect): Set sun_path before running eid credential
|
||||
transaction. Run transaction only if OS connect was successful.
|
||||
(fhandler_socket::accept): Run transaction only if OS accept was
|
||||
successful.
|
||||
|
||||
2005-03-09 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* signal.cc (sigprocmask): Rename first parameter to "how".
|
||||
(handle_sigprocmask): Ditto. Check "how" for being a valid "how" value.
|
||||
|
@ -56,7 +56,8 @@ secret_event_name (char *buf, short port, int *secret_ptr)
|
||||
char *
|
||||
fhandler_socket::eid_pipe_name (char *buf)
|
||||
{
|
||||
__small_sprintf (buf, "\\\\.\\pipe\\cygwin-unix-$s", get_sun_path ());
|
||||
__small_sprintf (buf, "\\\\.\\pipe\\cygwin-unix-%s", get_sun_path ());
|
||||
debug_printf ("%s", buf);
|
||||
return buf;
|
||||
}
|
||||
|
||||
@ -666,7 +667,10 @@ fhandler_socket::connect (const struct sockaddr *name, int namelen)
|
||||
res = -1;
|
||||
}
|
||||
|
||||
if (!res || in_progress)
|
||||
{
|
||||
/* eid credential transaction. */
|
||||
set_sun_path (name->sa_data);
|
||||
if (wincap.has_named_pipes ())
|
||||
{
|
||||
struct ucred in = { getpid (), geteuid32 (), getegid32 () };
|
||||
@ -675,8 +679,8 @@ fhandler_socket::connect (const struct sockaddr *name, int namelen)
|
||||
if (CallNamedPipe(eid_pipe_name ((char *) alloca (CYG_MAX_PATH + 1)),
|
||||
&in, sizeof in, &out, sizeof out, &bytes, 1000))
|
||||
{
|
||||
debug_printf ("Received eid credentials: pid: %d, uid: %d, gid: %d",
|
||||
out.pid, out.uid, out.gid);
|
||||
debug_printf ("Received eid credentials: pid: %d, uid: %d"
|
||||
", gid: %d", out.pid, out.uid, out.gid);
|
||||
sec_peer_pid = out.pid;
|
||||
sec_peer_uid = out.uid;
|
||||
sec_peer_gid = out.gid;
|
||||
@ -692,6 +696,7 @@ fhandler_socket::connect (const struct sockaddr *name, int namelen)
|
||||
sec_peer_gid = getegid32 ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
err = WSAGetLastError ();
|
||||
if (err == WSAEINPROGRESS || err == WSAEALREADY)
|
||||
@ -796,6 +801,8 @@ fhandler_socket::accept (struct sockaddr *peer, int *len)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((SOCKET) res != INVALID_SOCKET || in_progress)
|
||||
{
|
||||
/* eid credential transaction. */
|
||||
if (wincap.has_named_pipes ())
|
||||
{
|
||||
@ -806,8 +813,8 @@ fhandler_socket::accept (struct sockaddr *peer, int *len)
|
||||
if (!ReadFile (sec_pipe, &out, sizeof out, &bytes, NULL))
|
||||
debug_printf ("Receiving eid credentials failed: %E");
|
||||
else
|
||||
debug_printf ("Received eid credentials: pid: %d, uid: %d, gid: %d",
|
||||
out.pid, out.uid, out.gid);
|
||||
debug_printf ("Received eid credentials: pid: %d, uid: %d"
|
||||
", gid: %d", out.pid, out.uid, out.gid);
|
||||
if (!WriteFile (sec_pipe, &in, sizeof in, &bytes, NULL))
|
||||
debug_printf ("Sending eid credentials failed: %E");
|
||||
DisconnectNamedPipe (sec_pipe);
|
||||
@ -823,6 +830,7 @@ fhandler_socket::accept (struct sockaddr *peer, int *len)
|
||||
out.gid = sec_gid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((SOCKET) res == INVALID_SOCKET)
|
||||
set_winsock_errno ();
|
||||
|
Loading…
x
Reference in New Issue
Block a user