mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-08-12 02:19:17 +02:00
NTFileSystemHelper: Handle IFileSystem related ArgumentException
This commit is contained in:
parent
38b9829d6a
commit
c2ed2ea102
1 changed files with 16 additions and 2 deletions
|
@ -44,7 +44,17 @@ namespace SMBLibrary.Server
|
||||||
return NTStatus.STATUS_NO_SUCH_FILE;
|
return NTStatus.STATUS_NO_SUCH_FILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
entry = fileSystem.GetEntry(path);
|
entry = fileSystem.GetEntry(path);
|
||||||
|
}
|
||||||
|
catch (ArgumentException)
|
||||||
|
{
|
||||||
|
state.LogToServer(Severity.Debug, "CreateFile: Error retrieving '{0}'. Argument Exception.", path);
|
||||||
|
entry = null;
|
||||||
|
return NTStatus.STATUS_OBJECT_PATH_SYNTAX_BAD;
|
||||||
|
}
|
||||||
|
|
||||||
if (createDisposition == CreateDisposition.FILE_OPEN)
|
if (createDisposition == CreateDisposition.FILE_OPEN)
|
||||||
{
|
{
|
||||||
if (entry == null)
|
if (entry == null)
|
||||||
|
@ -115,7 +125,6 @@ namespace SMBLibrary.Server
|
||||||
createDisposition == CreateDisposition.FILE_OVERWRITE_IF ||
|
createDisposition == CreateDisposition.FILE_OVERWRITE_IF ||
|
||||||
createDisposition == CreateDisposition.FILE_SUPERSEDE)
|
createDisposition == CreateDisposition.FILE_SUPERSEDE)
|
||||||
{
|
{
|
||||||
entry = fileSystem.GetEntry(path);
|
|
||||||
if (entry == null)
|
if (entry == null)
|
||||||
{
|
{
|
||||||
if (createDisposition == CreateDisposition.FILE_OVERWRITE)
|
if (createDisposition == CreateDisposition.FILE_OVERWRITE)
|
||||||
|
@ -265,6 +274,11 @@ namespace SMBLibrary.Server
|
||||||
{
|
{
|
||||||
stream = fileSystem.OpenFile(path, FileMode.Open, fileAccess, fileShare);
|
stream = fileSystem.OpenFile(path, FileMode.Open, fileAccess, fileShare);
|
||||||
}
|
}
|
||||||
|
catch (ArgumentException)
|
||||||
|
{
|
||||||
|
state.LogToServer(Severity.Debug, "OpenFile: Cannot open '{0}'. Argument Exception.", path);
|
||||||
|
return NTStatus.STATUS_OBJECT_PATH_SYNTAX_BAD;
|
||||||
|
}
|
||||||
catch (DirectoryNotFoundException)
|
catch (DirectoryNotFoundException)
|
||||||
{
|
{
|
||||||
state.LogToServer(Severity.Debug, "OpenFile: Cannot open '{0}'. Directory not found.", path);
|
state.LogToServer(Severity.Debug, "OpenFile: Cannot open '{0}'. Directory not found.", path);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue