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
f956bb4c
Commit
f956bb4c
authored
Mar 27, 2015
by
Piotr Caban
Committed by
Alexandre Julliard
Mar 27, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
advapi: Don't use CreateFile when opening file with possibly empty DACL.
parent
f630fb4f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
security.c
dlls/advapi32/security.c
+13
-9
No files found.
dlls/advapi32/security.c
View file @
f956bb4c
...
...
@@ -397,7 +397,7 @@ static inline BOOL set_ntstatus( NTSTATUS status )
}
/* helper function for SE_FILE_OBJECT objects in [Get|Set]NamedSecurityInfo */
static
inline
DWORD
get_security_file
(
LPWSTR
full_file_name
,
DWORD
access
,
HANDLE
*
file
)
static
inline
DWORD
get_security_file
(
LP
C
WSTR
full_file_name
,
DWORD
access
,
HANDLE
*
file
)
{
UNICODE_STRING
file_nameW
;
OBJECT_ATTRIBUTES
attr
;
...
...
@@ -2029,7 +2029,7 @@ GetFileSecurityW( LPCWSTR lpFileName,
{
HANDLE
hfile
;
NTSTATUS
status
;
DWORD
access
=
0
;
DWORD
access
=
0
,
err
;
TRACE
(
"(%s,%d,%p,%d,%p)
\n
"
,
debugstr_w
(
lpFileName
),
RequestedInformation
,
pSecurityDescriptor
,
...
...
@@ -2041,10 +2041,12 @@ GetFileSecurityW( LPCWSTR lpFileName,
if
(
RequestedInformation
&
SACL_SECURITY_INFORMATION
)
access
|=
ACCESS_SYSTEM_SECURITY
;
hfile
=
CreateFileW
(
lpFileName
,
access
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
|
FILE_SHARE_DELETE
,
NULL
,
OPEN_EXISTING
,
FILE_FLAG_BACKUP_SEMANTICS
,
0
);
if
(
hfile
==
INVALID_HANDLE_VALUE
)
err
=
get_security_file
(
lpFileName
,
access
,
&
hfile
);
if
(
err
)
{
SetLastError
(
err
);
return
FALSE
;
}
status
=
NtQuerySecurityObject
(
hfile
,
RequestedInformation
,
pSecurityDescriptor
,
nLength
,
lpnLengthNeeded
);
...
...
@@ -2325,7 +2327,7 @@ SetFileSecurityW( LPCWSTR lpFileName,
PSECURITY_DESCRIPTOR
pSecurityDescriptor
)
{
HANDLE
file
;
DWORD
access
=
0
;
DWORD
access
=
0
,
err
;
NTSTATUS
status
;
TRACE
(
"(%s, 0x%x, %p)
\n
"
,
debugstr_w
(
lpFileName
),
RequestedInformation
,
...
...
@@ -2339,10 +2341,12 @@ SetFileSecurityW( LPCWSTR lpFileName,
if
(
RequestedInformation
&
DACL_SECURITY_INFORMATION
)
access
|=
WRITE_DAC
;
file
=
CreateFileW
(
lpFileName
,
access
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
|
FILE_SHARE_DELETE
,
NULL
,
OPEN_EXISTING
,
FILE_FLAG_BACKUP_SEMANTICS
,
NULL
);
if
(
file
==
INVALID_HANDLE_VALUE
)
err
=
get_security_file
(
lpFileName
,
access
,
&
file
);
if
(
err
)
{
SetLastError
(
err
);
return
FALSE
;
}
status
=
NtSetSecurityObject
(
file
,
RequestedInformation
,
pSecurityDescriptor
);
CloseHandle
(
file
);
...
...
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