NTFileSystemAdapter: Bugfix: FILE_OPEN_IF was not handled properly if the file exists

This commit is contained in:
Tal Aloni 2017-05-18 23:50:08 +03:00
parent dae8a6b19e
commit 340f55c26e

View file

@ -157,6 +157,20 @@ namespace SMBLibrary
else else
{ {
fileStatus = FileStatus.FILE_EXISTS; fileStatus = FileStatus.FILE_EXISTS;
if (createDisposition == CreateDisposition.FILE_OPEN_IF)
{
if (entry.IsDirectory && forceFile)
{
return NTStatus.STATUS_FILE_IS_A_DIRECTORY;
}
if (!entry.IsDirectory && forceDirectory)
{
return NTStatus.STATUS_OBJECT_PATH_INVALID;
}
}
else
{
if (!requestedWriteAccess) if (!requestedWriteAccess)
{ {
return NTStatus.STATUS_ACCESS_DENIED; return NTStatus.STATUS_ACCESS_DENIED;
@ -216,6 +230,7 @@ namespace SMBLibrary
} }
} }
} }
}
else else
{ {
return NTStatus.STATUS_INVALID_PARAMETER; return NTStatus.STATUS_INVALID_PARAMETER;