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
bbe62337
Commit
bbe62337
authored
Feb 02, 2017
by
Owen Rudge
Committed by
Alexandre Julliard
Feb 03, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32/tests: Add test of LsaLookupSids buffer behaviour.
Signed-off-by:
Owen Rudge
<
orudge@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
02ad0928
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
1 deletion
+48
-1
lsa.c
dlls/advapi32/tests/lsa.c
+48
-1
No files found.
dlls/advapi32/tests/lsa.c
View file @
bbe62337
...
...
@@ -42,8 +42,10 @@ static NTSTATUS (WINAPI *pLsaFreeMemory)(PVOID);
static
NTSTATUS
(
WINAPI
*
pLsaOpenPolicy
)(
PLSA_UNICODE_STRING
,
PLSA_OBJECT_ATTRIBUTES
,
ACCESS_MASK
,
PLSA_HANDLE
);
static
NTSTATUS
(
WINAPI
*
pLsaQueryInformationPolicy
)(
LSA_HANDLE
,
POLICY_INFORMATION_CLASS
,
PVOID
*
);
static
BOOL
(
WINAPI
*
pConvertSidToStringSidA
)(
PSID
,
LPSTR
*
);
static
BOOL
(
WINAPI
*
pConvertStringSidToSidA
)(
LPCSTR
,
PSID
*
);
static
NTSTATUS
(
WINAPI
*
pLsaLookupNames2
)(
LSA_HANDLE
,
ULONG
,
ULONG
,
PLSA_UNICODE_STRING
,
PLSA_REFERENCED_DOMAIN_LIST
*
,
PLSA_TRANSLATED_SID2
*
);
static
NTSTATUS
(
WINAPI
*
pLsaLookupSids
)(
LSA_HANDLE
,
ULONG
,
PSID
*
,
LSA_REFERENCED_DOMAIN_LIST
**
,
LSA_TRANSLATED_NAME
**
);
static
PVOID
(
WINAPI
*
pFreeSid
)(
PSID
);
static
BOOL
init
(
void
)
{
...
...
@@ -55,10 +57,12 @@ static BOOL init(void)
pLsaOpenPolicy
=
(
void
*
)
GetProcAddress
(
hadvapi32
,
"LsaOpenPolicy"
);
pLsaQueryInformationPolicy
=
(
void
*
)
GetProcAddress
(
hadvapi32
,
"LsaQueryInformationPolicy"
);
pConvertSidToStringSidA
=
(
void
*
)
GetProcAddress
(
hadvapi32
,
"ConvertSidToStringSidA"
);
pConvertStringSidToSidA
=
(
void
*
)
GetProcAddress
(
hadvapi32
,
"ConvertStringSidToSidA"
);
pLsaLookupNames2
=
(
void
*
)
GetProcAddress
(
hadvapi32
,
"LsaLookupNames2"
);
pLsaLookupSids
=
(
void
*
)
GetProcAddress
(
hadvapi32
,
"LsaLookupSids"
);
pFreeSid
=
(
void
*
)
GetProcAddress
(
hadvapi32
,
"FreeSid"
);
if
(
pLsaClose
&&
pLsaEnumerateAccountRights
&&
pLsaFreeMemory
&&
pLsaOpenPolicy
&&
pLsaQueryInformationPolicy
&&
pConvertSidToStringSidA
)
if
(
pLsaClose
&&
pLsaEnumerateAccountRights
&&
pLsaFreeMemory
&&
pLsaOpenPolicy
&&
pLsaQueryInformationPolicy
&&
pConvertSidToStringSidA
&&
pConvertStringSidToSidA
&&
pFreeSid
)
return
TRUE
;
return
FALSE
;
...
...
@@ -405,6 +409,48 @@ static void test_LsaLookupSids(void)
ok
(
status
==
STATUS_SUCCESS
,
"got 0x%08x
\n
"
,
status
);
}
static
void
test_LsaLookupSids_NullBuffers
(
void
)
{
LSA_REFERENCED_DOMAIN_LIST
*
list
;
LSA_OBJECT_ATTRIBUTES
attrs
;
LSA_TRANSLATED_NAME
*
names
;
LSA_HANDLE
policy
;
NTSTATUS
status
;
BOOL
ret
;
PSID
sid
;
memset
(
&
attrs
,
0
,
sizeof
(
attrs
));
attrs
.
Length
=
sizeof
(
attrs
);
status
=
pLsaOpenPolicy
(
NULL
,
&
attrs
,
POLICY_LOOKUP_NAMES
,
&
policy
);
ok
(
status
==
STATUS_SUCCESS
,
"got 0x%08x
\n
"
,
status
);
ret
=
pConvertStringSidToSidA
(
"S-1-1-0"
,
&
sid
);
ok
(
ret
==
TRUE
,
"pConvertStringSidToSidA returned false
\n
"
);
status
=
pLsaLookupSids
(
policy
,
1
,
&
sid
,
&
list
,
&
names
);
ok
(
status
==
STATUS_SUCCESS
,
"got 0x%08x
\n
"
,
status
);
ok
(
list
->
Entries
>
0
,
"got %d
\n
"
,
list
->
Entries
);
if
(
list
->
Entries
)
{
ok
((
char
*
)
list
->
Domains
-
(
char
*
)
list
>
0
,
"%p, %p
\n
"
,
list
,
list
->
Domains
);
ok
((
char
*
)
list
->
Domains
[
0
].
Sid
-
(
char
*
)
list
->
Domains
>
0
,
"%p, %p
\n
"
,
list
->
Domains
,
list
->
Domains
[
0
].
Sid
);
ok
(
list
->
Domains
[
0
].
Name
.
MaximumLength
>
list
->
Domains
[
0
].
Name
.
Length
,
"got %d, %d
\n
"
,
list
->
Domains
[
0
].
Name
.
MaximumLength
,
list
->
Domains
[
0
].
Name
.
Length
);
ok
(
list
->
Domains
[
0
].
Name
.
Buffer
!=
NULL
,
"domain[0] name buffer is null
\n
"
);
}
pLsaFreeMemory
(
names
);
pLsaFreeMemory
(
list
);
pFreeSid
(
sid
);
status
=
pLsaClose
(
policy
);
ok
(
status
==
STATUS_SUCCESS
,
"got 0x%08x
\n
"
,
status
);
}
START_TEST
(
lsa
)
{
if
(
!
init
())
{
...
...
@@ -415,4 +461,5 @@ START_TEST(lsa)
test_lsa
();
test_LsaLookupNames2
();
test_LsaLookupSids
();
test_LsaLookupSids_NullBuffers
();
}
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