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
5851032d
Commit
5851032d
authored
Nov 26, 2012
by
Erich Hoover
Committed by
Alexandre Julliard
Nov 28, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi: Implement SetNamedSecurityInfoW on top of SetSecurityInfo.
parent
639a42a8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
4 deletions
+47
-4
security.c
dlls/advapi32/security.c
+34
-2
security.c
dlls/advapi32/tests/security.c
+13
-2
No files found.
dlls/advapi32/security.c
View file @
5851032d
...
...
@@ -3919,9 +3919,41 @@ DWORD WINAPI SetNamedSecurityInfoW(LPWSTR pObjectName,
SE_OBJECT_TYPE
ObjectType
,
SECURITY_INFORMATION
SecurityInfo
,
PSID
psidOwner
,
PSID
psidGroup
,
PACL
pDacl
,
PACL
pSacl
)
{
FIXME
(
"%s %d %d %p %p %p %p
\n
"
,
debugstr_w
(
pObjectName
),
ObjectType
,
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
nameW
;
IO_STATUS_BLOCK
io
;
DWORD
access
=
0
;
HANDLE
hFile
;
DWORD
status
;
TRACE
(
"%s %d %d %p %p %p %p
\n
"
,
debugstr_w
(
pObjectName
),
ObjectType
,
SecurityInfo
,
psidOwner
,
psidGroup
,
pDacl
,
pSacl
);
return
ERROR_SUCCESS
;
if
(
!
pObjectName
)
return
ERROR_INVALID_PARAMETER
;
if
(
!
RtlDosPathNameToNtPathName_U
(
pObjectName
,
&
nameW
,
NULL
,
NULL
))
return
ERROR_PATH_NOT_FOUND
;
if
(
SecurityInfo
&
(
OWNER_SECURITY_INFORMATION
|
GROUP_SECURITY_INFORMATION
))
access
|=
WRITE_OWNER
;
if
(
SecurityInfo
&
DACL_SECURITY_INFORMATION
)
access
|=
WRITE_DAC
;
if
(
SecurityInfo
&
SACL_SECURITY_INFORMATION
)
access
|=
ACCESS_SYSTEM_SECURITY
;
attr
.
Length
=
sizeof
(
attr
);
attr
.
RootDirectory
=
0
;
attr
.
Attributes
=
OBJ_CASE_INSENSITIVE
;
attr
.
ObjectName
=
&
nameW
;
attr
.
SecurityDescriptor
=
NULL
;
status
=
NtCreateFile
(
&
hFile
,
access
,
&
attr
,
&
io
,
NULL
,
FILE_FLAG_BACKUP_SEMANTICS
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
|
FILE_SHARE_DELETE
,
FILE_OPEN
,
FILE_OPEN_FOR_BACKUP_INTENT
,
NULL
,
0
);
RtlFreeUnicodeString
(
&
nameW
);
if
(
status
!=
STATUS_SUCCESS
)
return
RtlNtStatusToDosError
(
status
);
status
=
SetSecurityInfo
(
hFile
,
ObjectType
,
SecurityInfo
,
psidOwner
,
psidGroup
,
pDacl
,
pSacl
);
CloseHandle
(
hFile
);
return
status
;
}
/******************************************************************************
...
...
dlls/advapi32/tests/security.c
View file @
5851032d
...
...
@@ -101,6 +101,8 @@ static BOOL (WINAPI *pSetFileSecurityA)(LPCSTR, SECURITY_INFORMATION,
static
DWORD
(
WINAPI
*
pGetNamedSecurityInfoA
)(
LPSTR
,
SE_OBJECT_TYPE
,
SECURITY_INFORMATION
,
PSID
*
,
PSID
*
,
PACL
*
,
PACL
*
,
PSECURITY_DESCRIPTOR
*
);
static
DWORD
(
WINAPI
*
pSetNamedSecurityInfoA
)(
LPTSTR
,
SE_OBJECT_TYPE
,
SECURITY_INFORMATION
,
PSID
,
PSID
,
PACL
,
PACL
);
static
PDWORD
(
WINAPI
*
pGetSidSubAuthority
)(
PSID
,
DWORD
);
static
PUCHAR
(
WINAPI
*
pGetSidSubAuthorityCount
)(
PSID
);
static
BOOL
(
WINAPI
*
pIsValidSid
)(
PSID
);
...
...
@@ -170,6 +172,7 @@ static void init(void)
pSetFileSecurityA
=
(
void
*
)
GetProcAddress
(
hmod
,
"SetFileSecurityA"
);
pCreateWellKnownSid
=
(
void
*
)
GetProcAddress
(
hmod
,
"CreateWellKnownSid"
);
pGetNamedSecurityInfoA
=
(
void
*
)
GetProcAddress
(
hmod
,
"GetNamedSecurityInfoA"
);
pSetNamedSecurityInfoA
=
(
void
*
)
GetProcAddress
(
hmod
,
"SetNamedSecurityInfoA"
);
pGetSidSubAuthority
=
(
void
*
)
GetProcAddress
(
hmod
,
"GetSidSubAuthority"
);
pGetSidSubAuthorityCount
=
(
void
*
)
GetProcAddress
(
hmod
,
"GetSidSubAuthorityCount"
);
pIsValidSid
=
(
void
*
)
GetProcAddress
(
hmod
,
"IsValidSid"
);
...
...
@@ -3002,6 +3005,7 @@ static void test_SetEntriesInAclA(void)
static
void
test_GetNamedSecurityInfoA
(
void
)
{
char
invalid_path
[]
=
"/an invalid file path"
;
PSECURITY_DESCRIPTOR
pSecDesc
;
DWORD
revision
;
SECURITY_DESCRIPTOR_CONTROL
control
;
...
...
@@ -3014,9 +3018,9 @@ static void test_GetNamedSecurityInfoA(void)
BOOL
ret
,
isNT4
;
CHAR
windows_dir
[
MAX_PATH
];
if
(
!
pGetNamedSecurityInfoA
)
if
(
!
pGetNamedSecurityInfoA
||
!
pSetNamedSecurityInfoA
)
{
win_skip
(
"
Get
NamedSecurityInfoA is not available
\n
"
);
win_skip
(
"
[Get|Set]
NamedSecurityInfoA is not available
\n
"
);
return
;
}
...
...
@@ -3072,6 +3076,13 @@ static void test_GetNamedSecurityInfoA(void)
error
=
pGetNamedSecurityInfoA
(
windows_dir
,
SE_FILE_OBJECT
,
OWNER_SECURITY_INFORMATION
,
NULL
,
NULL
,
&
dacl
,
NULL
,
NULL
);
ok
(
error
==
ERROR_INVALID_PARAMETER
,
"GetNamedSecurityInfo failed with error %d
\n
"
,
error
);
/* Test behavior of SetNamedSecurityInfo with an invalid path */
SetLastError
(
0xdeadbeef
);
error
=
pSetNamedSecurityInfoA
(
invalid_path
,
SE_FILE_OBJECT
,
DACL_SECURITY_INFORMATION
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
error
==
ERROR_FILE_NOT_FOUND
,
"Unexpected error returned: 0x%x
\n
"
,
error
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"Expected last error to remain unchanged.
\n
"
);
}
static
void
test_ConvertStringSecurityDescriptor
(
void
)
...
...
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