mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-04-29 18:27:48 +02:00
NTFileSystemAdapter: Bugfix: FILE_OPEN_IF was not handled properly if the file exists
This commit is contained in:
parent
dae8a6b19e
commit
340f55c26e
1 changed files with 63 additions and 48 deletions
|
@ -157,6 +157,20 @@ namespace SMBLibrary
|
|||
else
|
||||
{
|
||||
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)
|
||||
{
|
||||
return NTStatus.STATUS_ACCESS_DENIED;
|
||||
|
@ -186,7 +200,7 @@ namespace SMBLibrary
|
|||
{
|
||||
m_fileSystem.Delete(path);
|
||||
}
|
||||
catch(Exception ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
NTStatus status = ToNTStatus(ex);
|
||||
Log(Severity.Verbose, "CreateFile: Error deleting '{0}'. {1}.", path, status);
|
||||
|
@ -216,6 +230,7 @@ namespace SMBLibrary
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return NTStatus.STATUS_INVALID_PARAMETER;
|
||||
|
|
Loading…
Add table
Reference in a new issue