Return STATUS_INVALID_PARAMETER instead of STATUS_SMB_BAD_COMMAND when client tries to perform operation on mismatching share

This commit is contained in:
Tal Aloni 2017-02-02 23:25:16 +02:00
parent 7c3e6edf84
commit acf3a99214
2 changed files with 11 additions and 10 deletions

View file

@ -136,7 +136,8 @@ namespace SMBLibrary.Server.SMB1
{ {
if (!(share is NamedPipeShare)) if (!(share is NamedPipeShare))
{ {
header.Status = NTStatus.STATUS_SMB_BAD_COMMAND; // [MS-CIFS] If the pipe is not a message mode pipe, the Trans subsystem MUST fail the request with STATUS_INVALID_PARAMETER
header.Status = NTStatus.STATUS_INVALID_PARAMETER;
return new ErrorResponse(CommandName.SMB_COM_TRANSACTION); return new ErrorResponse(CommandName.SMB_COM_TRANSACTION);
} }
@ -196,7 +197,7 @@ namespace SMBLibrary.Server.SMB1
if (!(share is FileSystemShare)) if (!(share is FileSystemShare))
{ {
header.Status = NTStatus.STATUS_SMB_BAD_COMMAND; header.Status = NTStatus.STATUS_INVALID_PARAMETER;
return new ErrorResponse(CommandName.SMB_COM_TRANSACTION2); return new ErrorResponse(CommandName.SMB_COM_TRANSACTION2);
} }

View file

@ -146,7 +146,7 @@ namespace SMBLibrary.Server
{ {
if (!(share is FileSystemShare)) if (!(share is FileSystemShare))
{ {
header.Status = NTStatus.STATUS_SMB_BAD_COMMAND; header.Status = NTStatus.STATUS_INVALID_PARAMETER;
return new ErrorResponse(command.CommandName); return new ErrorResponse(command.CommandName);
} }
CreateDirectoryRequest request = (CreateDirectoryRequest)command; CreateDirectoryRequest request = (CreateDirectoryRequest)command;
@ -156,7 +156,7 @@ namespace SMBLibrary.Server
{ {
if (!(share is FileSystemShare)) if (!(share is FileSystemShare))
{ {
header.Status = NTStatus.STATUS_SMB_BAD_COMMAND; header.Status = NTStatus.STATUS_INVALID_PARAMETER;
return new ErrorResponse(command.CommandName); return new ErrorResponse(command.CommandName);
} }
DeleteDirectoryRequest request = (DeleteDirectoryRequest)command; DeleteDirectoryRequest request = (DeleteDirectoryRequest)command;
@ -175,7 +175,7 @@ namespace SMBLibrary.Server
{ {
if (!(share is FileSystemShare)) if (!(share is FileSystemShare))
{ {
header.Status = NTStatus.STATUS_SMB_BAD_COMMAND; header.Status = NTStatus.STATUS_INVALID_PARAMETER;
return new ErrorResponse(command.CommandName); return new ErrorResponse(command.CommandName);
} }
DeleteRequest request = (DeleteRequest)command; DeleteRequest request = (DeleteRequest)command;
@ -185,7 +185,7 @@ namespace SMBLibrary.Server
{ {
if (!(share is FileSystemShare)) if (!(share is FileSystemShare))
{ {
header.Status = NTStatus.STATUS_SMB_BAD_COMMAND; header.Status = NTStatus.STATUS_INVALID_PARAMETER;
return new ErrorResponse(command.CommandName); return new ErrorResponse(command.CommandName);
} }
RenameRequest request = (RenameRequest)command; RenameRequest request = (RenameRequest)command;
@ -195,7 +195,7 @@ namespace SMBLibrary.Server
{ {
if (!(share is FileSystemShare)) if (!(share is FileSystemShare))
{ {
header.Status = NTStatus.STATUS_SMB_BAD_COMMAND; header.Status = NTStatus.STATUS_INVALID_PARAMETER;
return new ErrorResponse(command.CommandName); return new ErrorResponse(command.CommandName);
} }
QueryInformationRequest request = (QueryInformationRequest)command; QueryInformationRequest request = (QueryInformationRequest)command;
@ -205,7 +205,7 @@ namespace SMBLibrary.Server
{ {
if (!(share is FileSystemShare)) if (!(share is FileSystemShare))
{ {
header.Status = NTStatus.STATUS_SMB_BAD_COMMAND; header.Status = NTStatus.STATUS_INVALID_PARAMETER;
return new ErrorResponse(command.CommandName); return new ErrorResponse(command.CommandName);
} }
SetInformationRequest request = (SetInformationRequest)command; SetInformationRequest request = (SetInformationRequest)command;
@ -231,7 +231,7 @@ namespace SMBLibrary.Server
{ {
if (!(share is FileSystemShare)) if (!(share is FileSystemShare))
{ {
header.Status = NTStatus.STATUS_SMB_BAD_COMMAND; header.Status = NTStatus.STATUS_INVALID_PARAMETER;
return new ErrorResponse(command.CommandName); return new ErrorResponse(command.CommandName);
} }
CheckDirectoryRequest request = (CheckDirectoryRequest)command; CheckDirectoryRequest request = (CheckDirectoryRequest)command;
@ -249,7 +249,7 @@ namespace SMBLibrary.Server
{ {
if (!(share is FileSystemShare)) if (!(share is FileSystemShare))
{ {
header.Status = NTStatus.STATUS_SMB_BAD_COMMAND; header.Status = NTStatus.STATUS_INVALID_PARAMETER;
return new ErrorResponse(command.CommandName); return new ErrorResponse(command.CommandName);
} }
SetInformation2Request request = (SetInformation2Request)command; SetInformation2Request request = (SetInformation2Request)command;