Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
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
Aleksandr Isakov
wine-fonts
Commits
6955a298
Commit
6955a298
authored
Aug 19, 2015
by
Erich E. Hoover
Committed by
Alexandre Julliard
Aug 19, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Do not permit FileDispositionInformation to delete a file without write access.
parent
0fabfe7d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
file.c
dlls/ntdll/tests/file.c
+14
-0
fd.c
server/fd.c
+7
-0
No files found.
dlls/ntdll/tests/file.c
View file @
6955a298
...
...
@@ -1507,6 +1507,20 @@ static void test_file_disposition_information(void)
/* cannot set disposition on readonly file */
GetTempFileNameA
(
tmp_path
,
"dis"
,
0
,
buffer
);
DeleteFileA
(
buffer
);
handle
=
CreateFileA
(
buffer
,
GENERIC_WRITE
|
DELETE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_READONLY
,
0
);
ok
(
handle
!=
INVALID_HANDLE_VALUE
,
"failed to create temp file
\n
"
);
fdi
.
DoDeleteFile
=
TRUE
;
res
=
pNtSetInformationFile
(
handle
,
&
io
,
&
fdi
,
sizeof
fdi
,
FileDispositionInformation
);
ok
(
res
==
STATUS_CANNOT_DELETE
,
"unexpected FileDispositionInformation result (expected STATUS_CANNOT_DELETE, got %x)
\n
"
,
res
);
CloseHandle
(
handle
);
fileDeleted
=
GetFileAttributesA
(
buffer
)
==
INVALID_FILE_ATTRIBUTES
&&
GetLastError
()
==
ERROR_FILE_NOT_FOUND
;
ok
(
!
fileDeleted
,
"File shouldn't have been deleted
\n
"
);
SetFileAttributesA
(
buffer
,
FILE_ATTRIBUTE_NORMAL
);
DeleteFileA
(
buffer
);
/* cannot set disposition on readonly file */
GetTempFileNameA
(
tmp_path
,
"dis"
,
0
,
buffer
);
handle
=
CreateFileA
(
buffer
,
GENERIC_WRITE
|
DELETE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_READONLY
,
0
);
ok
(
handle
!=
INVALID_HANDLE_VALUE
,
"failed to create temp file
\n
"
);
fdi
.
DoDeleteFile
=
TRUE
;
...
...
server/fd.c
View file @
6955a298
...
...
@@ -2244,6 +2244,13 @@ static void set_fd_disposition( struct fd *fd, int unlink )
return
;
}
/* can't unlink files we don't have permission to access */
if
(
unlink
&&
!
(
st
.
st_mode
&
(
S_IWUSR
|
S_IWGRP
|
S_IWOTH
)))
{
set_error
(
STATUS_CANNOT_DELETE
);
return
;
}
fd
->
closed
->
unlink
=
unlink
||
(
fd
->
options
&
FILE_DELETE_ON_CLOSE
);
}
...
...
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