void TAO_FTEC_ProxyPushSupplier::resume_connection (void) { if (Request_Context_Repository().is_executed_request()) return; Request_Context_Repository().set_object_id(id()); FtRtecEventChannelAdmin::Operation update; update.object_id = id(); update.param._d(FtRtecEventChannelAdmin::RESUME_CONNECTION); Inherited::resume_connection(); try{ FTRTEC::Replication_Service* svc = FTRTEC::Replication_Service::instance(); ACE_READ_GUARD (FTRTEC::Replication_Service, locker, *svc); svc->replicate_request(update, &FtRtecEventChannelAdmin::EventChannelFacade::suspend_push_supplier); } catch (...){ this->suspend_connection(); throw; } }
// = The RtecEventChannelAdmin::ProxyPushSupplier methods... void TAO_FTEC_ProxyPushSupplier::connect_push_consumer ( RtecEventComm::PushConsumer_ptr push_consumer, const RtecEventChannelAdmin::ConsumerQOS &qos) { if (Request_Context_Repository().is_executed_request()) return; FtRtecEventChannelAdmin::Operation update; FtRtecEventChannelAdmin::Connect_push_consumer_param param; update.object_id = this->id(); param.push_consumer = RtecEventComm::PushConsumer::_duplicate(push_consumer); param.qos = qos; update.param.connect_consumer_param(param); Inherited::connect_push_consumer(push_consumer, qos); try{ FTRTEC::Replication_Service* svc = FTRTEC::Replication_Service::instance(); ACE_READ_GUARD (FTRTEC::Replication_Service, locker, *svc); svc->replicate_request(update, &FtRtecEventChannelAdmin::EventChannelFacade::disconnect_push_supplier); } catch (...){ } }
void TAO_Portable_Group_Map::dispatch (PortableGroup::TagGroupTaggedComponent* group_id, TAO_ORB_Core *orb_core, TAO_ServerRequest &request, CORBA::Object_out forward_to) { ACE_READ_GUARD (TAO_SYNCH_RW_MUTEX, guard, this->lock_); // Look up the GroupId. Map_Entry *entry = 0; if (this->map_.find (group_id, entry) == 0) { // Save the read pointer in the message block since // every time we dispatch the request, we need to // reset it so that the request demarshals correctly. TAO_InputCDR *tao_in = request.incoming (); ACE_Message_Block *msgblk = const_cast<ACE_Message_Block *> (tao_in->start ()); char *read_ptr = msgblk->rd_ptr (); // Iterate through the list of ObjectKeys. while (entry) { orb_core->adapter_registry ().dispatch (entry->key, request, forward_to); // Reset the read pointer in the message block. msgblk->rd_ptr (read_ptr); entry = entry->next; } } }
void RecorderImpl::signal_liveliness(const RepoId& remote_participant) { RepoId prefix = remote_participant; prefix.entityId = EntityId_t(); ACE_GUARD(ACE_Recursive_Thread_Mutex, guard, this->sample_lock_); typedef std::pair<RepoId, RcHandle<WriterInfo> > WriterSetElement; typedef OPENDDS_VECTOR(WriterSetElement) WriterSet; WriterSet writers; { ACE_READ_GUARD(ACE_RW_Thread_Mutex, read_guard, this->writers_lock_); for (WriterMapType::iterator pos = writers_.lower_bound(prefix), limit = writers_.end(); pos != limit && GuidPrefixEqual() (pos->first.guidPrefix, prefix.guidPrefix); ++pos) { writers.push_back(std::make_pair(pos->first, pos->second)); } } ACE_Time_Value when = ACE_OS::gettimeofday(); for (WriterSet::iterator pos = writers.begin(), limit = writers.end(); pos != limit; ++pos) { pos->second->received_activity(when); } }
void ObjectAccessor::SaveAllPlayers() { ACE_READ_GUARD(HashMapHolder<Player>::LockType, g, *HashMapHolder<Player>::GetLock()); HashMapHolder<Player>::MapType const& m = GetPlayers(); for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) itr->second->SaveToDB(); }
void TAO_FTEC_ProxyPushSupplier::disconnect_push_supplier (void) { if (Request_Context_Repository().is_executed_request()) return; FtRtecEventChannelAdmin::Operation update; update.object_id = id(); update.param._d(FtRtecEventChannelAdmin::DISCONNECT_PUSH_SUPPLIER); Inherited::disconnect_push_supplier(); FTRTEC::Replication_Service *svc = FTRTEC::Replication_Service::instance(); ACE_READ_GUARD (FTRTEC::Replication_Service, locker, *svc); svc->replicate_request(update, 0); }
void StockDistributor_i::operator () (std::vector <std::string> &stocks) { ACE_DEBUG ((LM_DEBUG, "*** message: transmitting data to the StockNameConsumer, got %i stocks\n", stocks.size ())); // Convert the stocks into a stringseq CORBA::StringSeq_var corba_stocks = new CORBA::StringSeq (); corba_stocks->length (stocks.size ()); std::for_each (stocks.begin (), stocks.end (), StrSeq_Converter (corba_stocks)); ACE_READ_GUARD (ACE_RW_Thread_Mutex, g, lock_); std::for_each (this->subscribers_list_.begin (), this->subscribers_list_.end (), Stock_Publisher (this->orb_.in (), corba_stocks)); }
void RecorderImpl::remove_all_associations() { DBG_ENTRY_LVL("RecorderImpl","remove_all_associations",6); OpenDDS::DCPS::WriterIdSeq writers; int size; ACE_GUARD(ACE_Recursive_Thread_Mutex, guard, this->publication_handle_lock_); { ACE_READ_GUARD(ACE_RW_Thread_Mutex, read_guard, this->writers_lock_); size = static_cast<int>(writers_.size()); writers.length(size); WriterMapType::iterator curr_writer = writers_.begin(); WriterMapType::iterator end_writer = writers_.end(); int i = 0; while (curr_writer != end_writer) { writers[i++] = curr_writer->first; ++curr_writer; } } try { CORBA::Boolean dont_notify_lost = 0; if (0 < size) { remove_associations(writers, dont_notify_lost); } } catch (const CORBA::Exception&) { } }
void WardenWin::HandleData(ByteBuffer &buff) { sLog->outDebug(LOG_FILTER_WARDEN, "Handle data"); _dataSent = false; _clientResponseTimer = 0; uint16 Length; buff >> Length; uint32 Checksum; buff >> Checksum; if (!IsValidCheckSum(Checksum, buff.contents() + buff.rpos(), Length)) { buff.rpos(buff.wpos()); sLog->outWarn(LOG_FILTER_WARDEN, "%s failed checksum. Action: %s", _session->GetPlayerInfo().c_str(), Penalty().c_str()); return; } // TIMING_CHECK { uint8 result; buff >> result; // TODO: test it. if (result == 0x00) { sLog->outWarn(LOG_FILTER_WARDEN, "%s failed timing check. Action: %s", _session->GetPlayerInfo().c_str(), Penalty().c_str()); return; } uint32 newClientTicks; buff >> newClientTicks; uint32 ticksNow = getMSTime(); uint32 ourTicks = newClientTicks + (ticksNow - _serverTicks); sLog->outDebug(LOG_FILTER_WARDEN, "ServerTicks %u", ticksNow); // Now sLog->outDebug(LOG_FILTER_WARDEN, "RequestTicks %u", _serverTicks); // At request sLog->outDebug(LOG_FILTER_WARDEN, "Ticks %u", newClientTicks); // At response sLog->outDebug(LOG_FILTER_WARDEN, "Ticks diff %u", ourTicks - newClientTicks); } WardenCheckResult* rs; WardenCheck *rd; uint8 type; uint16 checkFailed = 0; ACE_READ_GUARD(ACE_RW_Mutex, g, sWardenCheckMgr->_checkStoreLock); for (std::list<uint16>::iterator itr = _currentChecks.begin(); itr != _currentChecks.end(); ++itr) { rd = sWardenCheckMgr->GetWardenDataById(*itr); rs = sWardenCheckMgr->GetWardenResultById(*itr); type = rd->Type; switch (type) { case MEM_CHECK: { uint8 Mem_Result; buff >> Mem_Result; if (Mem_Result != 0) { sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MEM_CHECK not 0x00, CheckId %u account Id %u", *itr, _session->GetAccountId()); checkFailed = *itr; continue; } if (memcmp(buff.contents() + buff.rpos(), rs->Result.AsByteArray(0, false), rd->Length) != 0) { sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MEM_CHECK fail CheckId %u account Id %u", *itr, _session->GetAccountId()); checkFailed = *itr; buff.rpos(buff.rpos() + rd->Length); continue; } buff.rpos(buff.rpos() + rd->Length); sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MEM_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId()); break; } case PAGE_CHECK_A: case PAGE_CHECK_B: case DRIVER_CHECK: case MODULE_CHECK: { const uint8 byte = 0xE9; if (memcmp(buff.contents() + buff.rpos(), &byte, sizeof(uint8)) != 0) { if (type == PAGE_CHECK_A || type == PAGE_CHECK_B) sLog->outDebug(LOG_FILTER_WARDEN, "RESULT PAGE_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId()); if (type == MODULE_CHECK) sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MODULE_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId()); if (type == DRIVER_CHECK) sLog->outDebug(LOG_FILTER_WARDEN, "RESULT DRIVER_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId()); checkFailed = *itr; buff.rpos(buff.rpos() + 1); continue; } buff.rpos(buff.rpos() + 1); if (type == PAGE_CHECK_A || type == PAGE_CHECK_B) sLog->outDebug(LOG_FILTER_WARDEN, "RESULT PAGE_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId()); else if (type == MODULE_CHECK) sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MODULE_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId()); else if (type == DRIVER_CHECK) sLog->outDebug(LOG_FILTER_WARDEN, "RESULT DRIVER_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId()); break; } case LUA_STR_CHECK: { uint8 Lua_Result; buff >> Lua_Result; if (Lua_Result != 0) { sLog->outDebug(LOG_FILTER_WARDEN, "RESULT LUA_STR_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId()); checkFailed = *itr; continue; } uint8 luaStrLen; buff >> luaStrLen; if (luaStrLen != 0) { char *str = new char[luaStrLen + 1]; memcpy(str, buff.contents() + buff.rpos(), luaStrLen); str[luaStrLen] = '\0'; // null terminator sLog->outDebug(LOG_FILTER_WARDEN, "Lua string: %s", str); delete[] str; } buff.rpos(buff.rpos() + luaStrLen); // Skip string sLog->outDebug(LOG_FILTER_WARDEN, "RESULT LUA_STR_CHECK passed, CheckId %u account Id %u", *itr, _session->GetAccountId()); break; } case MPQ_CHECK: { uint8 Mpq_Result; buff >> Mpq_Result; if (Mpq_Result != 0) { sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MPQ_CHECK not 0x00 account id %u", _session->GetAccountId()); checkFailed = *itr; continue; } if (memcmp(buff.contents() + buff.rpos(), rs->Result.AsByteArray(0, false), 20) != 0) // SHA1 { sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MPQ_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId()); checkFailed = *itr; buff.rpos(buff.rpos() + 20); // 20 bytes SHA1 continue; } buff.rpos(buff.rpos() + 20); // 20 bytes SHA1 sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MPQ_CHECK passed, CheckId %u account Id %u", *itr, _session->GetAccountId()); break; } default: // Should never happen break; } } if (checkFailed > 0) { WardenCheck* check = sWardenCheckMgr->GetWardenDataById(checkFailed); sLog->outWarn(LOG_FILTER_WARDEN, "%s failed Warden check %u. Action: %s", _session->GetPlayerInfo().c_str(), checkFailed, Penalty(check).c_str()); } // Set hold off timer, minimum timer should at least be 1 second uint32 holdOff = sWorld->getIntConfig(CONFIG_WARDEN_CLIENT_CHECK_HOLDOFF); _checkTimer = (holdOff < 1 ? 1 : holdOff) * IN_MILLISECONDS; }
void WardenWin::RequestData() { sLog->outDebug(LOG_FILTER_WARDEN, "Request data"); // If all checks were done, fill the todo list again if (_memChecksTodo.empty()) _memChecksTodo.assign(sWardenCheckMgr->MemChecksIdPool.begin(), sWardenCheckMgr->MemChecksIdPool.end()); if (_otherChecksTodo.empty()) _otherChecksTodo.assign(sWardenCheckMgr->OtherChecksIdPool.begin(), sWardenCheckMgr->OtherChecksIdPool.end()); _serverTicks = getMSTime(); uint16 id; uint8 type; WardenCheck* wd; _currentChecks.clear(); // Build check request for (uint32 i = 0; i < sWorld->getIntConfig(CONFIG_WARDEN_NUM_MEM_CHECKS); ++i) { // If todo list is done break loop (will be filled on next Update() run) if (_memChecksTodo.empty()) break; // Get check id from the end and remove it from todo id = _memChecksTodo.back(); _memChecksTodo.pop_back(); // Add the id to the list sent in this cycle _currentChecks.push_back(id); } ByteBuffer buff; buff << uint8(WARDEN_SMSG_CHEAT_CHECKS_REQUEST); ACE_READ_GUARD(ACE_RW_Mutex, g, sWardenCheckMgr->_checkStoreLock); for (uint32 i = 0; i < sWorld->getIntConfig(CONFIG_WARDEN_NUM_OTHER_CHECKS); ++i) { // If todo list is done break loop (will be filled on next Update() run) if (_otherChecksTodo.empty()) break; // Get check id from the end and remove it from todo id = _otherChecksTodo.back(); _otherChecksTodo.pop_back(); // Add the id to the list sent in this cycle _currentChecks.push_back(id); wd = sWardenCheckMgr->GetWardenDataById(id); switch (wd->Type) { case MPQ_CHECK: case LUA_STR_CHECK: case DRIVER_CHECK: buff << uint8(wd->Str.size()); buff.append(wd->Str.c_str(), wd->Str.size()); break; default: break; } } uint8 xorByte = _inputKey[0]; // Add TIMING_CHECK buff << uint8(0x00); buff << uint8(TIMING_CHECK ^ xorByte); uint8 index = 1; for (std::list<uint16>::iterator itr = _currentChecks.begin(); itr != _currentChecks.end(); ++itr) { wd = sWardenCheckMgr->GetWardenDataById(*itr); type = wd->Type; buff << uint8(type ^ xorByte); switch (type) { case MEM_CHECK: { buff << uint8(0x00); buff << uint32(wd->Address); buff << uint8(wd->Length); break; } case PAGE_CHECK_A: case PAGE_CHECK_B: { buff.append(wd->Data.AsByteArray(0, false), wd->Data.GetNumBytes()); buff << uint32(wd->Address); buff << uint8(wd->Length); break; } case MPQ_CHECK: case LUA_STR_CHECK: { buff << uint8(index++); break; } case DRIVER_CHECK: { buff.append(wd->Data.AsByteArray(0, false), wd->Data.GetNumBytes()); buff << uint8(index++); break; } case MODULE_CHECK: { uint32 seed = static_cast<uint32>(rand32()); buff << uint32(seed); HmacHash hmac(4, (uint8*)&seed); hmac.UpdateData(wd->Str); hmac.Finalize(); buff.append(hmac.GetDigest(), hmac.GetLength()); break; } /*case PROC_CHECK: { buff.append(wd->i.AsByteArray(0, false), wd->i.GetNumBytes()); buff << uint8(index++); buff << uint8(index++); buff << uint32(wd->Address); buff << uint8(wd->Length); break; }*/ default: break; // Should never happen } } buff << uint8(xorByte); buff.hexlike(); // Encrypt with warden RC4 key EncryptData(buff.contents(), buff.size()); WorldPacket pkt(SMSG_WARDEN_DATA, buff.size()); pkt.append(buff); _session->SendPacket(&pkt); _dataSent = true; std::stringstream stream; stream << "Sent check id's: "; for (std::list<uint16>::iterator itr = _currentChecks.begin(); itr != _currentChecks.end(); ++itr) stream << *itr << " "; sLog->outDebug(LOG_FILTER_WARDEN, "%s", stream.str().c_str()); }
void WardenWin::HandleData(ByteBuffer &buff) { sLog->outDebug(LOG_FILTER_WARDEN, "Handle data"); _dataSent = false; _clientResponseTimer = 0; uint16 Length; buff >> Length; uint32 Checksum; buff >> Checksum; if (!IsValidCheckSum(Checksum, buff.contents() + buff.rpos(), Length)) { buff.rpos(buff.wpos()); sLog->outWarn(LOG_FILTER_WARDEN, "%s failed checksum. Action: %s", _session->GetPlayerName(false).c_str(), Penalty().c_str()); return; } // TIMING_CHECK { uint8 result; buff >> result; // TODO: test it. if (result == 0x00) { sLog->outWarn(LOG_FILTER_WARDEN, "%s failed timing check. Action: %s", _session->GetPlayerName(false).c_str(), Penalty().c_str()); return; } uint32 newClientTicks; buff >> newClientTicks; uint32 ticksNow = getMSTime(); uint32 ourTicks = newClientTicks + (ticksNow - _serverTicks); sLog->outDebug(LOG_FILTER_WARDEN, "ServerTicks %u", ticksNow); // Now sLog->outDebug(LOG_FILTER_WARDEN, "RequestTicks %u", _serverTicks); // At request sLog->outDebug(LOG_FILTER_WARDEN, "Ticks %u", newClientTicks); // At response sLog->outDebug(LOG_FILTER_WARDEN, "Ticks diff %u", ourTicks - newClientTicks); } WardenCheckResult *rs; WardenCheck *rd; uint8 type; uint16 checkFailed = 0; ACE_READ_GUARD(ACE_RW_Mutex, g, sWardenCheckMgr->_checkStoreLock); for (std::list<uint16>::iterator itr = _currentChecks.begin(); itr != _currentChecks.end(); ++itr) { rd = sWardenCheckMgr->GetWardenDataById(*itr); rs = sWardenCheckMgr->GetWardenResultById(*itr); type = rd->Type; switch (type) { case MEM_CHECK: { uint8 Mem_Result; buff >> Mem_Result; if (Mem_Result != 0) { sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MEM_CHECK not 0x00, CheckId %u account Id %u", *itr, _session->GetAccountId()); checkFailed = *itr; continue; } if (memcmp(buff.contents() + buff.rpos(), rs->Result.AsByteArray(0, false), rd->Length) != 0) { sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MEM_CHECK fail CheckId %u account Id %u", *itr, _session->GetAccountId()); checkFailed = *itr; buff.rpos(buff.rpos() + rd->Length); continue; } buff.rpos(buff.rpos() + rd->Length); sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MEM_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId()); break; } case PAGE_CHECK_A: case PAGE_CHECK_B: case DRIVER_CHECK: case MODULE_CHECK: { const uint8 byte = 0xE9; if (memcmp(buff.contents() + buff.rpos(), &byte, sizeof(uint8)) != 0) { if (type == PAGE_CHECK_A || type == PAGE_CHECK_B) sLog->outDebug(LOG_FILTER_WARDEN, "RESULT PAGE_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId()); if (type == MODULE_CHECK) sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MODULE_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId()); if (type == DRIVER_CHECK) sLog->outDebug(LOG_FILTER_WARDEN, "RESULT DRIVER_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId()); checkFailed = *itr; buff.rpos(buff.rpos() + 1); continue; } buff.rpos(buff.rpos() + 1); if (type == PAGE_CHECK_A || type == PAGE_CHECK_B) sLog->outDebug(LOG_FILTER_WARDEN, "RESULT PAGE_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId()); else if (type == MODULE_CHECK) sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MODULE_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId()); else if (type == DRIVER_CHECK) sLog->outDebug(LOG_FILTER_WARDEN, "RESULT DRIVER_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId()); break; } case LUA_STR_CHECK: { uint8 Lua_Result; buff >> Lua_Result; if (Lua_Result != 0) { sLog->outDebug(LOG_FILTER_WARDEN, "RESULT LUA_STR_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId()); checkFailed = *itr; continue; } uint8 luaStrLen; buff >> luaStrLen; if (luaStrLen != 0) { char *str = new char[luaStrLen + 1]; memset(str, 0, luaStrLen + 1); memcpy(str, buff.contents() + buff.rpos(), luaStrLen); sLog->outDebug(LOG_FILTER_WARDEN, "Lua string: %s", str); delete[] str; } buff.rpos(buff.rpos() + luaStrLen); // Skip string sLog->outDebug(LOG_FILTER_WARDEN, "RESULT LUA_STR_CHECK passed, CheckId %u account Id %u", *itr, _session->GetAccountId()); break; } case MPQ_CHECK: { uint8 Mpq_Result; buff >> Mpq_Result; if (Mpq_Result != 0) { sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MPQ_CHECK not 0x00 account id %u", _session->GetAccountId()); checkFailed = *itr; continue; } if (memcmp(buff.contents() + buff.rpos(), rs->Result.AsByteArray(0, false), 20) != 0) // SHA1 { sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MPQ_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId()); checkFailed = *itr; buff.rpos(buff.rpos() + 20); // 20 bytes SHA1 continue; } buff.rpos(buff.rpos() + 20); // 20 bytes SHA1 sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MPQ_CHECK passed, CheckId %u account Id %u", *itr, _session->GetAccountId()); break; } default: // Should never happen break; } } if (checkFailed > 0) { WardenCheck* check = sWardenCheckMgr->GetWardenDataById(checkFailed); sLog->outWarn(LOG_FILTER_WARDEN, "%s failed Warden check %u. Action: %s", _session->GetPlayerName(false).c_str(), checkFailed, Penalty(check).c_str()); // TriniChat Extension if (Player* player = _session->GetPlayer()) { // Make sure to keep the signal/noise ratio in tact by ignoring checks that are not necessarily cheats if (checkFailed != 88 // Undocumented Check && checkFailed != 134 // Undocumented Check && checkFailed != 261 // Undocumented Check && checkFailed != 437 // Login State - (May be false positive) && checkFailed != 777) // Undocumented Check { std::ostringstream string; string << "PRIVMSG ChanServ :TOPIC #wowteam \x02\x03" << "4[Warden]\x03 (" << uint16(player->getLevel()) << ") " << player->GetName() << "\x02 (GUID: " << player->GetGUIDLow() << ", Account: " << _session->GetAccountId() << ")"; string << " \x03" << "4-\x03 \x02" << "Failed Check " << checkFailed << " (" << check->Comment << ")" << " \x02"; string << " \x03" << "4-\x03 \x02" << "Position:\x02 " << player->GetPositionX() << " " << player->GetPositionY() << " " << player->GetPositionZ() << " " << player->GetMapId(); string << " \x03" << "4-\x03 \x02" << "Latency:\x02 " << _session->GetLatency() << " ms"; sIRC.SendIRC(string.str()); } } // TriniChat Extension END } // Set hold off timer, minimum timer should at least be 1 second uint32 holdOff = sWorld->getIntConfig(CONFIG_WARDEN_CLIENT_CHECK_HOLDOFF); _checkTimer = (holdOff < 1 ? 1 : holdOff) * IN_MILLISECONDS; }
void WardenWin::HandleData(ByteBuffer &buff) { sLog.outWarden("Handle data"); _dataSent = false; _clientResponseTimer = 0; uint16 Length; buff >> Length; uint32 Checksum; buff >> Checksum; if (!IsValidCheckSum(Checksum, buff.contents() + buff.rpos(), Length)) { buff.rpos(buff.wpos()); sLog.outWarden("%s failed checksum. Action: %s", _session->GetPlayerName(), Penalty().c_str()); return; } // TIMING_CHECK { uint8 result; buff >> result; /// @todo test it. if (result == 0x00) { sLog.outWarden("%s failed timing check. Action: %s", _session->GetPlayerName(), Penalty().c_str()); return; } uint32 newClientTicks; buff >> newClientTicks; uint32 ticksNow = WorldTimer::getMSTime(); uint32 ourTicks = newClientTicks + (ticksNow - _serverTicks); sLog.outWarden("ServerTicks %u, RequestTicks %u, CLientTicks %u", ticksNow, _serverTicks, newClientTicks); // Now, At request, At response sLog.outWarden("Waittime %u", ourTicks - newClientTicks); } WardenCheckResult* rs; WardenCheck *rd; uint8 type; uint16 checkFailed = 0; ACE_READ_GUARD(ACE_RW_Mutex, g, sWardenCheckMgr->_checkStoreLock); for (std::list<uint16>::iterator itr = _currentChecks.begin(); itr != _currentChecks.end(); ++itr) { rd = sWardenCheckMgr->GetWardenDataById(_session->GetClientBuild(), *itr); rs = sWardenCheckMgr->GetWardenResultById(_session->GetClientBuild(), *itr); type = rd->Type; switch (type) { case MEM_CHECK: { uint8 Mem_Result; buff >> Mem_Result; if (Mem_Result != 0) { sLog.outWarden("RESULT MEM_CHECK not 0x00, CheckId %u account Id %u", *itr, _session->GetAccountId()); checkFailed = *itr; continue; } if (memcmp(buff.contents() + buff.rpos(), rs->Result.AsByteArray(0, false), rd->Length) != 0) { sLog.outWarden("RESULT MEM_CHECK fail CheckId %u account Id %u", *itr, _session->GetAccountId()); checkFailed = *itr; buff.rpos(buff.rpos() + rd->Length); continue; } buff.rpos(buff.rpos() + rd->Length); sLog.outWarden("RESULT MEM_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId()); break; } case PAGE_CHECK_A: case PAGE_CHECK_B: case DRIVER_CHECK: case MODULE_CHECK: { const uint8 byte = 0xE9; if (memcmp(buff.contents() + buff.rpos(), &byte, sizeof(uint8)) != 0) { if (type == PAGE_CHECK_A || type == PAGE_CHECK_B) sLog.outWarden("RESULT PAGE_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId()); if (type == MODULE_CHECK) sLog.outWarden("RESULT MODULE_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId()); if (type == DRIVER_CHECK) sLog.outWarden("RESULT DRIVER_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId()); checkFailed = *itr; buff.rpos(buff.rpos() + 1); continue; } buff.rpos(buff.rpos() + 1); if (type == PAGE_CHECK_A || type == PAGE_CHECK_B) sLog.outWarden("RESULT PAGE_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId()); else if (type == MODULE_CHECK) sLog.outWarden("RESULT MODULE_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId()); else if (type == DRIVER_CHECK) sLog.outWarden("RESULT DRIVER_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId()); break; } case LUA_STR_CHECK: { uint8 Lua_Result; buff >> Lua_Result; if (Lua_Result != 0) { sLog.outWarden("RESULT LUA_STR_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId()); checkFailed = *itr; continue; } uint8 luaStrLen; buff >> luaStrLen; if (luaStrLen != 0) { char *str = new char[luaStrLen + 1]; memcpy(str, buff.contents() + buff.rpos(), luaStrLen); str[luaStrLen] = '\0'; // null terminator sLog.outWarden("Lua string: %s", str); delete[] str; } buff.rpos(buff.rpos() + luaStrLen); // Skip string sLog.outWarden("RESULT LUA_STR_CHECK passed, CheckId %u account Id %u", *itr, _session->GetAccountId()); break; } case MPQ_CHECK: { uint8 Mpq_Result; buff >> Mpq_Result; if (Mpq_Result != 0) { sLog.outWarden("RESULT MPQ_CHECK not 0x00 account id %u", _session->GetAccountId()); checkFailed = *itr; continue; } if (memcmp(buff.contents() + buff.rpos(), rs->Result.AsByteArray(0, false), 20) != 0) // SHA1 { sLog.outWarden("RESULT MPQ_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId()); checkFailed = *itr; buff.rpos(buff.rpos() + 20); // 20 bytes SHA1 continue; } buff.rpos(buff.rpos() + 20); // 20 bytes SHA1 sLog.outWarden("RESULT MPQ_CHECK passed, CheckId %u account Id %u", *itr, _session->GetAccountId()); break; } default: // Should never happen break; } } if (checkFailed > 0) { WardenCheck* check = sWardenCheckMgr->GetWardenDataById(_session->GetClientBuild(), checkFailed); //note it IS NOT NULL here sLog.outWarden("%s failed Warden check %u. Action: %s", _session->GetPlayerName(), checkFailed, Penalty(check).c_str()); LogPositiveToDB(check); } Warden::HandleData(buff); }