Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
af2c6866
Commit
af2c6866
authored
Mar 08, 2024
by
Brendan Shanks
Committed by
Alexandre Julliard
Mar 11, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Remove support for msg_accrights FD passing.
parent
f2e6fc69
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
41 deletions
+17
-41
server.c
dlls/ntdll/unix/server.c
+16
-28
socket.c
dlls/ntdll/unix/socket.c
+1
-13
No files found.
dlls/ntdll/unix/server.c
View file @
af2c6866
...
...
@@ -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
;
}
...
...
dlls/ntdll/unix/socket.c
View file @
af2c6866
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment