mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 07:05:42 +00:00
[FASTFAT] On file overwrite, deny it if file as HIDDEN/SYSTEM flag and caller doesn't set them.
CORE-14158
This commit is contained in:
parent
c4d6c2c3f1
commit
f3fecf92c1
1 changed files with 11 additions and 2 deletions
|
@ -728,6 +728,8 @@ VfatCreateFile(
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Attributes = Stack->Parameters.Create.FileAttributes & ~FILE_ATTRIBUTE_NORMAL;
|
||||||
|
|
||||||
/* If the file open failed then create the required file */
|
/* If the file open failed then create the required file */
|
||||||
if (!NT_SUCCESS (Status))
|
if (!NT_SUCCESS (Status))
|
||||||
{
|
{
|
||||||
|
@ -736,7 +738,6 @@ VfatCreateFile(
|
||||||
RequestedDisposition == FILE_OVERWRITE_IF ||
|
RequestedDisposition == FILE_OVERWRITE_IF ||
|
||||||
RequestedDisposition == FILE_SUPERSEDE)
|
RequestedDisposition == FILE_SUPERSEDE)
|
||||||
{
|
{
|
||||||
Attributes = Stack->Parameters.Create.FileAttributes & ~FILE_ATTRIBUTE_NORMAL;
|
|
||||||
if (!BooleanFlagOn(RequestedOptions, FILE_DIRECTORY_FILE))
|
if (!BooleanFlagOn(RequestedOptions, FILE_DIRECTORY_FILE))
|
||||||
{
|
{
|
||||||
if (TrailingBackslash)
|
if (TrailingBackslash)
|
||||||
|
@ -908,9 +909,17 @@ VfatCreateFile(
|
||||||
RequestedDisposition == FILE_OVERWRITE_IF ||
|
RequestedDisposition == FILE_OVERWRITE_IF ||
|
||||||
RequestedDisposition == FILE_SUPERSEDE)
|
RequestedDisposition == FILE_SUPERSEDE)
|
||||||
{
|
{
|
||||||
|
if ((BooleanFlagOn(*pFcb->Attributes, FILE_ATTRIBUTE_HIDDEN) && !BooleanFlagOn(Attributes, FILE_ATTRIBUTE_HIDDEN)) ||
|
||||||
|
(BooleanFlagOn(*pFcb->Attributes, FILE_ATTRIBUTE_SYSTEM) && !BooleanFlagOn(Attributes, FILE_ATTRIBUTE_SYSTEM)))
|
||||||
|
{
|
||||||
|
VfatCloseFile(DeviceExt, FileObject);
|
||||||
|
vfatAddToStat(DeviceExt, Fat.FailedCreates, 1);
|
||||||
|
return STATUS_ACCESS_DENIED;
|
||||||
|
}
|
||||||
|
|
||||||
if (!vfatFCBIsDirectory(pFcb))
|
if (!vfatFCBIsDirectory(pFcb))
|
||||||
{
|
{
|
||||||
*pFcb->Attributes = Stack->Parameters.Create.FileAttributes & ~FILE_ATTRIBUTE_NORMAL;
|
*pFcb->Attributes = Attributes & ~FILE_ATTRIBUTE_NORMAL;
|
||||||
*pFcb->Attributes |= FILE_ATTRIBUTE_ARCHIVE;
|
*pFcb->Attributes |= FILE_ATTRIBUTE_ARCHIVE;
|
||||||
VfatUpdateEntry(pFcb, vfatVolumeIsFatX(DeviceExt));
|
VfatUpdateEntry(pFcb, vfatVolumeIsFatX(DeviceExt));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue