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
3198809f
Commit
3198809f
authored
Sep 25, 2007
by
Mikolaj Zalewski
Committed by
Alexandre Julliard
Sep 26, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi32: Implement ConvertSecurityDescriptorToStringSecurityDescriptor[AW].
parent
f6060557
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
103 additions
and
2 deletions
+103
-2
advapi32.spec
dlls/advapi32/advapi32.spec
+2
-2
security.c
dlls/advapi32/security.c
+0
-0
security.c
dlls/advapi32/tests/security.c
+101
-0
No files found.
dlls/advapi32/advapi32.spec
View file @
3198809f
...
...
@@ -75,8 +75,8 @@
# @ stub ConvertSecurityDescriptorToAccessNamedA
# @ stub ConvertSecurityDescriptorToAccessNamedW
# @ stub ConvertSecurityDescriptorToAccessW
# @ stub ConvertSecurityDescriptorToStringSecurityDescriptorA
# @ stub ConvertSecurityDescriptorToStringSecurityDescriptorW
@ stdcall ConvertSecurityDescriptorToStringSecurityDescriptorA(ptr long long ptr ptr)
@ stdcall ConvertSecurityDescriptorToStringSecurityDescriptorW(ptr long long ptr ptr)
@ stdcall ConvertSidToStringSidA(ptr ptr)
@ stdcall ConvertSidToStringSidW(ptr ptr)
# @ stub ConvertStringSDToSDDomainA
...
...
dlls/advapi32/security.c
View file @
3198809f
This diff is collapsed.
Click to expand it.
dlls/advapi32/tests/security.c
View file @
3198809f
...
...
@@ -53,6 +53,8 @@ typedef BOOL (WINAPI *fnConvertSidToStringSidA)( PSID pSid, LPSTR *str );
typedef
BOOL
(
WINAPI
*
fnConvertStringSidToSidA
)(
LPCSTR
str
,
PSID
pSid
);
static
BOOL
(
WINAPI
*
pConvertStringSecurityDescriptorToSecurityDescriptorA
)(
LPCSTR
,
DWORD
,
PSECURITY_DESCRIPTOR
*
,
PULONG
);
static
BOOL
(
WINAPI
*
pConvertSecurityDescriptorToStringSecurityDescriptorA
)(
PSECURITY_DESCRIPTOR
,
DWORD
,
SECURITY_INFORMATION
,
LPSTR
*
,
PULONG
);
typedef
BOOL
(
WINAPI
*
fnGetFileSecurityA
)(
LPCSTR
,
SECURITY_INFORMATION
,
PSECURITY_DESCRIPTOR
,
DWORD
,
LPDWORD
);
static
DWORD
(
WINAPI
*
pGetNamedSecurityInfoA
)(
LPSTR
,
SE_OBJECT_TYPE
,
SECURITY_INFORMATION
,
...
...
@@ -106,6 +108,8 @@ static void init(void)
hmod
=
GetModuleHandle
(
"advapi32.dll"
);
pConvertStringSecurityDescriptorToSecurityDescriptorA
=
(
void
*
)
GetProcAddress
(
hmod
,
"ConvertStringSecurityDescriptorToSecurityDescriptorA"
);
pConvertSecurityDescriptorToStringSecurityDescriptorA
=
(
void
*
)
GetProcAddress
(
hmod
,
"ConvertSecurityDescriptorToStringSecurityDescriptorA"
);
pGetNamedSecurityInfoA
=
(
void
*
)
GetProcAddress
(
hmod
,
"GetNamedSecurityInfoA"
);
pSetEntriesInAclW
=
(
void
*
)
GetProcAddress
(
hmod
,
"SetEntriesInAclW"
);
...
...
@@ -1899,6 +1903,102 @@ static void test_ConvertStringSecurityDescriptor(void)
GetLastError
());
}
static
void
test_ConvertSecurityDescriptorToString
()
{
SECURITY_DESCRIPTOR
desc
;
SECURITY_INFORMATION
sec_info
=
OWNER_SECURITY_INFORMATION
|
GROUP_SECURITY_INFORMATION
|
DACL_SECURITY_INFORMATION
|
SACL_SECURITY_INFORMATION
;
LPSTR
string
;
DWORD
size
;
PSID
psid
,
psid2
;
PACL
pacl
;
char
sid_buf
[
256
];
char
acl_buf
[
8192
];
ULONG
len
;
if
(
!
pConvertSecurityDescriptorToStringSecurityDescriptorA
)
{
skip
(
"ConvertSecurityDescriptorToStringSecurityDescriptor is not available
\n
"
);
return
;
}
/* It seems Windows XP add an extra character to the length of the string for each ACE in an ACL. We
* don't replicate this feature so we only test len >= strlen+1. */
#define CHECK_RESULT_AND_FREE(exp_str) \
ok(strcmp(string, (exp_str)) == 0, "String mismatch (expected \"%s\", got \"%s\")\n", (exp_str), string); \
ok(len >= (strlen(exp_str) + 1), "Length mismatch (expected %d, got %d)\n", strlen(exp_str) + 1, len); \
LocalFree(string);
InitializeSecurityDescriptor
(
&
desc
,
SECURITY_DESCRIPTOR_REVISION
);
ok
(
pConvertSecurityDescriptorToStringSecurityDescriptorA
(
&
desc
,
SDDL_REVISION_1
,
sec_info
,
&
string
,
&
len
),
"Convertion failed
\n
"
);
CHECK_RESULT_AND_FREE
(
""
);
size
=
4096
;
CreateWellKnownSid
(
WinLocalSid
,
NULL
,
sid_buf
,
&
size
);
SetSecurityDescriptorOwner
(
&
desc
,
(
PSID
)
sid_buf
,
FALSE
);
ok
(
pConvertSecurityDescriptorToStringSecurityDescriptorA
(
&
desc
,
SDDL_REVISION_1
,
sec_info
,
&
string
,
&
len
),
"Convertion failed
\n
"
);
CHECK_RESULT_AND_FREE
(
"O:S-1-2-0"
);
SetSecurityDescriptorOwner
(
&
desc
,
(
PSID
)
sid_buf
,
TRUE
);
ok
(
pConvertSecurityDescriptorToStringSecurityDescriptorA
(
&
desc
,
SDDL_REVISION_1
,
sec_info
,
&
string
,
&
len
),
"Convertion failed
\n
"
);
CHECK_RESULT_AND_FREE
(
"O:S-1-2-0"
);
size
=
sizeof
(
sid_buf
);
CreateWellKnownSid
(
WinLocalSystemSid
,
NULL
,
sid_buf
,
&
size
);
SetSecurityDescriptorOwner
(
&
desc
,
(
PSID
)
sid_buf
,
TRUE
);
ok
(
pConvertSecurityDescriptorToStringSecurityDescriptorA
(
&
desc
,
SDDL_REVISION_1
,
sec_info
,
&
string
,
&
len
),
"Convertion failed
\n
"
);
CHECK_RESULT_AND_FREE
(
"O:SY"
);
ConvertStringSidToSid
(
"S-1-5-21-93476-23408-4576"
,
&
psid
);
SetSecurityDescriptorGroup
(
&
desc
,
psid
,
TRUE
);
ok
(
pConvertSecurityDescriptorToStringSecurityDescriptorA
(
&
desc
,
SDDL_REVISION_1
,
sec_info
,
&
string
,
&
len
),
"Convertion failed
\n
"
);
CHECK_RESULT_AND_FREE
(
"O:SYG:S-1-5-21-93476-23408-4576"
);
ok
(
pConvertSecurityDescriptorToStringSecurityDescriptorA
(
&
desc
,
SDDL_REVISION_1
,
GROUP_SECURITY_INFORMATION
,
&
string
,
&
len
),
"Convertion failed
\n
"
);
CHECK_RESULT_AND_FREE
(
"G:S-1-5-21-93476-23408-4576"
);
pacl
=
(
PACL
)
acl_buf
;
InitializeAcl
(
pacl
,
sizeof
(
acl_buf
),
ACL_REVISION
);
SetSecurityDescriptorDacl
(
&
desc
,
TRUE
,
pacl
,
TRUE
);
ok
(
pConvertSecurityDescriptorToStringSecurityDescriptorA
(
&
desc
,
SDDL_REVISION_1
,
sec_info
,
&
string
,
&
len
),
"Convertion failed
\n
"
);
CHECK_RESULT_AND_FREE
(
"O:SYG:S-1-5-21-93476-23408-4576D:"
);
SetSecurityDescriptorDacl
(
&
desc
,
TRUE
,
pacl
,
FALSE
);
ok
(
pConvertSecurityDescriptorToStringSecurityDescriptorA
(
&
desc
,
SDDL_REVISION_1
,
sec_info
,
&
string
,
&
len
),
"Convertion 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
);
ok
(
pConvertSecurityDescriptorToStringSecurityDescriptorA
(
&
desc
,
SDDL_REVISION_1
,
sec_info
,
&
string
,
&
len
),
"Convertion 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
);
ok
(
pConvertSecurityDescriptorToStringSecurityDescriptorA
(
&
desc
,
SDDL_REVISION_1
,
sec_info
,
&
string
,
&
len
),
"Convertion 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
);
ok
(
pConvertSecurityDescriptorToStringSecurityDescriptorA
(
&
desc
,
SDDL_REVISION_1
,
sec_info
,
&
string
,
&
len
),
"Convertion 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)"
);
pacl
=
(
PACL
)
acl_buf
;
InitializeAcl
(
pacl
,
sizeof
(
acl_buf
),
ACL_REVISION
);
SetSecurityDescriptorSacl
(
&
desc
,
TRUE
,
pacl
,
FALSE
);
ok
(
pConvertSecurityDescriptorToStringSecurityDescriptorA
(
&
desc
,
SDDL_REVISION_1
,
sec_info
,
&
string
,
&
len
),
"Convertion failed
\n
"
);
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
);
ok
(
pConvertSecurityDescriptorToStringSecurityDescriptorA
(
&
desc
,
SDDL_REVISION_1
,
sec_info
,
&
string
,
&
len
),
"Convertion failed
\n
"
);
CHECK_RESULT_AND_FREE
(
"O:SYG:S-1-5-21-93476-23408-4576D:S:(AU;OICINPIOIDSAFA;CCDCLCSWRPRC;;;SU)"
);
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
),
"Convertion failed
\n
"
);
CHECK_RESULT_AND_FREE
(
"O:SYG:S-1-5-21-93476-23408-4576D:S:(AU;OICINPIOIDSAFA;CCDCLCSWRPRC;;;SU)(AU;NPSA;0x12019f;;;SU)"
);
#undef CHECK_RESULT_AND_FREE
}
START_TEST
(
security
)
{
init
();
...
...
@@ -1922,4 +2022,5 @@ START_TEST(security)
test_SetEntriesInAcl
();
test_GetNamedSecurityInfoA
();
test_ConvertStringSecurityDescriptor
();
test_ConvertSecurityDescriptorToString
();
}
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