checking parameters on open
based on MS-FSA document there are a few checks we should do on open that we didn't before.
This commit is contained in:
parent
dd611ff0cd
commit
24781aa472
1 changed files with 35 additions and 8 deletions
|
|
@ -3282,6 +3282,27 @@ BOOLEAN isFilenameTooLong(
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOLEAN areOpenParamsValid(NT_CREATE_PARAMETERS *params)
|
||||||
|
{
|
||||||
|
/* from ms-fsa page 52 */
|
||||||
|
if ((params->CreateOptions & FILE_DELETE_ON_CLOSE) &&
|
||||||
|
!(params->DesiredAccess & DELETE))
|
||||||
|
return FALSE;
|
||||||
|
if ((params->CreateOptions & FILE_DIRECTORY_FILE) &&
|
||||||
|
(params->Disposition == FILE_SUPERSEDE ||
|
||||||
|
params->Disposition == FILE_OVERWRITE ||
|
||||||
|
params->Disposition == FILE_OVERWRITE_IF))
|
||||||
|
return FALSE;
|
||||||
|
if ((params->CreateOptions & FILE_NO_INTERMEDIATE_BUFFERING) &&
|
||||||
|
(params->DesiredAccess & FILE_APPEND_DATA))
|
||||||
|
return FALSE;
|
||||||
|
/* from ms-fsa 3.1.5.1.1 page 56 */
|
||||||
|
if ((params->CreateOptions & FILE_DIRECTORY_FILE) &&
|
||||||
|
(params->FileAttributes & FILE_ATTRIBUTE_TEMPORARY))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
NTSTATUS map_open_errors(
|
NTSTATUS map_open_errors(
|
||||||
DWORD status,
|
DWORD status,
|
||||||
USHORT len)
|
USHORT len)
|
||||||
|
|
@ -3386,10 +3407,10 @@ NTSTATUS nfs41_Create(
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pVNetRootContext->read_only &&
|
if ((pVNetRootContext->read_only ||
|
||||||
((params.DesiredAccess & FILE_WRITE_DATA) ||
|
((params.FileAttributes & FILE_ATTRIBUTE_READONLY) &&
|
||||||
(params.DesiredAccess & FILE_APPEND_DATA))) {
|
params.Disposition == FILE_OPEN)) &&
|
||||||
DbgP("Read-only mount\n");
|
(params.DesiredAccess & (FILE_WRITE_DATA | FILE_APPEND_DATA))) {
|
||||||
status = STATUS_ACCESS_DENIED;
|
status = STATUS_ACCESS_DENIED;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
@ -3410,12 +3431,18 @@ NTSTATUS nfs41_Create(
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params.Disposition == FILE_OPEN &&
|
if (!areOpenParamsValid(¶ms)) {
|
||||||
(params.FileAttributes & FILE_ATTRIBUTE_READONLY) &&
|
status = STATUS_INVALID_PARAMETER;
|
||||||
(params.DesiredAccess & (FILE_WRITE_DATA | FILE_APPEND_DATA))) {
|
|
||||||
status = STATUS_ACCESS_DENIED;
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* from ms-fsa 3.1.5.1.1 page 56 */
|
||||||
|
if ((params.CreateOptions & FILE_DELETE_ON_CLOSE) &&
|
||||||
|
(params.FileAttributes & FILE_ATTRIBUTE_READONLY)) {
|
||||||
|
status = STATUS_CANNOT_DELETE;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(STORE_MOUNT_SEC_CONTEXT) && defined (USE_MOUNT_SEC_CONTEXT)
|
#if defined(STORE_MOUNT_SEC_CONTEXT) && defined (USE_MOUNT_SEC_CONTEXT)
|
||||||
status = nfs41_UpcallCreate(NFS41_OPEN, &pVNetRootContext->mount_sec_ctx,
|
status = nfs41_UpcallCreate(NFS41_OPEN, &pVNetRootContext->mount_sec_ctx,
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue