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
dec7effa
Commit
dec7effa
authored
Sep 30, 2010
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Add support for retrieving the server pid from the socket credentials.
parent
17971525
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
server.c
dlls/ntdll/server.c
+20
-0
No files found.
dlls/ntdll/server.c
View file @
dec7effa
...
...
@@ -103,6 +103,7 @@ timeout_t server_start_time = 0; /* time of server startup */
sigset_t
server_block_set
;
/* signals to block during server calls */
static
int
fd_socket
=
-
1
;
/* socket to exchange file descriptors with the server */
static
pid_t
server_pid
;
static
RTL_CRITICAL_SECTION
fd_cache_section
;
static
RTL_CRITICAL_SECTION_DEBUG
critsect_debug
=
...
...
@@ -402,6 +403,13 @@ static int receive_fd( obj_handle_t *handle )
{
if
(
cmsg
->
cmsg_level
!=
SOL_SOCKET
)
continue
;
if
(
cmsg
->
cmsg_type
==
SCM_RIGHTS
)
fd
=
*
(
int
*
)
CMSG_DATA
(
cmsg
);
#ifdef SCM_CREDENTIALS
else
if
(
cmsg
->
cmsg_type
==
SCM_CREDENTIALS
)
{
struct
ucred
*
ucred
=
(
struct
ucred
*
)
CMSG_DATA
(
cmsg
);
server_pid
=
ucred
->
pid
;
}
#endif
}
#endif
/* HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS */
if
(
fd
!=
-
1
)
fcntl
(
fd
,
F_SETFD
,
FD_CLOEXEC
);
/* in case MSG_CMSG_CLOEXEC is not supported */
...
...
@@ -960,6 +968,7 @@ void server_init_process(void)
obj_handle_t
version
;
const
char
*
env_socket
=
getenv
(
"WINESERVERSOCKET"
);
server_pid
=
-
1
;
if
(
env_socket
)
{
fd_socket
=
atoi
(
env_socket
);
...
...
@@ -981,6 +990,17 @@ void server_init_process(void)
pthread_sigmask
(
SIG_BLOCK
,
&
server_block_set
,
NULL
);
/* receive the first thread request fd on the main socket */
#ifdef SO_PASSCRED
if
(
server_pid
==
-
1
)
{
int
enable
=
1
;
setsockopt
(
fd_socket
,
SOL_SOCKET
,
SO_PASSCRED
,
&
enable
,
sizeof
(
enable
)
);
ntdll_get_thread_data
()
->
request_fd
=
receive_fd
(
&
version
);
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
)
...
...
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