mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-07-08 18:43:19 +02:00
SMBServer: Correct handling of STATUS_BUFFER_OVERFLOW returned by the NTFileStore
This commit is contained in:
parent
9669f16bb5
commit
4fef34e7cd
4 changed files with 6 additions and 5 deletions
|
@ -103,7 +103,7 @@ namespace SMBLibrary.Server.SMB1
|
|||
header.Status = NTStatus.STATUS_SMB_BAD_COMMAND;
|
||||
}
|
||||
|
||||
if (header.Status != NTStatus.STATUS_SUCCESS)
|
||||
if (subcommandResponse == null)
|
||||
{
|
||||
return new ErrorResponse(CommandName.SMB_COM_NT_TRANSACT);
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ namespace SMBLibrary.Server.SMB1
|
|||
int maxOutputLength = (int)maxDataCount;
|
||||
byte[] output;
|
||||
header.Status = share.FileStore.DeviceIOControl(openFile.Handle, subcommand.FunctionCode, subcommand.Data, out output, maxOutputLength);
|
||||
if (header.Status != NTStatus.STATUS_SUCCESS)
|
||||
if (header.Status != NTStatus.STATUS_SUCCESS && header.Status != NTStatus.STATUS_BUFFER_OVERFLOW)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ namespace SMBLibrary.Server.SMB1
|
|||
header.Status = NTStatus.STATUS_SMB_BAD_COMMAND;
|
||||
}
|
||||
|
||||
if (header.Status != NTStatus.STATUS_SUCCESS)
|
||||
if (subcommandResponse == null)
|
||||
{
|
||||
return new ErrorResponse(CommandName.SMB_COM_TRANSACTION);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace SMBLibrary.Server.SMB1
|
|||
int maxOutputLength = (int)maxDataCount;
|
||||
byte[] output;
|
||||
header.Status = share.FileStore.DeviceIOControl(openFile.Handle, (uint)IoControlCode.FSCTL_PIPE_TRANSCEIVE, subcommand.WriteData, out output, maxOutputLength);
|
||||
if (header.Status != NTStatus.STATUS_SUCCESS)
|
||||
if (header.Status != NTStatus.STATUS_SUCCESS && header.Status != NTStatus.STATUS_BUFFER_OVERFLOW)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -49,12 +49,13 @@ namespace SMBLibrary.Server.SMB2
|
|||
int maxOutputLength = (int)request.MaxOutputResponse;
|
||||
byte[] output;
|
||||
NTStatus status = share.FileStore.DeviceIOControl(handle, request.CtlCode, request.Input, out output, maxOutputLength);
|
||||
if (status != NTStatus.STATUS_SUCCESS)
|
||||
if (status != NTStatus.STATUS_SUCCESS && status != NTStatus.STATUS_BUFFER_OVERFLOW)
|
||||
{
|
||||
return new ErrorResponse(request.CommandName, status);
|
||||
}
|
||||
|
||||
IOCtlResponse response = new IOCtlResponse();
|
||||
response.Header.Status = status;
|
||||
response.CtlCode = request.CtlCode;
|
||||
response.FileId = request.FileId;
|
||||
response.Output = output;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue