Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
7457f37e
Commit
7457f37e
authored
Oct 16, 2012
by
Maarten Lankhorst
Committed by
Alexandre Julliard
Oct 18, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Set SO_PASSCRED before connecting to eliminate a race condition in obtaining server_pid.
parent
679385fd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
7 deletions
+18
-7
process.c
dlls/kernel32/process.c
+7
-0
server.c
dlls/ntdll/server.c
+11
-7
No files found.
dlls/kernel32/process.c
View file @
7457f37e
...
...
@@ -1919,6 +1919,13 @@ static BOOL create_process( HANDLE hFile, LPCWSTR filename, LPWSTR cmd_line, LPW
SetLastError
(
ERROR_TOO_MANY_OPEN_FILES
);
return
FALSE
;
}
#ifdef SO_PASSCRED
else
{
int
enable
=
1
;
setsockopt
(
socketfd
[
0
],
SOL_SOCKET
,
SO_PASSCRED
,
&
enable
,
sizeof
(
enable
)
);
}
#endif
if
(
exec_only
)
/* things are much simpler in this case */
{
...
...
dlls/ntdll/server.c
View file @
7457f37e
...
...
@@ -881,6 +881,13 @@ static int server_connect(void)
addr
.
sun_len
=
slen
;
#endif
if
((
s
=
socket
(
AF_UNIX
,
SOCK_STREAM
,
0
))
==
-
1
)
fatal_perror
(
"socket"
);
#ifdef SO_PASSCRED
else
{
int
enable
=
1
;
setsockopt
(
s
,
SOL_SOCKET
,
SO_PASSCRED
,
&
enable
,
sizeof
(
enable
)
);
}
#endif
if
(
connect
(
s
,
(
struct
sockaddr
*
)
&
addr
,
slen
)
!=
-
1
)
{
/* switch back to the starting directory */
...
...
@@ -1004,18 +1011,15 @@ void server_init_process(void)
pthread_sigmask
(
SIG_BLOCK
,
&
server_block_set
,
NULL
);
/* receive the first thread request fd on the main socket */
ntdll_get_thread_data
()
->
request_fd
=
receive_fd
(
&
version
);
#ifdef SO_PASSCRED
if
(
server_pid
==
-
1
)
/* now that we hopefully received the server_pid, disable SO_PASSCRED */
{
int
enable
=
1
;
setsockopt
(
fd_socket
,
SOL_SOCKET
,
SO_PASSCRED
,
&
enable
,
sizeof
(
enable
)
);
ntdll_get_thread_data
()
->
request_fd
=
receive_fd
(
&
version
);
enable
=
0
;
int
enable
=
0
;
setsockopt
(
fd_socket
,
SOL_SOCKET
,
SO_PASSCRED
,
&
enable
,
sizeof
(
enable
)
);
}
else
#endif
ntdll_get_thread_data
()
->
request_fd
=
receive_fd
(
&
version
);
if
(
version
!=
SERVER_PROTOCOL_VERSION
)
server_protocol_error
(
"version mismatch %d/%d.
\n
"
...
...
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