public SMB2ConnectionState(ConnectionState state) : base(state) { }
/// <summary> /// May return an empty list /// </summary> private List <SMB1Command> ProcessSMB1Command(SMB1Header header, SMB1Command command, ref ConnectionState state) { if (state.Dialect == SMBDialect.NotSet) { if (command is NegotiateRequest) { NegotiateRequest request = (NegotiateRequest)command; if (request.Dialects.Contains(SMBServer.NTLanManagerDialect)) { state = new SMB1ConnectionState(state); state.Dialect = SMBDialect.NTLM012; m_connectionManager.AddConnection(state); if (EnableExtendedSecurity && header.ExtendedSecurityFlag) { return(NegotiateHelper.GetNegotiateResponseExtended(request, m_serverGuid)); } else { return(NegotiateHelper.GetNegotiateResponse(header, request, m_securityProvider, state)); } } else { return(new NegotiateResponseNotSupported()); } } else { // [MS-CIFS] An SMB_COM_NEGOTIATE exchange MUST be completed before any other SMB messages are sent to the server header.Status = NTStatus.STATUS_INVALID_SMB; return(new ErrorResponse(command.CommandName)); } } else if (command is NegotiateRequest) { // There MUST be only one SMB_COM_NEGOTIATE exchange per SMB connection. // Subsequent SMB_COM_NEGOTIATE requests received by the server MUST be rejected with error responses. header.Status = NTStatus.STATUS_INVALID_SMB; return(new ErrorResponse(command.CommandName)); } else { return(ProcessSMB1Command(header, command, (SMB1ConnectionState)state)); } }