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
4ea75354
Commit
4ea75354
authored
Feb 15, 2007
by
Rob Shearman
Committed by
Alexandre Julliard
Feb 15, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32: Add some more tests for AccessCheck that determine what
token impersonation levels it accepts and to show that it doesn't accept primary tokens.
parent
3f8215d2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
5 deletions
+29
-5
security.c
dlls/advapi32/tests/security.c
+29
-5
No files found.
dlls/advapi32/tests/security.c
View file @
4ea75354
...
...
@@ -659,6 +659,7 @@ static void test_AccessCheck(void)
ACCESS_MASK
Access
;
BOOL
AccessStatus
;
HANDLE
Token
;
HANDLE
ProcessToken
;
BOOL
ret
;
DWORD
PrivSetLen
;
PRIVILEGE_SET
*
PrivSet
;
...
...
@@ -716,13 +717,13 @@ static void test_AccessCheck(void)
PrivSet
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
PrivSetLen
);
PrivSet
->
PrivilegeCount
=
16
;
ImpersonateSelf
(
SecurityImpersonation
);
res
=
OpenProcessToken
(
GetCurrentProcess
(),
TOKEN_DUPLICATE
|
TOKEN_QUERY
,
&
ProcessToken
);
ok
(
res
,
"OpenProcessToken failed with error %d
\n
"
,
GetLastError
());
pRtlAdjustPrivilege
(
SE_SECURITY_PRIVILEGE
,
FALSE
,
TRUE
,
&
Enabled
);
ret
=
OpenThreadToken
(
GetCurrentThread
(),
TOKEN_QUERY
,
TRUE
,
&
Token
);
ok
(
ret
,
"OpenThreadToken failed with error %d
\n
"
,
GetLastError
());
res
=
DuplicateToken
(
ProcessToken
,
SecurityIdentification
,
&
Token
);
ok
(
res
,
"DuplicateToken failed with error %d
\n
"
,
GetLastError
());
/* SD without owner/group */
SetLastError
(
0xdeadbeef
);
...
...
@@ -802,7 +803,30 @@ static void test_AccessCheck(void)
trace
(
"Couldn't get SE_SECURITY_PRIVILEGE (0x%08x), skipping ACCESS_SYSTEM_SECURITY test
\n
"
,
ret
);
RevertToSelf
();
CloseHandle
(
Token
);
res
=
DuplicateToken
(
ProcessToken
,
SecurityAnonymous
,
&
Token
);
ok
(
res
,
"DuplicateToken failed with error %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
ret
=
AccessCheck
(
SecurityDescriptor
,
Token
,
MAXIMUM_ALLOWED
,
&
Mapping
,
PrivSet
,
&
PrivSetLen
,
&
Access
,
&
AccessStatus
);
err
=
GetLastError
();
todo_wine
{
ok
(
!
ret
&&
err
==
ERROR_BAD_IMPERSONATION_LEVEL
,
"AccessCheck should have failed "
"with ERROR_BAD_IMPERSONATION_LEVEL, instead of %d
\n
"
,
err
);
}
CloseHandle
(
Token
);
SetLastError
(
0xdeadbeef
);
ret
=
AccessCheck
(
SecurityDescriptor
,
ProcessToken
,
KEY_READ
,
&
Mapping
,
PrivSet
,
&
PrivSetLen
,
&
Access
,
&
AccessStatus
);
err
=
GetLastError
();
ok
(
!
ret
&&
err
==
ERROR_NO_IMPERSONATION_TOKEN
,
"AccessCheck should have failed "
"with ERROR_NO_IMPERSONATION_TOKEN, instead of %d
\n
"
,
err
);
CloseHandle
(
ProcessToken
);
if
(
EveryoneSid
)
FreeSid
(
EveryoneSid
);
...
...
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