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
6f7b56a1
Commit
6f7b56a1
authored
Feb 17, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Merge the various token information queries.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3c677c3f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
150 deletions
+41
-150
security.c
dlls/ntdll/unix/security.c
+10
-7
server_protocol.h
include/wine/server_protocol.h
+8
-39
protocol.def
server/protocol.def
+2
-16
request.h
server/request.h
+12
-23
token.c
server/token.c
+3
-34
trace.c
server/trace.c
+6
-31
No files found.
dlls/ntdll/unix/security.c
View file @
6f7b56a1
...
...
@@ -317,18 +317,21 @@ NTSTATUS WINAPI NtQueryInformationToken( HANDLE token, TOKEN_INFORMATION_CLASS c
break
;
case
TokenImpersonationLevel
:
SERVER_START_REQ
(
get_token_i
mpersonation_level
)
SERVER_START_REQ
(
get_token_i
nfo
)
{
SECURITY_IMPERSONATION_LEVEL
*
level
=
info
;
req
->
handle
=
wine_server_obj_handle
(
token
);
status
=
wine_server_call
(
req
);
if
(
status
==
STATUS_SUCCESS
)
*
level
=
reply
->
impersonation_level
;
if
(
!
(
status
=
wine_server_call
(
req
)))
{
if
(
!
reply
->
primary
)
*
level
=
reply
->
impersonation_level
;
else
status
=
STATUS_INVALID_PARAMETER
;
}
}
SERVER_END_REQ
;
break
;
case
TokenStatistics
:
SERVER_START_REQ
(
get_token_
statistics
)
SERVER_START_REQ
(
get_token_
info
)
{
TOKEN_STATISTICS
*
statistics
=
info
;
req
->
handle
=
wine_server_obj_handle
(
token
);
...
...
@@ -358,7 +361,7 @@ NTSTATUS WINAPI NtQueryInformationToken( HANDLE token, TOKEN_INFORMATION_CLASS c
break
;
case
TokenType
:
SERVER_START_REQ
(
get_token_
statistics
)
SERVER_START_REQ
(
get_token_
info
)
{
TOKEN_TYPE
*
type
=
info
;
req
->
handle
=
wine_server_obj_handle
(
token
);
...
...
@@ -391,7 +394,7 @@ NTSTATUS WINAPI NtQueryInformationToken( HANDLE token, TOKEN_INFORMATION_CLASS c
break
;
case
TokenElevationType
:
SERVER_START_REQ
(
get_token_
elevation
)
SERVER_START_REQ
(
get_token_
info
)
{
TOKEN_ELEVATION_TYPE
*
type
=
info
;
...
...
@@ -403,7 +406,7 @@ NTSTATUS WINAPI NtQueryInformationToken( HANDLE token, TOKEN_INFORMATION_CLASS c
break
;
case
TokenElevation
:
SERVER_START_REQ
(
get_token_
elevation
)
SERVER_START_REQ
(
get_token_
info
)
{
TOKEN_ELEVATION
*
elevation
=
info
;
...
...
include/wine/server_protocol.h
View file @
6f7b56a1
...
...
@@ -4738,19 +4738,6 @@ struct get_object_types_reply
struct
get_token_impersonation_level_request
{
struct
request_header
__header
;
obj_handle_t
handle
;
};
struct
get_token_impersonation_level_reply
{
struct
reply_header
__header
;
int
impersonation_level
;
char
__pad_12
[
4
];
};
struct
allocate_locally_unique_id_request
{
struct
request_header
__header
;
...
...
@@ -4918,34 +4905,22 @@ struct make_process_system_reply
struct
get_token_
statistics
_request
struct
get_token_
info
_request
{
struct
request_header
__header
;
obj_handle_t
handle
;
};
struct
get_token_
statistics
_reply
struct
get_token_
info
_reply
{
struct
reply_header
__header
;
luid_t
token_id
;
luid_t
modified_id
;
int
primary
;
int
impersonation_level
;
int
elevation
;
int
group_count
;
int
privilege_count
;
};
struct
get_token_elevation_request
{
struct
request_header
__header
;
obj_handle_t
handle
;
};
struct
get_token_elevation_reply
{
struct
reply_header
__header
;
int
elevation
;
char
__pad_12
[
4
];
char
__pad_44
[
4
];
};
...
...
@@ -5642,7 +5617,6 @@ enum request
REQ_get_object_info
,
REQ_get_object_type
,
REQ_get_object_types
,
REQ_get_token_impersonation_level
,
REQ_allocate_locally_unique_id
,
REQ_create_device_manager
,
REQ_create_device
,
...
...
@@ -5654,8 +5628,7 @@ enum request
REQ_release_kernel_object
,
REQ_get_kernel_object_handle
,
REQ_make_process_system
,
REQ_get_token_statistics
,
REQ_get_token_elevation
,
REQ_get_token_info
,
REQ_create_linked_token
,
REQ_create_completion
,
REQ_open_completion
,
...
...
@@ -5925,7 +5898,6 @@ union generic_request
struct
get_object_info_request
get_object_info_request
;
struct
get_object_type_request
get_object_type_request
;
struct
get_object_types_request
get_object_types_request
;
struct
get_token_impersonation_level_request
get_token_impersonation_level_request
;
struct
allocate_locally_unique_id_request
allocate_locally_unique_id_request
;
struct
create_device_manager_request
create_device_manager_request
;
struct
create_device_request
create_device_request
;
...
...
@@ -5937,8 +5909,7 @@ union generic_request
struct
release_kernel_object_request
release_kernel_object_request
;
struct
get_kernel_object_handle_request
get_kernel_object_handle_request
;
struct
make_process_system_request
make_process_system_request
;
struct
get_token_statistics_request
get_token_statistics_request
;
struct
get_token_elevation_request
get_token_elevation_request
;
struct
get_token_info_request
get_token_info_request
;
struct
create_linked_token_request
create_linked_token_request
;
struct
create_completion_request
create_completion_request
;
struct
open_completion_request
open_completion_request
;
...
...
@@ -6206,7 +6177,6 @@ union generic_reply
struct
get_object_info_reply
get_object_info_reply
;
struct
get_object_type_reply
get_object_type_reply
;
struct
get_object_types_reply
get_object_types_reply
;
struct
get_token_impersonation_level_reply
get_token_impersonation_level_reply
;
struct
allocate_locally_unique_id_reply
allocate_locally_unique_id_reply
;
struct
create_device_manager_reply
create_device_manager_reply
;
struct
create_device_reply
create_device_reply
;
...
...
@@ -6218,8 +6188,7 @@ union generic_reply
struct
release_kernel_object_reply
release_kernel_object_reply
;
struct
get_kernel_object_handle_reply
get_kernel_object_handle_reply
;
struct
make_process_system_reply
make_process_system_reply
;
struct
get_token_statistics_reply
get_token_statistics_reply
;
struct
get_token_elevation_reply
get_token_elevation_reply
;
struct
get_token_info_reply
get_token_info_reply
;
struct
create_linked_token_reply
create_linked_token_reply
;
struct
create_completion_reply
create_completion_reply
;
struct
open_completion_reply
open_completion_reply
;
...
...
@@ -6254,7 +6223,7 @@ union generic_reply
/* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 68
0
#define SERVER_PROTOCOL_VERSION 68
1
/* ### protocol_version end ### */
...
...
server/protocol.def
View file @
6f7b56a1
...
...
@@ -3317,13 +3317,6 @@ struct handle_info
@END
/* Query the impersonation level of an impersonation token */
@REQ(get_token_impersonation_level)
obj_handle_t handle; /* handle to the object */
@REPLY
int impersonation_level; /* impersonation level of the impersonation token */
@END
/* Allocate a locally-unique identifier */
@REQ(allocate_locally_unique_id)
@REPLY
...
...
@@ -3421,26 +3414,19 @@ struct handle_info
/* Get detailed fixed-size information about a token */
@REQ(get_token_
statistics
)
@REQ(get_token_
info
)
obj_handle_t handle; /* handle to the object */
@REPLY
luid_t token_id; /* locally-unique identifier of the token */
luid_t modified_id; /* locally-unique identifier of the modified version of the token */
int primary; /* is the token primary or impersonation? */
int impersonation_level; /* level of impersonation */
int elevation; /* elevation type */
int group_count; /* the number of groups the token is a member of */
int privilege_count; /* the number of privileges the token has */
@END
/* Get the token elevation type */
@REQ(get_token_elevation)
obj_handle_t handle; /* handle to the token */
@REPLY
int elevation; /* token elevation type */
@END
/* Create a token which is an elevation counterpart to this token */
@REQ(create_linked_token)
obj_handle_t handle; /* handle to the token */
...
...
server/request.h
View file @
6f7b56a1
...
...
@@ -351,7 +351,6 @@ DECL_HANDLER(query_symlink);
DECL_HANDLER
(
get_object_info
);
DECL_HANDLER
(
get_object_type
);
DECL_HANDLER
(
get_object_types
);
DECL_HANDLER
(
get_token_impersonation_level
);
DECL_HANDLER
(
allocate_locally_unique_id
);
DECL_HANDLER
(
create_device_manager
);
DECL_HANDLER
(
create_device
);
...
...
@@ -363,8 +362,7 @@ DECL_HANDLER(grab_kernel_object);
DECL_HANDLER
(
release_kernel_object
);
DECL_HANDLER
(
get_kernel_object_handle
);
DECL_HANDLER
(
make_process_system
);
DECL_HANDLER
(
get_token_statistics
);
DECL_HANDLER
(
get_token_elevation
);
DECL_HANDLER
(
get_token_info
);
DECL_HANDLER
(
create_linked_token
);
DECL_HANDLER
(
create_completion
);
DECL_HANDLER
(
open_completion
);
...
...
@@ -633,7 +631,6 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
(
req_handler
)
req_get_object_info
,
(
req_handler
)
req_get_object_type
,
(
req_handler
)
req_get_object_types
,
(
req_handler
)
req_get_token_impersonation_level
,
(
req_handler
)
req_allocate_locally_unique_id
,
(
req_handler
)
req_create_device_manager
,
(
req_handler
)
req_create_device
,
...
...
@@ -645,8 +642,7 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
(
req_handler
)
req_release_kernel_object
,
(
req_handler
)
req_get_kernel_object_handle
,
(
req_handler
)
req_make_process_system
,
(
req_handler
)
req_get_token_statistics
,
(
req_handler
)
req_get_token_elevation
,
(
req_handler
)
req_get_token_info
,
(
req_handler
)
req_create_linked_token
,
(
req_handler
)
req_create_completion
,
(
req_handler
)
req_open_completion
,
...
...
@@ -2046,10 +2042,6 @@ C_ASSERT( sizeof(struct get_object_type_reply) == 8 );
C_ASSERT
(
sizeof
(
struct
get_object_types_request
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_object_types_reply
,
count
)
==
8
);
C_ASSERT
(
sizeof
(
struct
get_object_types_reply
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_token_impersonation_level_request
,
handle
)
==
12
);
C_ASSERT
(
sizeof
(
struct
get_token_impersonation_level_request
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_token_impersonation_level_reply
,
impersonation_level
)
==
8
);
C_ASSERT
(
sizeof
(
struct
get_token_impersonation_level_reply
)
==
16
);
C_ASSERT
(
sizeof
(
struct
allocate_locally_unique_id_request
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
allocate_locally_unique_id_reply
,
luid
)
==
8
);
C_ASSERT
(
sizeof
(
struct
allocate_locally_unique_id_reply
)
==
16
);
...
...
@@ -2100,19 +2092,16 @@ C_ASSERT( sizeof(struct get_kernel_object_handle_reply) == 16 );
C_ASSERT
(
sizeof
(
struct
make_process_system_request
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
make_process_system_reply
,
event
)
==
8
);
C_ASSERT
(
sizeof
(
struct
make_process_system_reply
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_token_statistics_request
,
handle
)
==
12
);
C_ASSERT
(
sizeof
(
struct
get_token_statistics_request
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_token_statistics_reply
,
token_id
)
==
8
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_token_statistics_reply
,
modified_id
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_token_statistics_reply
,
primary
)
==
24
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_token_statistics_reply
,
impersonation_level
)
==
28
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_token_statistics_reply
,
group_count
)
==
32
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_token_statistics_reply
,
privilege_count
)
==
36
);
C_ASSERT
(
sizeof
(
struct
get_token_statistics_reply
)
==
40
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_token_elevation_request
,
handle
)
==
12
);
C_ASSERT
(
sizeof
(
struct
get_token_elevation_request
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_token_elevation_reply
,
elevation
)
==
8
);
C_ASSERT
(
sizeof
(
struct
get_token_elevation_reply
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_token_info_request
,
handle
)
==
12
);
C_ASSERT
(
sizeof
(
struct
get_token_info_request
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_token_info_reply
,
token_id
)
==
8
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_token_info_reply
,
modified_id
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_token_info_reply
,
primary
)
==
24
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_token_info_reply
,
impersonation_level
)
==
28
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_token_info_reply
,
elevation
)
==
32
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_token_info_reply
,
group_count
)
==
36
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_token_info_reply
,
privilege_count
)
==
40
);
C_ASSERT
(
sizeof
(
struct
get_token_info_reply
)
==
48
);
C_ASSERT
(
FIELD_OFFSET
(
struct
create_linked_token_request
,
handle
)
==
12
);
C_ASSERT
(
sizeof
(
struct
create_linked_token_request
)
==
16
);
C_ASSERT
(
FIELD_OFFSET
(
struct
create_linked_token_reply
,
linked
)
==
8
);
...
...
server/token.c
View file @
6f7b56a1
...
...
@@ -1586,38 +1586,19 @@ DECL_HANDLER(get_token_groups)
}
}
DECL_HANDLER
(
get_token_i
mpersonation_level
)
DECL_HANDLER
(
get_token_i
nfo
)
{
struct
token
*
token
;
if
((
token
=
(
struct
token
*
)
get_handle_obj
(
current
->
process
,
req
->
handle
,
TOKEN_QUERY
,
&
token_ops
)))
{
if
(
token
->
primary
)
set_error
(
STATUS_INVALID_PARAMETER
);
else
reply
->
impersonation_level
=
token
->
impersonation_level
;
release_object
(
token
);
}
}
DECL_HANDLER
(
get_token_statistics
)
{
struct
token
*
token
;
if
((
token
=
(
struct
token
*
)
get_handle_obj
(
current
->
process
,
req
->
handle
,
TOKEN_QUERY
,
&
token_ops
)))
if
((
token
=
(
struct
token
*
)
get_handle_obj
(
current
->
process
,
req
->
handle
,
TOKEN_QUERY
,
&
token_ops
)))
{
reply
->
token_id
=
token
->
token_id
;
reply
->
modified_id
=
token
->
modified_id
;
reply
->
primary
=
token
->
primary
;
reply
->
impersonation_level
=
token
->
impersonation_level
;
reply
->
elevation
=
token
->
elevation
;
reply
->
group_count
=
list_count
(
&
token
->
groups
);
reply
->
privilege_count
=
list_count
(
&
token
->
privileges
);
release_object
(
token
);
}
}
...
...
@@ -1668,18 +1649,6 @@ DECL_HANDLER(set_token_default_dacl)
}
}
DECL_HANDLER
(
get_token_elevation
)
{
struct
token
*
token
;
if
((
token
=
(
struct
token
*
)
get_handle_obj
(
current
->
process
,
req
->
handle
,
TOKEN_QUERY
,
&
token_ops
)))
{
reply
->
elevation
=
token
->
elevation
;
release_object
(
token
);
}
}
DECL_HANDLER
(
create_linked_token
)
{
struct
token
*
token
,
*
linked
;
...
...
server/trace.c
View file @
6f7b56a1
...
...
@@ -4056,16 +4056,6 @@ static void dump_get_object_types_reply( const struct get_object_types_reply *re
dump_varargs_object_types_info
(
", info="
,
cur_size
);
}
static
void
dump_get_token_impersonation_level_request
(
const
struct
get_token_impersonation_level_request
*
req
)
{
fprintf
(
stderr
,
" handle=%04x"
,
req
->
handle
);
}
static
void
dump_get_token_impersonation_level_reply
(
const
struct
get_token_impersonation_level_reply
*
req
)
{
fprintf
(
stderr
,
" impersonation_level=%d"
,
req
->
impersonation_level
);
}
static
void
dump_allocate_locally_unique_id_request
(
const
struct
allocate_locally_unique_id_request
*
req
)
{
}
...
...
@@ -4169,31 +4159,22 @@ static void dump_make_process_system_reply( const struct make_process_system_rep
fprintf
(
stderr
,
" event=%04x"
,
req
->
event
);
}
static
void
dump_get_token_
statistics_request
(
const
struct
get_token_statistics
_request
*
req
)
static
void
dump_get_token_
info_request
(
const
struct
get_token_info
_request
*
req
)
{
fprintf
(
stderr
,
" handle=%04x"
,
req
->
handle
);
}
static
void
dump_get_token_
statistics_reply
(
const
struct
get_token_statistics
_reply
*
req
)
static
void
dump_get_token_
info_reply
(
const
struct
get_token_info
_reply
*
req
)
{
dump_luid
(
" token_id="
,
&
req
->
token_id
);
dump_luid
(
", modified_id="
,
&
req
->
modified_id
);
fprintf
(
stderr
,
", primary=%d"
,
req
->
primary
);
fprintf
(
stderr
,
", impersonation_level=%d"
,
req
->
impersonation_level
);
fprintf
(
stderr
,
", elevation=%d"
,
req
->
elevation
);
fprintf
(
stderr
,
", group_count=%d"
,
req
->
group_count
);
fprintf
(
stderr
,
", privilege_count=%d"
,
req
->
privilege_count
);
}
static
void
dump_get_token_elevation_request
(
const
struct
get_token_elevation_request
*
req
)
{
fprintf
(
stderr
,
" handle=%04x"
,
req
->
handle
);
}
static
void
dump_get_token_elevation_reply
(
const
struct
get_token_elevation_reply
*
req
)
{
fprintf
(
stderr
,
" elevation=%d"
,
req
->
elevation
);
}
static
void
dump_create_linked_token_request
(
const
struct
create_linked_token_request
*
req
)
{
fprintf
(
stderr
,
" handle=%04x"
,
req
->
handle
);
...
...
@@ -4703,7 +4684,6 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(
dump_func
)
dump_get_object_info_request
,
(
dump_func
)
dump_get_object_type_request
,
(
dump_func
)
dump_get_object_types_request
,
(
dump_func
)
dump_get_token_impersonation_level_request
,
(
dump_func
)
dump_allocate_locally_unique_id_request
,
(
dump_func
)
dump_create_device_manager_request
,
(
dump_func
)
dump_create_device_request
,
...
...
@@ -4715,8 +4695,7 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(
dump_func
)
dump_release_kernel_object_request
,
(
dump_func
)
dump_get_kernel_object_handle_request
,
(
dump_func
)
dump_make_process_system_request
,
(
dump_func
)
dump_get_token_statistics_request
,
(
dump_func
)
dump_get_token_elevation_request
,
(
dump_func
)
dump_get_token_info_request
,
(
dump_func
)
dump_create_linked_token_request
,
(
dump_func
)
dump_create_completion_request
,
(
dump_func
)
dump_open_completion_request
,
...
...
@@ -4982,7 +4961,6 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
(
dump_func
)
dump_get_object_info_reply
,
(
dump_func
)
dump_get_object_type_reply
,
(
dump_func
)
dump_get_object_types_reply
,
(
dump_func
)
dump_get_token_impersonation_level_reply
,
(
dump_func
)
dump_allocate_locally_unique_id_reply
,
(
dump_func
)
dump_create_device_manager_reply
,
NULL
,
...
...
@@ -4994,8 +4972,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
NULL
,
(
dump_func
)
dump_get_kernel_object_handle_reply
,
(
dump_func
)
dump_make_process_system_reply
,
(
dump_func
)
dump_get_token_statistics_reply
,
(
dump_func
)
dump_get_token_elevation_reply
,
(
dump_func
)
dump_get_token_info_reply
,
(
dump_func
)
dump_create_linked_token_reply
,
(
dump_func
)
dump_create_completion_reply
,
(
dump_func
)
dump_open_completion_reply
,
...
...
@@ -5261,7 +5238,6 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
"get_object_info"
,
"get_object_type"
,
"get_object_types"
,
"get_token_impersonation_level"
,
"allocate_locally_unique_id"
,
"create_device_manager"
,
"create_device"
,
...
...
@@ -5273,8 +5249,7 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
"release_kernel_object"
,
"get_kernel_object_handle"
,
"make_process_system"
,
"get_token_statistics"
,
"get_token_elevation"
,
"get_token_info"
,
"create_linked_token"
,
"create_completion"
,
"open_completion"
,
...
...
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