Client: Discard all unsolicited responses except OpLock break

This commit is contained in:
Tal Aloni 2017-12-13 20:24:11 +02:00
parent 5637bb3b9c
commit 7c31666bc3
2 changed files with 20 additions and 6 deletions

View file

@ -456,6 +456,12 @@ namespace SMBLibrary.Client
return;
}
// [MS-CIFS] 3.2.5.1 - If the MID value is the reserved value 0xFFFF, the message can be an OpLock break
// sent by the server. Otherwise, if the PID and MID values of the received message are not found in the
// Client.Connection.PIDMIDList, the message MUST be discarded.
if ((message.Header.MID == 0xFFFF && message.Header.Command == CommandName.SMB_COM_LOCKING_ANDX) ||
(message.Header.PID == 0 && message.Header.MID == 0))
{
lock (m_incomingQueueLock)
{
m_incomingQueue.Add(message);
@ -463,6 +469,7 @@ namespace SMBLibrary.Client
}
}
}
}
internal SMB1Message WaitForMessage(CommandName commandName)
{

View file

@ -340,6 +340,12 @@ namespace SMBLibrary.Client
return;
}
// [MS-SMB2] 3.2.5.1.2 - If the MessageId is 0xFFFFFFFFFFFFFFFF, this is not a reply to a previous request,
// and the client MUST NOT attempt to locate the request, but instead process it as follows:
// If the command field in the SMB2 header is SMB2 OPLOCK_BREAK, it MUST be processed as specified in 3.2.5.19.
// Otherwise, the response MUST be discarded as invalid.
if (command.Header.MessageID != 0xFFFFFFFFFFFFFFFF || command.Header.Command == SMB2CommandName.OplockBreak)
{
lock (m_incomingQueueLock)
{
m_incomingQueue.Add(command);
@ -347,6 +353,7 @@ namespace SMBLibrary.Client
}
}
}
}
internal SMB2Command WaitForCommand(SMB2CommandName commandName)
{