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
f6a723f1
Commit
f6a723f1
authored
Feb 15, 2021
by
Zebediah Figura
Committed by
Alexandre Julliard
Feb 16, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32/tests: Explicitly test the ACL contents in test_AddMandatoryAce().
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
50cf8ee9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
38 deletions
+31
-38
security.c
dlls/advapi32/tests/security.c
+31
-38
No files found.
dlls/advapi32/tests/security.c
View file @
f6a723f1
...
...
@@ -6395,13 +6395,13 @@ static void test_AddMandatoryAce(void)
static
SID_IDENTIFIER_AUTHORITY
sia_world
=
{
SECURITY_WORLD_SID_AUTHORITY
};
char
buffer_sd
[
SECURITY_DESCRIPTOR_MIN_LENGTH
];
SECURITY_DESCRIPTOR
*
sd2
,
*
sd
=
(
SECURITY_DESCRIPTOR
*
)
&
buffer_sd
;
BOOL
defaulted
,
present
,
ret
,
found
,
found2
;
BOOL
defaulted
,
present
,
ret
;
ACL_SIZE_INFORMATION
acl_size_info
;
SYSTEM_MANDATORY_LABEL_ACE
*
ace
;
char
buffer_acl
[
256
];
ACL
*
acl
=
(
ACL
*
)
&
buffer_acl
;
SECURITY_ATTRIBUTES
sa
;
DWORD
index
,
size
;
DWORD
size
;
HANDLE
handle
;
SID
*
everyone
;
ACL
*
sacl
;
...
...
@@ -6453,18 +6453,17 @@ static void test_AddMandatoryAce(void)
ret
=
pAddMandatoryAce
(
acl
,
ACL_REVISION
,
0
,
SYSTEM_MANDATORY_LABEL_NO_WRITE_UP
,
&
low_level
);
ok
(
ret
,
"AddMandatoryAce failed with %u
\n
"
,
GetLastError
());
index
=
0
;
found
=
FALSE
;
while
(
GetAce
(
acl
,
index
++
,
(
void
**
)
&
ace
))
{
if
(
ace
->
Header
.
AceType
!=
SYSTEM_MANDATORY_LABEL_ACE_TYPE
)
continue
;
ok
(
ace
->
Header
.
AceFlags
==
0
,
"Expected flags 0, got %x
\n
"
,
ace
->
Header
.
AceFlags
);
ok
(
ace
->
Mask
==
SYSTEM_MANDATORY_LABEL_NO_WRITE_UP
,
"Expected mask SYSTEM_MANDATORY_LABEL_NO_WRITE_UP, got %x
\n
"
,
ace
->
Mask
);
ok
(
EqualSid
(
&
ace
->
SidStart
,
&
low_level
),
"Expected low integrity level
\n
"
);
found
=
TRUE
;
}
ok
(
found
,
"Could not find mandatory label ace
\n
"
);
ret
=
GetAce
(
acl
,
0
,
(
void
**
)
&
ace
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ace
->
Header
.
AceType
==
SYSTEM_MANDATORY_LABEL_ACE_TYPE
,
"got type %#x
\n
"
,
ace
->
Header
.
AceType
);
ok
(
!
ace
->
Header
.
AceFlags
,
"got flags %#x
\n
"
,
ace
->
Header
.
AceFlags
);
ok
(
ace
->
Mask
==
SYSTEM_MANDATORY_LABEL_NO_WRITE_UP
,
"got mask %#x
\n
"
,
ace
->
Mask
);
ok
(
EqualSid
(
&
ace
->
SidStart
,
&
low_level
),
"wrong sid
\n
"
);
SetLastError
(
0xdeadbeef
);
ret
=
GetAce
(
acl
,
1
,
(
void
**
)
&
ace
);
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"got error %u
\n
"
,
GetLastError
());
ret
=
SetSecurityDescriptorSacl
(
sd
,
TRUE
,
acl
,
FALSE
);
ok
(
ret
,
"SetSecurityDescriptorSacl failed with error %u
\n
"
,
GetLastError
());
...
...
@@ -6525,30 +6524,24 @@ static void test_AddMandatoryAce(void)
ok
(
sacl
->
AceCount
==
2
,
"Expected 2 ACEs, got %d
\n
"
,
sacl
->
AceCount
);
ok
(
!
defaulted
,
"SACL defaulted
\n
"
);
index
=
0
;
found
=
found2
=
FALSE
;
while
(
GetAce
(
sacl
,
index
++
,
(
void
**
)
&
ace
))
{
if
(
ace
->
Header
.
AceType
==
SYSTEM_MANDATORY_LABEL_ACE_TYPE
)
{
if
(
EqualSid
(
&
ace
->
SidStart
,
&
low_level
))
{
found
=
TRUE
;
ok
(
!
ace
->
Header
.
AceFlags
,
"Expected 0 as flags, got %#x
\n
"
,
ace
->
Header
.
AceFlags
);
ok
(
ace
->
Mask
==
SYSTEM_MANDATORY_LABEL_NO_WRITE_UP
,
"Expected SYSTEM_MANDATORY_LABEL_NO_WRITE_UP as mask, got %#x
\n
"
,
ace
->
Mask
);
}
if
(
EqualSid
(
&
ace
->
SidStart
,
&
medium_level
))
{
found2
=
TRUE
;
ok
(
!
ace
->
Header
.
AceFlags
,
"Expected 0 as flags, got %#x
\n
"
,
ace
->
Header
.
AceFlags
);
ok
(
ace
->
Mask
==
SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP
,
"Expected SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP as mask, got %#x
\n
"
,
ace
->
Mask
);
}
}
}
ok
(
found
,
"Could not find low mandatory label
\n
"
);
ok
(
found2
,
"Could not find medium mandatory label
\n
"
);
ret
=
GetAce
(
acl
,
0
,
(
void
**
)
&
ace
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ace
->
Header
.
AceType
==
SYSTEM_MANDATORY_LABEL_ACE_TYPE
,
"got type %#x
\n
"
,
ace
->
Header
.
AceType
);
ok
(
!
ace
->
Header
.
AceFlags
,
"got flags %#x
\n
"
,
ace
->
Header
.
AceFlags
);
ok
(
ace
->
Mask
==
SYSTEM_MANDATORY_LABEL_NO_WRITE_UP
,
"got mask %#x
\n
"
,
ace
->
Mask
);
ok
(
EqualSid
(
&
ace
->
SidStart
,
&
low_level
),
"wrong sid
\n
"
);
ret
=
GetAce
(
acl
,
1
,
(
void
**
)
&
ace
);
ok
(
ret
,
"got error %u
\n
"
,
GetLastError
());
ok
(
ace
->
Header
.
AceType
==
SYSTEM_MANDATORY_LABEL_ACE_TYPE
,
"got type %#x
\n
"
,
ace
->
Header
.
AceType
);
ok
(
!
ace
->
Header
.
AceFlags
,
"got flags %#x
\n
"
,
ace
->
Header
.
AceFlags
);
ok
(
ace
->
Mask
==
SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP
,
"got mask %#x
\n
"
,
ace
->
Mask
);
ok
(
EqualSid
(
&
ace
->
SidStart
,
&
medium_level
),
"wrong sid
\n
"
);
SetLastError
(
0xdeadbeef
);
ret
=
GetAce
(
acl
,
2
,
(
void
**
)
&
ace
);
ok
(
!
ret
,
"expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"got error %u
\n
"
,
GetLastError
());
HeapFree
(
GetProcessHeap
(),
0
,
sd2
);
...
...
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