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
48821e2b
Commit
48821e2b
authored
Apr 25, 2019
by
Qian Hong
Committed by
Alexandre Julliard
Apr 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32/tests: Test prefix and use of TokenPrimaryGroup Sid.
Signed-off-by:
Vijay Kiran Kamuju
<
infyquest@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f5636dea
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
5 deletions
+30
-5
security.c
dlls/advapi32/tests/security.c
+30
-5
No files found.
dlls/advapi32/tests/security.c
View file @
48821e2b
...
@@ -2876,19 +2876,21 @@ static void test_granted_access(HANDLE handle, ACCESS_MASK access,
...
@@ -2876,19 +2876,21 @@ static void test_granted_access(HANDLE handle, ACCESS_MASK access,
static
void
test_process_security
(
void
)
static
void
test_process_security
(
void
)
{
{
BOOL
res
;
BOOL
res
;
PTOKEN_USER
user
;
PTOKEN_OWNER
owner
;
PTOKEN_OWNER
owner
;
PTOKEN_PRIMARY_GROUP
group
;
PTOKEN_PRIMARY_GROUP
group
;
PSID
AdminSid
=
NULL
,
UsersSid
=
NULL
;
PSID
AdminSid
=
NULL
,
UsersSid
=
NULL
,
UserSid
=
NULL
;
PACL
Acl
=
NULL
,
ThreadAcl
=
NULL
;
PACL
Acl
=
NULL
,
ThreadAcl
=
NULL
;
SECURITY_DESCRIPTOR
*
SecurityDescriptor
=
NULL
,
*
ThreadSecurityDescriptor
=
NULL
;
SECURITY_DESCRIPTOR
*
SecurityDescriptor
=
NULL
,
*
ThreadSecurityDescriptor
=
NULL
;
char
buffer
[
MAX_PATH
];
char
buffer
[
MAX_PATH
]
,
account
[
MAX_PATH
],
domain
[
MAX_PATH
]
;
PROCESS_INFORMATION
info
;
PROCESS_INFORMATION
info
;
STARTUPINFOA
startup
;
STARTUPINFOA
startup
;
SECURITY_ATTRIBUTES
psa
,
tsa
;
SECURITY_ATTRIBUTES
psa
,
tsa
;
HANDLE
token
,
event
;
HANDLE
token
,
event
;
DWORD
size
;
DWORD
size
,
acc_size
,
dom_size
,
ret
;
SID_IDENTIFIER_AUTHORITY
SIDAuthWorld
=
{
SECURITY_WORLD_SID_AUTHORITY
};
SID_IDENTIFIER_AUTHORITY
SIDAuthWorld
=
{
SECURITY_WORLD_SID_AUTHORITY
};
PSID
EveryoneSid
=
NULL
;
PSID
EveryoneSid
=
NULL
;
SID_NAME_USE
use
;
Acl
=
HeapAlloc
(
GetProcessHeap
(),
0
,
256
);
Acl
=
HeapAlloc
(
GetProcessHeap
(),
0
,
256
);
res
=
InitializeAcl
(
Acl
,
256
,
ACL_REVISION
);
res
=
InitializeAcl
(
Acl
,
256
,
ACL_REVISION
);
...
@@ -2920,7 +2922,8 @@ static void test_process_security(void)
...
@@ -2920,7 +2922,8 @@ static void test_process_security(void)
owner
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
owner
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
res
=
GetTokenInformation
(
token
,
TokenOwner
,
owner
,
size
,
&
size
);
res
=
GetTokenInformation
(
token
,
TokenOwner
,
owner
,
size
,
&
size
);
ok
(
res
,
"GetTokenInformation failed with error %d
\n
"
,
GetLastError
());
ok
(
res
,
"GetTokenInformation failed with error %d
\n
"
,
GetLastError
());
AdminSid
=
((
TOKEN_OWNER
*
)
owner
)
->
Owner
;
AdminSid
=
owner
->
Owner
;
test_sid_str
(
AdminSid
);
res
=
GetTokenInformation
(
token
,
TokenPrimaryGroup
,
NULL
,
0
,
&
size
);
res
=
GetTokenInformation
(
token
,
TokenPrimaryGroup
,
NULL
,
0
,
&
size
);
ok
(
!
res
,
"Expected failure, got %d
\n
"
,
res
);
ok
(
!
res
,
"Expected failure, got %d
\n
"
,
res
);
...
@@ -2930,13 +2933,34 @@ static void test_process_security(void)
...
@@ -2930,13 +2933,34 @@ static void test_process_security(void)
group
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
group
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
res
=
GetTokenInformation
(
token
,
TokenPrimaryGroup
,
group
,
size
,
&
size
);
res
=
GetTokenInformation
(
token
,
TokenPrimaryGroup
,
group
,
size
,
&
size
);
ok
(
res
,
"GetTokenInformation failed with error %d
\n
"
,
GetLastError
());
ok
(
res
,
"GetTokenInformation failed with error %d
\n
"
,
GetLastError
());
UsersSid
=
((
TOKEN_PRIMARY_GROUP
*
)
group
)
->
PrimaryGroup
;
UsersSid
=
group
->
PrimaryGroup
;
test_sid_str
(
UsersSid
);
acc_size
=
sizeof
(
account
);
dom_size
=
sizeof
(
domain
);
ret
=
LookupAccountSidA
(
NULL
,
UsersSid
,
account
,
&
acc_size
,
domain
,
&
dom_size
,
&
use
);
ok
(
ret
,
"LookupAccountSid failed with %d
\n
"
,
ret
);
todo_wine
ok
(
use
==
SidTypeGroup
,
"expect SidTypeGroup, got %d
\n
"
,
use
);
todo_wine
ok
(
!
strcmp
(
account
,
"None"
),
"expect None, got %s
\n
"
,
account
);
res
=
GetTokenInformation
(
token
,
TokenUser
,
NULL
,
0
,
&
size
);
ok
(
!
res
,
"Expected failure, got %d
\n
"
,
res
);
ok
(
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
,
"Expected ERROR_INSUFFICIENT_BUFFER, got %d
\n
"
,
GetLastError
());
user
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
res
=
GetTokenInformation
(
token
,
TokenUser
,
user
,
size
,
&
size
);
ok
(
res
,
"GetTokenInformation failed with error %d
\n
"
,
GetLastError
());
UserSid
=
user
->
User
.
Sid
;
test_sid_str
(
UserSid
);
todo_wine
ok
(
EqualPrefixSid
(
UsersSid
,
UserSid
),
"TokenPrimaryGroup Sid and TokenUser Sid don't match.
\n
"
);
CloseHandle
(
token
);
CloseHandle
(
token
);
if
(
!
res
)
if
(
!
res
)
{
{
HeapFree
(
GetProcessHeap
(),
0
,
group
);
HeapFree
(
GetProcessHeap
(),
0
,
group
);
HeapFree
(
GetProcessHeap
(),
0
,
owner
);
HeapFree
(
GetProcessHeap
(),
0
,
owner
);
HeapFree
(
GetProcessHeap
(),
0
,
user
);
HeapFree
(
GetProcessHeap
(),
0
,
Acl
);
HeapFree
(
GetProcessHeap
(),
0
,
Acl
);
return
;
return
;
}
}
...
@@ -3043,6 +3067,7 @@ static void test_process_security(void)
...
@@ -3043,6 +3067,7 @@ static void test_process_security(void)
CloseHandle
(
event
);
CloseHandle
(
event
);
HeapFree
(
GetProcessHeap
(),
0
,
group
);
HeapFree
(
GetProcessHeap
(),
0
,
group
);
HeapFree
(
GetProcessHeap
(),
0
,
owner
);
HeapFree
(
GetProcessHeap
(),
0
,
owner
);
HeapFree
(
GetProcessHeap
(),
0
,
user
);
HeapFree
(
GetProcessHeap
(),
0
,
Acl
);
HeapFree
(
GetProcessHeap
(),
0
,
Acl
);
HeapFree
(
GetProcessHeap
(),
0
,
SecurityDescriptor
);
HeapFree
(
GetProcessHeap
(),
0
,
SecurityDescriptor
);
HeapFree
(
GetProcessHeap
(),
0
,
ThreadAcl
);
HeapFree
(
GetProcessHeap
(),
0
,
ThreadAcl
);
...
...
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