Fixed InvalidCastException during SMB 2.002 connection

This commit is contained in:
Tal Aloni 2017-01-22 22:24:42 +02:00
parent 3539d3bd31
commit 1679629b47
2 changed files with 10 additions and 2 deletions

View file

@ -47,8 +47,12 @@ namespace SMBLibrary.Server
if (command is NegotiateRequest)
{
NegotiateRequest request = (NegotiateRequest)command;
SMB2Command response = NegotiateHelper.GetNegotiateResponse(request, state, m_serverGuid);
if (state.ServerDialect != SMBDialect.NotSet)
{
state = new SMB2ConnectionState(state, AllocatePersistentFileID);
return NegotiateHelper.GetNegotiateResponse(request, state, m_serverGuid);
}
return response;
}
else
{

View file

@ -245,6 +245,10 @@ namespace SMBLibrary.Server
if (smb2Dialects.Count > 0)
{
SMB2Command response = SMB2.NegotiateHelper.GetNegotiateResponse(smb2Dialects, state, m_serverGuid);
if (state.ServerDialect != SMBDialect.NotSet)
{
state = new SMB2ConnectionState(state, AllocatePersistentFileID);
}
TrySendResponse(state, response);
return;
}