mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-07-14 05:15:03 +02:00
Workaround to prevent Windows 7 / 8 / 10 from sending ChangeNotify requests infinitely
This commit is contained in:
parent
c8b66a16c9
commit
64702908d9
1 changed files with 19 additions and 1 deletions
|
@ -135,6 +135,20 @@ namespace SMBLibrary.Server
|
|||
}
|
||||
else
|
||||
{
|
||||
// Cancel requests can have an ASYNC header (TreeID will not be present)
|
||||
if (command is CancelRequest)
|
||||
{
|
||||
if (command.Header.IsAsync && command.Header.AsyncID == 0)
|
||||
{
|
||||
ErrorResponse response = new ErrorResponse(command.CommandName, NTStatus.STATUS_CANCELLED);
|
||||
response.Header.IsAsync = true;
|
||||
return response;
|
||||
}
|
||||
|
||||
// [MS-SMB2] If a request is not found, the server MUST stop processing for this cancel request. No response is sent.
|
||||
return null;
|
||||
}
|
||||
|
||||
ISMBShare share = session.GetConnectedTree(command.Header.TreeID);
|
||||
if (share == null)
|
||||
{
|
||||
|
@ -196,7 +210,11 @@ namespace SMBLibrary.Server
|
|||
else if (command is ChangeNotifyRequest)
|
||||
{
|
||||
// [MS-SMB2] If the underlying object store does not support change notifications, the server MUST fail this request with STATUS_NOT_SUPPORTED
|
||||
return new ErrorResponse(command.CommandName, NTStatus.STATUS_NOT_SUPPORTED);
|
||||
ErrorResponse response = new ErrorResponse(command.CommandName, NTStatus.STATUS_NOT_SUPPORTED);
|
||||
// Windows 7 / 8 / 10 will infinitely retry sending ChangeNotify requests if the response does not have SMB2_FLAGS_ASYNC_COMMAND set.
|
||||
// Note: NoRemoteChangeNotify can be set in the registry to prevent the client from sending ChangeNotify requests altogether.
|
||||
response.Header.IsAsync = true;
|
||||
return response;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue