mirror of
https://github.com/winfsp/winfsp.git
synced 2025-06-08 04:52:10 -05:00
sys: IRP_MJ_CREATE: root directory check
This commit is contained in:
parent
3c80e25614
commit
4fce03c636
@ -99,6 +99,7 @@ static NTSTATUS FspFsvolCreate(
|
|||||||
}
|
}
|
||||||
|
|
||||||
PACCESS_STATE AccessState = IrpSp->Parameters.Create.SecurityContext->AccessState;
|
PACCESS_STATE AccessState = IrpSp->Parameters.Create.SecurityContext->AccessState;
|
||||||
|
ULONG CreateDisposition = (IrpSp->Parameters.Create.Options >> 24) & 0xff;
|
||||||
ULONG CreateOptions = IrpSp->Parameters.Create.Options;
|
ULONG CreateOptions = IrpSp->Parameters.Create.Options;
|
||||||
USHORT FileAttributes = IrpSp->Parameters.Create.FileAttributes;
|
USHORT FileAttributes = IrpSp->Parameters.Create.FileAttributes;
|
||||||
PSECURITY_DESCRIPTOR SecurityDescriptor = AccessState->SecurityDescriptor;
|
PSECURITY_DESCRIPTOR SecurityDescriptor = AccessState->SecurityDescriptor;
|
||||||
@ -194,6 +195,14 @@ static NTSTATUS FspFsvolCreate(
|
|||||||
if (sizeof(WCHAR) <= FileName.Length && L'\\' == FileName.Buffer[0])
|
if (sizeof(WCHAR) <= FileName.Length && L'\\' == FileName.Buffer[0])
|
||||||
return STATUS_OBJECT_NAME_INVALID;
|
return STATUS_OBJECT_NAME_INVALID;
|
||||||
|
|
||||||
|
/* not all operations allowed on the root directory */
|
||||||
|
if ((FILE_CREATE == CreateDisposition ||
|
||||||
|
FILE_OVERWRITE == CreateDisposition ||
|
||||||
|
FILE_SUPERSEDE == CreateDisposition ||
|
||||||
|
BooleanFlagOn(Flags, SL_OPEN_TARGET_DIRECTORY)) &&
|
||||||
|
sizeof(WCHAR) == RelatedFsContext->FileName.Length && 0 == FileName.Length)
|
||||||
|
return STATUS_ACCESS_DENIED;
|
||||||
|
|
||||||
/* cannot FILE_DELETE_ON_CLOSE on the root directory */
|
/* cannot FILE_DELETE_ON_CLOSE on the root directory */
|
||||||
if (FlagOn(CreateOptions, FILE_DELETE_ON_CLOSE) &&
|
if (FlagOn(CreateOptions, FILE_DELETE_ON_CLOSE) &&
|
||||||
sizeof(WCHAR) == RelatedFsContext->FileName.Length && 0 == FileName.Length)
|
sizeof(WCHAR) == RelatedFsContext->FileName.Length && 0 == FileName.Length)
|
||||||
@ -228,6 +237,14 @@ static NTSTATUS FspFsvolCreate(
|
|||||||
if (sizeof(WCHAR) <= FileName.Length && L'\\' != FileName.Buffer[0])
|
if (sizeof(WCHAR) <= FileName.Length && L'\\' != FileName.Buffer[0])
|
||||||
return STATUS_OBJECT_NAME_INVALID;
|
return STATUS_OBJECT_NAME_INVALID;
|
||||||
|
|
||||||
|
/* not all operations allowed on the root directory */
|
||||||
|
if ((FILE_CREATE == CreateDisposition ||
|
||||||
|
FILE_OVERWRITE == CreateDisposition ||
|
||||||
|
FILE_SUPERSEDE == CreateDisposition ||
|
||||||
|
BooleanFlagOn(Flags, SL_OPEN_TARGET_DIRECTORY)) &&
|
||||||
|
sizeof(WCHAR) == FileName.Length)
|
||||||
|
return STATUS_ACCESS_DENIED;
|
||||||
|
|
||||||
/* cannot FILE_DELETE_ON_CLOSE on the root directory */
|
/* cannot FILE_DELETE_ON_CLOSE on the root directory */
|
||||||
if (FlagOn(CreateOptions, FILE_DELETE_ON_CLOSE) &&
|
if (FlagOn(CreateOptions, FILE_DELETE_ON_CLOSE) &&
|
||||||
sizeof(WCHAR) == FileName.Length)
|
sizeof(WCHAR) == FileName.Length)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user