Do not perform denial of service check in LAN games.

This commit is contained in:
lotodore
2010-09-03 21:40:14 +00:00
parent 9254cacdf7
commit 9bf9aea7f2
2 changed files with 16 additions and 12 deletions
+15 -11
View File
@@ -989,18 +989,22 @@ ServerLobbyThread::HandleNetPacketInit(SessionWrapper session, const InitMessage
// Before any other processing, perform some denial of service and // Before any other processing, perform some denial of service and
// brute force attack prevention by checking whether the user recently sent an // brute force attack prevention by checking whether the user recently sent an
// Init packet. // Init packet.
bool recentlySentInit = false; // This check is not performed on LAN servers.
if (m_mode != SERVER_MODE_LAN)
{ {
boost::mutex::scoped_lock lock(m_timerClientAddressMapMutex); bool recentlySentInit = false;
if (m_timerClientAddressMap.find(session.sessionData->GetClientAddr()) != m_timerClientAddressMap.end()) {
recentlySentInit = true; boost::mutex::scoped_lock lock(m_timerClientAddressMapMutex);
else if (m_timerClientAddressMap.find(session.sessionData->GetClientAddr()) != m_timerClientAddressMap.end())
m_timerClientAddressMap[session.sessionData->GetClientAddr()] = boost::timers::portable::microsec_timer(); recentlySentInit = true;
} else
if (recentlySentInit) m_timerClientAddressMap[session.sessionData->GetClientAddr()] = boost::timers::portable::microsec_timer();
{ }
SessionError(session, ERR_NET_INIT_BLOCKED); if (recentlySentInit)
return; {
SessionError(session, ERR_NET_INIT_BLOCKED);
return;
}
} }
// Check the protocol version. // Check the protocol version.
+1 -1
View File
@@ -223,7 +223,7 @@ private:
ServerIrcBotCallback &m_ircBotCb; ServerIrcBotCallback &m_ircBotCb;
AvatarManager &m_avatarManager; AvatarManager &m_avatarManager;
ServerMode m_mode; const ServerMode m_mode;
std::string m_statisticsFileName; std::string m_statisticsFileName;
ConfigFile *m_serverConfig; ConfigFile *m_serverConfig;
u_int32_t m_curGameId; u_int32_t m_curGameId;