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
f483f71a
Commit
f483f71a
authored
Apr 21, 2009
by
Hans Leidekker
Committed by
Alexandre Julliard
Apr 21, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Implement NtQuery/SetInformationToken(TokenDefaultDacl).
parent
24af6f3e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
110 additions
and
8 deletions
+110
-8
security.c
dlls/advapi32/tests/security.c
+47
-2
nt.c
dlls/ntdll/nt.c
+63
-6
No files found.
dlls/advapi32/tests/security.c
View file @
f483f71a
...
...
@@ -1176,14 +1176,16 @@ static void test_AccessCheck(void)
static
void
test_token_attr
(
void
)
{
HANDLE
Token
,
ImpersonationToken
;
DWORD
Size
;
DWORD
Size
,
Size2
;
TOKEN_PRIVILEGES
*
Privileges
;
TOKEN_GROUPS
*
Groups
;
TOKEN_USER
*
User
;
TOKEN_DEFAULT_DACL
*
Dacl
;
BOOL
ret
;
DWORD
i
,
GLE
;
LPSTR
SidString
;
SECURITY_IMPERSONATION_LEVEL
ImpersonationLevel
;
ACL
*
acl
;
/* cygwin-like use case */
SetLastError
(
0xdeadbeef
);
...
...
@@ -1214,7 +1216,7 @@ static void test_token_attr(void)
}
SetLastError
(
0xdeadbeef
);
ret
=
OpenProcessToken
(
GetCurrentProcess
(),
TOKEN_
QUERY
|
TOKEN_DUPLICATE
,
&
Token
);
ret
=
OpenProcessToken
(
GetCurrentProcess
(),
TOKEN_
ALL_ACCESS
,
&
Token
);
ok
(
ret
,
"OpenProcessToken failed with error %d
\n
"
,
GetLastError
());
/* groups */
...
...
@@ -1283,6 +1285,49 @@ static void test_token_attr(void)
ok
(
ImpersonationLevel
==
SecurityAnonymous
,
"ImpersonationLevel should have been SecurityAnonymous instead of %d
\n
"
,
ImpersonationLevel
);
CloseHandle
(
ImpersonationToken
);
/* default dacl */
ret
=
GetTokenInformation
(
Token
,
TokenDefaultDacl
,
NULL
,
0
,
&
Size
);
ok
(
!
ret
&&
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
),
"GetTokenInformation(TokenDefaultDacl) failed with error %u
\n
"
,
GetLastError
());
Dacl
=
HeapAlloc
(
GetProcessHeap
(),
0
,
Size
);
ret
=
GetTokenInformation
(
Token
,
TokenDefaultDacl
,
Dacl
,
Size
,
&
Size
);
ok
(
ret
,
"GetTokenInformation(TokenDefaultDacl) failed with error %u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
SetTokenInformation
(
Token
,
TokenDefaultDacl
,
NULL
,
0
);
GLE
=
GetLastError
();
ok
(
!
ret
,
"SetTokenInformation(TokenDefaultDacl) succeeded
\n
"
);
ok
(
GLE
==
ERROR_BAD_LENGTH
,
"expected ERROR_BAD_LENGTH got %u
\n
"
,
GLE
);
SetLastError
(
0xdeadbeef
);
ret
=
SetTokenInformation
(
Token
,
TokenDefaultDacl
,
NULL
,
Size
);
GLE
=
GetLastError
();
ok
(
!
ret
,
"SetTokenInformation(TokenDefaultDacl) succeeded
\n
"
);
ok
(
GLE
==
ERROR_NOACCESS
,
"expected ERROR_NOACCESS got %u
\n
"
,
GLE
);
acl
=
Dacl
->
DefaultDacl
;
Dacl
->
DefaultDacl
=
NULL
;
ret
=
SetTokenInformation
(
Token
,
TokenDefaultDacl
,
Dacl
,
Size
);
ok
(
ret
,
"SetTokenInformation(TokenDefaultDacl) succeeded
\n
"
);
Size2
=
0
;
Dacl
->
DefaultDacl
=
(
ACL
*
)
0xdeadbeef
;
ret
=
GetTokenInformation
(
Token
,
TokenDefaultDacl
,
Dacl
,
Size
,
&
Size2
);
ok
(
ret
,
"GetTokenInformation(TokenDefaultDacl) failed with error %u
\n
"
,
GetLastError
());
ok
(
Dacl
->
DefaultDacl
==
NULL
,
"expected NULL, got %p
\n
"
,
Dacl
->
DefaultDacl
);
ok
(
Size2
==
sizeof
(
TOKEN_DEFAULT_DACL
),
"got %u expected sizeof(TOKEN_DEFAULT_DACL)
\n
"
,
Size2
);
Dacl
->
DefaultDacl
=
acl
;
ret
=
SetTokenInformation
(
Token
,
TokenDefaultDacl
,
Dacl
,
Size
);
ok
(
ret
,
"SetTokenInformation(TokenDefaultDacl) failed with error %u
\n
"
,
GetLastError
());
ret
=
GetTokenInformation
(
Token
,
TokenDefaultDacl
,
Dacl
,
Size
,
&
Size2
);
ok
(
ret
,
"GetTokenInformation(TokenDefaultDacl) failed with error %u
\n
"
,
GetLastError
());
HeapFree
(
GetProcessHeap
(),
0
,
Dacl
);
CloseHandle
(
Token
);
}
...
...
dlls/ntdll/nt.c
View file @
f483f71a
...
...
@@ -242,9 +242,6 @@ NTSTATUS WINAPI NtQueryInformationToken(
case
TokenPrimaryGroup
:
len
=
sizeof
(
TOKEN_PRIMARY_GROUP
);
break
;
case
TokenDefaultDacl
:
len
=
sizeof
(
TOKEN_DEFAULT_DACL
);
break
;
case
TokenSource
:
len
=
sizeof
(
TOKEN_SOURCE
);
break
;
...
...
@@ -441,6 +438,31 @@ NTSTATUS WINAPI NtQueryInformationToken(
}
SERVER_END_REQ
;
break
;
case
TokenDefaultDacl
:
SERVER_START_REQ
(
get_token_default_dacl
)
{
TOKEN_DEFAULT_DACL
*
default_dacl
=
tokeninfo
;
ACL
*
acl
=
(
ACL
*
)(
default_dacl
+
1
);
DWORD
acl_len
;
if
(
tokeninfolength
<
sizeof
(
TOKEN_DEFAULT_DACL
))
acl_len
=
0
;
else
acl_len
=
tokeninfolength
-
sizeof
(
TOKEN_DEFAULT_DACL
);
req
->
handle
=
wine_server_obj_handle
(
token
);
wine_server_set_reply
(
req
,
acl
,
acl_len
);
status
=
wine_server_call
(
req
);
if
(
retlen
)
*
retlen
=
reply
->
acl_len
+
sizeof
(
TOKEN_DEFAULT_DACL
);
if
(
status
==
STATUS_SUCCESS
)
{
if
(
reply
->
acl_len
)
default_dacl
->
DefaultDacl
=
acl
;
else
default_dacl
->
DefaultDacl
=
NULL
;
}
}
SERVER_END_REQ
;
break
;
default:
{
ERR
(
"Unhandled Token Information class %d!
\n
"
,
tokeninfoclass
);
...
...
@@ -460,9 +482,44 @@ NTSTATUS WINAPI NtSetInformationToken(
PVOID
TokenInformation
,
ULONG
TokenInformationLength
)
{
FIXME
(
"%p %d %p %u
\n
"
,
TokenHandle
,
TokenInformationClass
,
TokenInformation
,
TokenInformationLength
);
return
STATUS_NOT_IMPLEMENTED
;
NTSTATUS
ret
=
STATUS_NOT_IMPLEMENTED
;
TRACE
(
"%p %d %p %u
\n
"
,
TokenHandle
,
TokenInformationClass
,
TokenInformation
,
TokenInformationLength
);
switch
(
TokenInformationClass
)
{
case
TokenDefaultDacl
:
if
(
TokenInformationLength
<
sizeof
(
TOKEN_DEFAULT_DACL
))
{
ret
=
STATUS_INFO_LENGTH_MISMATCH
;
break
;
}
if
(
!
TokenInformation
)
{
ret
=
STATUS_ACCESS_VIOLATION
;
break
;
}
SERVER_START_REQ
(
set_token_default_dacl
)
{
ACL
*
acl
=
((
TOKEN_DEFAULT_DACL
*
)
TokenInformation
)
->
DefaultDacl
;
WORD
size
;
if
(
acl
)
size
=
acl
->
AclSize
;
else
size
=
0
;
req
->
handle
=
wine_server_obj_handle
(
TokenHandle
);
wine_server_add_data
(
req
,
acl
,
size
);
ret
=
wine_server_call
(
req
);
}
SERVER_END_REQ
;
break
;
default:
FIXME
(
"unimplemented class %u
\n
"
,
TokenInformationClass
);
break
;
}
return
ret
;
}
/******************************************************************************
...
...
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