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
cac17c45
Commit
cac17c45
authored
Nov 02, 2007
by
Paul Vriens
Committed by
Alexandre Julliard
Nov 02, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32/tests: Make tests run on win98 again.
parent
159c8af5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
15 deletions
+24
-15
security.c
dlls/advapi32/tests/security.c
+24
-15
No files found.
dlls/advapi32/tests/security.c
View file @
cac17c45
...
...
@@ -59,6 +59,9 @@ typedef struct _OBJECT_BASIC_INFORMATION {
#define expect_eq(expr, value, type, format) { type ret = expr; ok((value) == ret, #expr " expected " format " got " format "\n", (value), (ret)); }
static
BOOL
(
WINAPI
*
pAddAccessAllowedAceEx
)(
PACL
,
DWORD
,
DWORD
,
DWORD
,
PSID
);
static
BOOL
(
WINAPI
*
pAddAccessDeniedAceEx
)(
PACL
,
DWORD
,
DWORD
,
DWORD
,
PSID
);
static
BOOL
(
WINAPI
*
pAddAuditAccessAceEx
)(
PACL
,
DWORD
,
DWORD
,
DWORD
,
PSID
,
BOOL
,
BOOL
);
typedef
VOID
(
WINAPI
*
fnBuildTrusteeWithSidA
)(
PTRUSTEEA
pTrustee
,
PSID
pSid
);
typedef
VOID
(
WINAPI
*
fnBuildTrusteeWithNameA
)(
PTRUSTEEA
pTrustee
,
LPSTR
pName
);
typedef
VOID
(
WINAPI
*
fnBuildTrusteeWithObjectsAndNameA
)(
PTRUSTEEA
pTrustee
,
...
...
@@ -96,6 +99,8 @@ typedef NTSTATUS (WINAPI *fnLsaFreeMemory)(PVOID);
typedef
NTSTATUS
(
WINAPI
*
fnLsaOpenPolicy
)(
PLSA_UNICODE_STRING
,
PLSA_OBJECT_ATTRIBUTES
,
ACCESS_MASK
,
PLSA_HANDLE
);
static
NTSTATUS
(
WINAPI
*
pNtQueryObject
)(
HANDLE
,
OBJECT_INFORMATION_CLASS
,
PVOID
,
ULONG
,
PULONG
);
static
DWORD
(
WINAPI
*
pSetEntriesInAclW
)(
ULONG
,
PEXPLICIT_ACCESSW
,
PACL
,
PACL
*
);
static
BOOL
(
WINAPI
*
pSetSecurityDescriptorControl
)(
PSECURITY_DESCRIPTOR
,
SECURITY_DESCRIPTOR_CONTROL
,
SECURITY_DESCRIPTOR_CONTROL
);
static
HMODULE
hmod
;
static
int
myARGC
;
...
...
@@ -132,14 +137,18 @@ static void init(void)
pNtQueryObject
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtQueryObject"
);
hmod
=
GetModuleHandle
(
"advapi32.dll"
);
pAddAccessAllowedAceEx
=
(
void
*
)
GetProcAddress
(
hmod
,
"AddAccessAllowedAceEx"
);
pAddAccessDeniedAceEx
=
(
void
*
)
GetProcAddress
(
hmod
,
"AddAccessDeniedAceEx"
);
pAddAuditAccessAceEx
=
(
void
*
)
GetProcAddress
(
hmod
,
"AddAuditAccessAceEx"
);
pConvertStringSecurityDescriptorToSecurityDescriptorA
=
(
void
*
)
GetProcAddress
(
hmod
,
"ConvertStringSecurityDescriptorToSecurityDescriptorA"
);
pConvertSecurityDescriptorToStringSecurityDescriptorA
=
(
void
*
)
GetProcAddress
(
hmod
,
"ConvertSecurityDescriptorToStringSecurityDescriptorA"
);
p
MakeSelfRelativeSD
=
(
void
*
)
GetProcAddress
(
hmod
,
"MakeSelfRelativeSD"
);
p
CreateWellKnownSid
=
(
fnCreateWellKnownSid
)
GetProcAddress
(
hmod
,
"CreateWellKnownSid"
);
pGetNamedSecurityInfoA
=
(
void
*
)
GetProcAddress
(
hmod
,
"GetNamedSecurityInfoA"
);
pMakeSelfRelativeSD
=
(
void
*
)
GetProcAddress
(
hmod
,
"MakeSelfRelativeSD"
);
pSetEntriesInAclW
=
(
void
*
)
GetProcAddress
(
hmod
,
"SetEntriesInAclW"
);
p
CreateWellKnownSid
=
(
fnCreateWellKnownSid
)
GetProcAddress
(
hmod
,
"CreateWellKnownSid"
);
p
SetSecurityDescriptorControl
=
(
void
*
)
GetProcAddress
(
hmod
,
"SetSecurityDescriptorControl"
);
myARGC
=
winetest_get_mainargs
(
&
myARGV
);
}
...
...
@@ -837,7 +846,7 @@ static void test_AccessCheck(void)
ok
(
!
Access
,
"Should have failed to grant any access, got 0x%08x
\n
"
,
Access
);
res
=
AddAccessAllowedAce
(
Acl
,
ACL_REVISION
,
KEY_READ
,
EveryoneSid
);
ok
(
res
,
"AddAccessAllowedAce
Ex
failed with error %d
\n
"
,
GetLastError
());
ok
(
res
,
"AddAccessAllowedAce failed with error %d
\n
"
,
GetLastError
());
res
=
AddAccessDeniedAce
(
Acl
,
ACL_REVISION
,
KEY_SET_VALUE
,
AdminSid
);
ok
(
res
,
"AddAccessDeniedAce failed with error %d
\n
"
,
GetLastError
());
...
...
@@ -901,7 +910,7 @@ static void test_AccessCheck(void)
/* test INHERIT_ONLY_ACE */
ret
=
InitializeAcl
(
Acl
,
256
,
ACL_REVISION
);
ok
(
ret
,
"InitializeAcl failed with error %d
\n
"
,
GetLastError
());
ret
=
AddAccessAllowedAceEx
(
Acl
,
ACL_REVISION
,
INHERIT_ONLY_ACE
,
KEY_READ
,
EveryoneSid
);
ret
=
p
AddAccessAllowedAceEx
(
Acl
,
ACL_REVISION
,
INHERIT_ONLY_ACE
,
KEY_READ
,
EveryoneSid
);
ok
(
ret
,
"AddAccessAllowedAceEx failed with error %d
\n
"
,
GetLastError
());
ret
=
AccessCheck
(
SecurityDescriptor
,
Token
,
KEY_READ
,
&
Mapping
,
...
...
@@ -1165,7 +1174,7 @@ static void test_CreateWellKnownSid()
ok
(
pCreateWellKnownSid
(
i
,
value
->
without_domain
?
NULL
:
domainsid
,
sid_buffer
,
&
cb
),
"Couldn't create well known sid %d
\n
"
,
i
);
expect_eq
(
GetSidLengthRequired
(
*
GetSidSubAuthorityCount
(
sid_buffer
)),
cb
,
DWORD
,
"%d"
);
ok
(
IsValidSid
(
sid_buffer
),
"The sid is not valid
\n
"
);
ok
(
ConvertSidToStringSid
(
sid_buffer
,
&
str
),
"Couldn't convert SID to string
\n
"
);
ok
(
pConvertSidToStringSidA
(
sid_buffer
,
&
str
),
"Couldn't convert SID to string
\n
"
);
ok
(
strcmp
(
str
,
value
->
sid_string
)
==
0
,
"SID mismatch - expected %s, got %s
\n
"
,
value
->
sid_string
,
str
);
LocalFree
(
str
);
...
...
@@ -1736,7 +1745,7 @@ static void test_process_security(void)
res
=
AddAccessDeniedAce
(
Acl
,
ACL_REVISION
,
PROCESS_VM_READ
,
AdminSid
);
ok
(
res
,
"AddAccessDeniedAce failed with error %d
\n
"
,
GetLastError
());
res
=
AddAccessAllowedAce
(
Acl
,
ACL_REVISION
,
PROCESS_ALL_ACCESS
,
AdminSid
);
ok
(
res
,
"AddAccessAllowedAce
Ex
failed with error %d
\n
"
,
GetLastError
());
ok
(
res
,
"AddAccessAllowedAce failed with error %d
\n
"
,
GetLastError
());
SecurityDescriptor
=
HeapAlloc
(
GetProcessHeap
(),
0
,
SECURITY_DESCRIPTOR_MIN_LENGTH
);
res
=
InitializeSecurityDescriptor
(
SecurityDescriptor
,
SECURITY_DESCRIPTOR_REVISION
);
...
...
@@ -2182,7 +2191,7 @@ static void test_ConvertSecurityDescriptorToString()
ok
(
pConvertSecurityDescriptorToStringSecurityDescriptorA
(
&
desc
,
SDDL_REVISION_1
,
sec_info
,
&
string
,
&
len
),
"Conversion failed
\n
"
);
CHECK_RESULT_AND_FREE
(
"O:SY"
);
ConvertStringSidToSid
(
"S-1-5-21-93476-23408-4576"
,
&
psid
);
pConvertStringSidToSidA
(
"S-1-5-21-93476-23408-4576"
,
&
psid
);
SetSecurityDescriptorGroup
(
&
desc
,
psid
,
TRUE
);
ok
(
pConvertSecurityDescriptorToStringSecurityDescriptorA
(
&
desc
,
SDDL_REVISION_1
,
sec_info
,
&
string
,
&
len
),
"Conversion failed
\n
"
);
CHECK_RESULT_AND_FREE
(
"O:SYG:S-1-5-21-93476-23408-4576"
);
...
...
@@ -2200,16 +2209,16 @@ static void test_ConvertSecurityDescriptorToString()
ok
(
pConvertSecurityDescriptorToStringSecurityDescriptorA
(
&
desc
,
SDDL_REVISION_1
,
sec_info
,
&
string
,
&
len
),
"Conversion failed
\n
"
);
CHECK_RESULT_AND_FREE
(
"O:SYG:S-1-5-21-93476-23408-4576D:"
);
ConvertStringSidToSid
(
"S-1-5-6"
,
&
psid2
);
AddAccessAllowedAceEx
(
pacl
,
ACL_REVISION
,
NO_PROPAGATE_INHERIT_ACE
,
0xf0000000
,
psid2
);
pConvertStringSidToSidA
(
"S-1-5-6"
,
&
psid2
);
p
AddAccessAllowedAceEx
(
pacl
,
ACL_REVISION
,
NO_PROPAGATE_INHERIT_ACE
,
0xf0000000
,
psid2
);
ok
(
pConvertSecurityDescriptorToStringSecurityDescriptorA
(
&
desc
,
SDDL_REVISION_1
,
sec_info
,
&
string
,
&
len
),
"Conversion failed
\n
"
);
CHECK_RESULT_AND_FREE
(
"O:SYG:S-1-5-21-93476-23408-4576D:(A;NP;GAGXGWGR;;;SU)"
);
AddAccessAllowedAceEx
(
pacl
,
ACL_REVISION
,
INHERIT_ONLY_ACE
|
INHERITED_ACE
,
0x00000003
,
psid2
);
p
AddAccessAllowedAceEx
(
pacl
,
ACL_REVISION
,
INHERIT_ONLY_ACE
|
INHERITED_ACE
,
0x00000003
,
psid2
);
ok
(
pConvertSecurityDescriptorToStringSecurityDescriptorA
(
&
desc
,
SDDL_REVISION_1
,
sec_info
,
&
string
,
&
len
),
"Conversion failed
\n
"
);
CHECK_RESULT_AND_FREE
(
"O:SYG:S-1-5-21-93476-23408-4576D:(A;NP;GAGXGWGR;;;SU)(A;IOID;CCDC;;;SU)"
);
AddAccessDeniedAceEx
(
pacl
,
ACL_REVISION
,
OBJECT_INHERIT_ACE
|
CONTAINER_INHERIT_ACE
,
0xffffffff
,
psid
);
p
AddAccessDeniedAceEx
(
pacl
,
ACL_REVISION
,
OBJECT_INHERIT_ACE
|
CONTAINER_INHERIT_ACE
,
0xffffffff
,
psid
);
ok
(
pConvertSecurityDescriptorToStringSecurityDescriptorA
(
&
desc
,
SDDL_REVISION_1
,
sec_info
,
&
string
,
&
len
),
"Conversion failed
\n
"
);
CHECK_RESULT_AND_FREE
(
"O:SYG:S-1-5-21-93476-23408-4576D:(A;NP;GAGXGWGR;;;SU)(A;IOID;CCDC;;;SU)(D;OICI;0xffffffff;;;S-1-5-21-93476-23408-4576)"
);
...
...
@@ -2221,12 +2230,12 @@ static void test_ConvertSecurityDescriptorToString()
CHECK_RESULT_AND_FREE
(
"O:SYG:S-1-5-21-93476-23408-4576D:S:"
);
SetSecurityDescriptorDacl
(
&
desc
,
TRUE
,
NULL
,
FALSE
);
AddAuditAccessAceEx
(
pacl
,
ACL_REVISION
,
VALID_INHERIT_FLAGS
,
KEY_READ
|
KEY_WRITE
,
psid2
,
TRUE
,
TRUE
);
p
AddAuditAccessAceEx
(
pacl
,
ACL_REVISION
,
VALID_INHERIT_FLAGS
,
KEY_READ
|
KEY_WRITE
,
psid2
,
TRUE
,
TRUE
);
ok
(
pConvertSecurityDescriptorToStringSecurityDescriptorA
(
&
desc
,
SDDL_REVISION_1
,
sec_info
,
&
string
,
&
len
),
"Conversion failed
\n
"
);
CHECK_ONE_OF_AND_FREE
(
"O:SYG:S-1-5-21-93476-23408-4576D:S:(AU;OICINPIOIDSAFA;CCDCLCSWRPRC;;;SU)"
,
/* XP */
"O:SYG:S-1-5-21-93476-23408-4576D:NO_ACCESS_CONTROLS:(AU;OICINPIOIDSAFA;CCDCLCSWRPRC;;;SU)"
/* Vista */
);
AddAuditAccessAceEx
(
pacl
,
ACL_REVISION
,
NO_PROPAGATE_INHERIT_ACE
,
FILE_GENERIC_READ
|
FILE_GENERIC_WRITE
,
psid2
,
TRUE
,
FALSE
);
p
AddAuditAccessAceEx
(
pacl
,
ACL_REVISION
,
NO_PROPAGATE_INHERIT_ACE
,
FILE_GENERIC_READ
|
FILE_GENERIC_WRITE
,
psid2
,
TRUE
,
FALSE
);
ok
(
pConvertSecurityDescriptorToStringSecurityDescriptorA
(
&
desc
,
SDDL_REVISION_1
,
sec_info
,
&
string
,
&
len
),
"Conversion failed
\n
"
);
CHECK_ONE_OF_AND_FREE
(
"O:SYG:S-1-5-21-93476-23408-4576D:S:(AU;OICINPIOIDSAFA;CCDCLCSWRPRC;;;SU)(AU;NPSA;0x12019f;;;SU)"
,
/* XP */
"O:SYG:S-1-5-21-93476-23408-4576D:NO_ACCESS_CONTROLS:(AU;OICINPIOIDSAFA;CCDCLCSWRPRC;;;SU)(AU;NPSA;0x12019f;;;SU)"
/* Vista */
);
...
...
@@ -2244,13 +2253,13 @@ static void test_PrivateObjectSecurity(void)
ULONG
len
;
PSECURITY_DESCRIPTOR
buf
;
ok
(
ConvertStringSecurityDescriptorToSecurityDescriptorA
(
ok
(
p
ConvertStringSecurityDescriptorToSecurityDescriptorA
(
"O:SY"
"G:S-1-5-21-93476-23408-4576"
"D:(A;NP;GAGXGWGR;;;SU)(A;IOID;CCDC;;;SU)(D;OICI;0xffffffff;;;S-1-5-21-93476-23408-4576)"
"S:(AU;OICINPIOIDSAFA;CCDCLCSWRPRC;;;SU)(AU;NPSA;0x12019f;;;SU)"
,
SDDL_REVISION_1
,
&
sec
,
&
dwDescSize
),
"Creating descriptor failed
\n
"
);
buf
=
HeapAlloc
(
GetProcessHeap
(),
0
,
dwDescSize
);
SetSecurityDescriptorControl
(
sec
,
SE_DACL_PROTECTED
,
SE_DACL_PROTECTED
);
p
SetSecurityDescriptorControl
(
sec
,
SE_DACL_PROTECTED
,
SE_DACL_PROTECTED
);
GetSecurityDescriptorControl
(
sec
,
&
ctrl
,
&
dwRevision
);
todo_wine
expect_eq
(
ctrl
,
0x9014
,
int
,
"%x"
);
...
...
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