Commit af2c6866 authored by Brendan Shanks's avatar Brendan Shanks Committed by Alexandre Julliard

ntdll: Remove support for msg_accrights FD passing.

parent f2e6fc69
......@@ -872,29 +872,17 @@ void wine_server_send_fd( int fd )
struct send_fd data;
struct msghdr msghdr;
struct iovec vec;
int ret;
#ifdef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
msghdr.msg_accrights = (void *)&fd;
msghdr.msg_accrightslen = sizeof(fd);
#else /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */
char cmsg_buffer[256];
struct cmsghdr *cmsg;
msghdr.msg_control = cmsg_buffer;
msghdr.msg_controllen = sizeof(cmsg_buffer);
msghdr.msg_flags = 0;
cmsg = CMSG_FIRSTHDR( &msghdr );
cmsg->cmsg_len = CMSG_LEN( sizeof(fd) );
cmsg->cmsg_level = SOL_SOCKET;
cmsg->cmsg_type = SCM_RIGHTS;
*(int *)CMSG_DATA(cmsg) = fd;
msghdr.msg_controllen = cmsg->cmsg_len;
#endif /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */
int ret;
msghdr.msg_name = NULL;
msghdr.msg_namelen = 0;
msghdr.msg_iov = &vec;
msghdr.msg_iovlen = 1;
msghdr.msg_control = cmsg_buffer;
msghdr.msg_controllen = sizeof(cmsg_buffer);
msghdr.msg_flags = 0;
vec.iov_base = (void *)&data;
vec.iov_len = sizeof(data);
......@@ -902,6 +890,13 @@ void wine_server_send_fd( int fd )
data.tid = GetCurrentThreadId();
data.fd = fd;
cmsg = CMSG_FIRSTHDR( &msghdr );
cmsg->cmsg_len = CMSG_LEN( sizeof(fd) );
cmsg->cmsg_level = SOL_SOCKET;
cmsg->cmsg_type = SCM_RIGHTS;
*(int *)CMSG_DATA(cmsg) = fd;
msghdr.msg_controllen = cmsg->cmsg_len;
for (;;)
{
if ((ret = sendmsg( fd_socket, &msghdr, 0 )) == sizeof(data)) return;
......@@ -922,22 +917,17 @@ static int receive_fd( obj_handle_t *handle )
{
struct iovec vec;
struct msghdr msghdr;
int ret, fd = -1;
#ifdef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
msghdr.msg_accrights = (void *)&fd;
msghdr.msg_accrightslen = sizeof(fd);
#else /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */
char cmsg_buffer[256];
msghdr.msg_control = cmsg_buffer;
msghdr.msg_controllen = sizeof(cmsg_buffer);
msghdr.msg_flags = 0;
#endif /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */
int ret, fd = -1;
msghdr.msg_name = NULL;
msghdr.msg_namelen = 0;
msghdr.msg_iov = &vec;
msghdr.msg_iovlen = 1;
msghdr.msg_control = cmsg_buffer;
msghdr.msg_controllen = sizeof(cmsg_buffer);
msghdr.msg_flags = 0;
vec.iov_base = (void *)handle;
vec.iov_len = sizeof(*handle);
......@@ -945,7 +935,6 @@ static int receive_fd( obj_handle_t *handle )
{
if ((ret = recvmsg( fd_socket, &msghdr, MSG_CMSG_CLOEXEC )) > 0)
{
#ifndef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
struct cmsghdr *cmsg;
for (cmsg = CMSG_FIRSTHDR( &msghdr ); cmsg; cmsg = CMSG_NXTHDR( &msghdr, cmsg ))
{
......@@ -959,7 +948,6 @@ static int receive_fd( obj_handle_t *handle )
}
#endif
}
#endif /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */
if (fd != -1) fcntl( fd, F_SETFD, FD_CLOEXEC ); /* in case MSG_CMSG_CLOEXEC is not supported */
return fd;
}
......
......@@ -371,7 +371,6 @@ static int sockaddr_from_unix( const union unix_sockaddr *uaddr, struct WS_socka
}
}
#ifndef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
static WSACMSGHDR *fill_control_message( int level, int type, WSACMSGHDR *current, ULONG *maxsize, void *data, int len )
{
ULONG msgsize = sizeof(WSACMSGHDR) + WSA_CMSG_ALIGN(len);
......@@ -513,14 +512,6 @@ error:
control->len = 0;
return 0;
}
#else
static int convert_control_headers(struct msghdr *hdr, WSABUF *control)
{
ERR( "Message control headers cannot be properly supported on this system.\n" );
control->len = 0;
return 0;
}
#endif /* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */
struct cmsghdr_32
{
......@@ -721,9 +712,7 @@ static ssize_t fixup_icmp_over_dgram( struct msghdr *hdr, union unix_sockaddr *u
static NTSTATUS try_recv( int fd, struct async_recv_ioctl *async, ULONG_PTR *size )
{
#ifndef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
char control_buffer[512];
#endif
union unix_sockaddr unix_addr;
struct msghdr hdr;
NTSTATUS status;
......@@ -737,10 +726,9 @@ static NTSTATUS try_recv( int fd, struct async_recv_ioctl *async, ULONG_PTR *siz
}
hdr.msg_iov = async->iov;
hdr.msg_iovlen = async->count;
#ifndef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
hdr.msg_control = control_buffer;
hdr.msg_controllen = sizeof(control_buffer);
#endif
while ((ret = virtual_locked_recvmsg( fd, &hdr, async->unix_flags )) < 0 && errno == EINTR);
if (ret < 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment