mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-08-13 18:59:18 +02:00
SMBServer: SMB1: SMB_COM_FLUSH will now call FlushFileBuffers on the handle associated with the specified FID
This commit is contained in:
parent
3f9daa39fe
commit
1c13a0e539
2 changed files with 27 additions and 1 deletions
|
@ -158,5 +158,30 @@ namespace SMBLibrary.Server.SMB1
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static SMB1Command GetFlushResponse(SMB1Header header, FlushRequest request, ISMBShare share, SMB1ConnectionState state)
|
||||||
|
{
|
||||||
|
SMB1Session session = state.GetSession(header.UID);
|
||||||
|
if (request.FID == 0xFFFF)
|
||||||
|
{
|
||||||
|
// [MS-CIFS] If the FID is 0xFFFF, the Server.Connection.FileOpenTable MUST be scanned for
|
||||||
|
// all files that were opened by the PID listed in the request header.
|
||||||
|
// The server MUST attempt to flush each Server.Open so listed.
|
||||||
|
return new FlushResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenFileObject openFile = session.GetOpenFileObject(request.FID);
|
||||||
|
if (openFile == null)
|
||||||
|
{
|
||||||
|
header.Status = NTStatus.STATUS_INVALID_HANDLE;
|
||||||
|
return new ErrorResponse(request.CommandName);
|
||||||
|
}
|
||||||
|
header.Status = share.FileStore.FlushFileBuffers(openFile.Handle);
|
||||||
|
if (header.Status != NTStatus.STATUS_SUCCESS)
|
||||||
|
{
|
||||||
|
return new ErrorResponse(request.CommandName);
|
||||||
|
}
|
||||||
|
return new FlushResponse();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,7 +176,8 @@ namespace SMBLibrary.Server
|
||||||
}
|
}
|
||||||
else if (command is FlushRequest)
|
else if (command is FlushRequest)
|
||||||
{
|
{
|
||||||
return new FlushResponse();
|
FlushRequest request = (FlushRequest)command;
|
||||||
|
return ReadWriteResponseHelper.GetFlushResponse(header, request, share, state);
|
||||||
}
|
}
|
||||||
else if (command is DeleteRequest)
|
else if (command is DeleteRequest)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue