* fhandler_socket.cc (fhandler_socket::af_local_connect): Drop
setting connect_state to connect_credxchg. (fhandler_socket::af_local_accept): Ditto. (fhandler_socket::recv_internal): Drop ill-advised connect_state check. Add comment so as not to repeat the exercise. * fhandler.h (enum conn_state): Drop now unneeded connect_credxchg state.
This commit is contained in:
parent
1fc5d69923
commit
b701da7f14
@ -1,3 +1,13 @@
|
|||||||
|
2014-10-26 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* fhandler_socket.cc (fhandler_socket::af_local_connect): Drop
|
||||||
|
setting connect_state to connect_credxchg.
|
||||||
|
(fhandler_socket::af_local_accept): Ditto.
|
||||||
|
(fhandler_socket::recv_internal): Drop ill-advised connect_state check.
|
||||||
|
Add comment so as not to repeat the exercise.
|
||||||
|
* fhandler.h (enum conn_state): Drop now unneeded connect_credxchg
|
||||||
|
state.
|
||||||
|
|
||||||
2014-10-24 Corinna Vinschen <corinna@vinschen.de>
|
2014-10-24 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* fhandler_proc.cc (format_proc_cygdrive): Fix symlink path if cygdrive
|
* fhandler_proc.cc (format_proc_cygdrive): Fix symlink path if cygdrive
|
||||||
|
@ -75,11 +75,10 @@ enum dirent_states
|
|||||||
enum conn_state
|
enum conn_state
|
||||||
{
|
{
|
||||||
unconnected = 0,
|
unconnected = 0,
|
||||||
connect_credxchg = 1,
|
connect_pending = 1,
|
||||||
connect_pending = 2,
|
connected = 2,
|
||||||
connected = 3,
|
listener = 3,
|
||||||
listener = 4,
|
connect_failed = 4
|
||||||
connect_failed = 5
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum line_edit_status
|
enum line_edit_status
|
||||||
|
@ -405,7 +405,6 @@ fhandler_socket::af_local_connect ()
|
|||||||
if (no_getpeereid ())
|
if (no_getpeereid ())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
connect_state (connect_credxchg);
|
|
||||||
af_local_setblocking (orig_async_io, orig_is_nonblocking);
|
af_local_setblocking (orig_async_io, orig_is_nonblocking);
|
||||||
if (!af_local_send_secret () || !af_local_recv_secret ()
|
if (!af_local_send_secret () || !af_local_recv_secret ()
|
||||||
|| !af_local_send_cred () || !af_local_recv_cred ())
|
|| !af_local_send_cred () || !af_local_recv_cred ())
|
||||||
@ -428,7 +427,6 @@ fhandler_socket::af_local_accept ()
|
|||||||
if (no_getpeereid ())
|
if (no_getpeereid ())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
connect_state (connect_credxchg);
|
|
||||||
af_local_setblocking (orig_async_io, orig_is_nonblocking);
|
af_local_setblocking (orig_async_io, orig_is_nonblocking);
|
||||||
if (!af_local_recv_secret () || !af_local_send_secret ()
|
if (!af_local_recv_secret () || !af_local_send_secret ()
|
||||||
|| !af_local_recv_cred () || !af_local_send_cred ())
|
|| !af_local_recv_cred () || !af_local_send_cred ())
|
||||||
@ -1465,20 +1463,12 @@ fhandler_socket::recv_internal (LPWSAMSG wsamsg, bool use_recvmsg)
|
|||||||
static NO_COPY LPFN_WSARECVMSG WSARecvMsg;
|
static NO_COPY LPFN_WSARECVMSG WSARecvMsg;
|
||||||
int orig_namelen = wsamsg->namelen;
|
int orig_namelen = wsamsg->namelen;
|
||||||
|
|
||||||
/* Windows event handling does not check for the validity of the desired
|
/* CV 2014-10-26: Do not check for the connect_state at this point. In
|
||||||
flags so we have to do it here.
|
certain scenarios there's no way to check the connect state reliably.
|
||||||
The check goes like this:
|
Example (hexchat): Parent process creates socket, forks, child process
|
||||||
STREAM sockets must be either connected, or they are AF_LOCAL
|
calls connect, parent process calls read. Even if the event handling
|
||||||
sockets in the pre-connected credential exchange phase.
|
allows to check for FD_CONNECT in the parent, there is always yet another
|
||||||
All other states are disallowed. */
|
scenario we can easily break. */
|
||||||
if (get_socket_type () == SOCK_STREAM && connect_state () != connected
|
|
||||||
&& (get_addr_family () != AF_LOCAL
|
|
||||||
|| connect_state () != connect_credxchg))
|
|
||||||
{
|
|
||||||
WSASetLastError (WSAENOTCONN);
|
|
||||||
set_winsock_errno ();
|
|
||||||
return SOCKET_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
DWORD wait_flags = wsamsg->dwFlags;
|
DWORD wait_flags = wsamsg->dwFlags;
|
||||||
bool waitall = !!(wait_flags & MSG_WAITALL);
|
bool waitall = !!(wait_flags & MSG_WAITALL);
|
||||||
|
@ -68,8 +68,7 @@ Bug Fixes
|
|||||||
Addresses: https://cygwin.com/ml/cygwin-developers/2014-10/msg00010.html
|
Addresses: https://cygwin.com/ml/cygwin-developers/2014-10/msg00010.html
|
||||||
|
|
||||||
- Don't hang in accept calls if socket is no listener. Set errno to EINVAL
|
- Don't hang in accept calls if socket is no listener. Set errno to EINVAL
|
||||||
instead. Don't hang in read/recv/recvfrom/recvmsg calls if socket is
|
instead.
|
||||||
connection oriented and not connected. Set errno to ENOTCONN instead.
|
|
||||||
|
|
||||||
- Don't allow seeking on serial lines and sockets. Set errno to ESPIPE
|
- Don't allow seeking on serial lines and sockets. Set errno to ESPIPE
|
||||||
instead.
|
instead.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user