- src/game/WorldSession.cpp | 51 ++++++++++++++++++++++++++++++-----------------
- src/game/WorldSession.h | 12 ++++++-----
- 2 files changed, 40 insertions(+), 23 deletions(-)
- diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp
- index 12ea9fe..f6ec7a7 100644
- --- a/src/game/WorldSession.cpp
- +++ b/src/game/WorldSession.cpp
- @@ -38,6 +38,7 @@
- #include "SocialMgr.h"
- #include "Auth/AuthCrypt.h"
- #include "Auth/HMACSHA1.h"
- +#include <openssl/md5.h>
- #include "zlib/zlib.h"
- // select opcodes appropriate for processing in Map::Update context for current session state
- @@ -833,13 +834,13 @@ void WorldSession::ReadAddonsInfo(WorldPacket& data)
- if (uncompress(const_cast<uint8*>(addonInfo.contents()), &uSize, const_cast<uint8*>(data.contents() + pos), data.size() - pos) == Z_OK)
- {
- uint32 addonsCount;
- - addonInfo >> addonsCount; // addons count
- + addonInfo >> addonsCount; // addons count
- for (uint32 i = 0; i < addonsCount; ++i)
- {
- std::string addonName;
- - uint8 enabled;
- - uint32 crc, unk1;
- + uint8 has_pub_key;
- + uint32 pub_key_crc, url_crc;
- // check next addon data format correctness
- if (addonInfo.rpos() + 1 > addonInfo.size())
- @@ -847,15 +848,15 @@ void WorldSession::ReadAddonsInfo(WorldPacket& data)
- addonInfo >> addonName;
- - addonInfo >> enabled >> crc >> unk1;
- + addonInfo >> has_pub_key >> pub_key_crc >> url_crc;
- - DEBUG_LOG("ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk1);
- + DEBUG_LOG("ADDON: Name: %s, has_pub_key: 0x%x, pub_key_crc: 0x%x, url_crc: 0x%x", addonName.c_str(), has_pub_key, pub_key_crc, url_crc);
- - m_addonsList.push_back(AddonInfo(addonName, enabled, crc));
- + m_addonsList.push_back(AddonInfo(addonName, has_pub_key, pub_key_crc, url_crc));
- }
- - uint32 unk2;
- - addonInfo >> unk2;
- + uint32 bannedTimeStamp;
- + addonInfo >> bannedTimeStamp; // LatestBannedAddOnTimestamp
- if (addonInfo.rpos() != addonInfo.size())
- DEBUG_LOG("packet under read!");
- @@ -897,7 +898,7 @@ void WorldSession::SendAddonsInfo()
- data << uint8(unk1);
- if (unk1)
- {
- - uint8 unk2 = (itr->CRC != 0x4c1c776d); // If addon is Standard addon CRC
- + uint8 unk2 = (itr->pub_key_crc != 0x4c1c776d); // If addon is Standard addon CRC
- data << uint8(unk2); // if 1, than add addon public signature
- if (unk2) // if CRC is wrong, add public key (client need it)
- data.append(tdata, sizeof(tdata));
- @@ -916,17 +917,31 @@ void WorldSession::SendAddonsInfo()
- m_addonsList.clear();
- - uint32 count = 0;
- + uint32 count = 1;
- data << uint32(count); // BannedAddons count
- - /*for(uint32 i = 0; i < count; ++i)
- + for (uint32 i = 0; i < count; ++i)
- {
- - uint32
- - string (16 bytes)
- - string (16 bytes)
- - uint32
- - uint32
- - uint32
- - }*/
- + data << uint32(1); // index?
- +
- + MD5_CTX ctx;
- +
- + MD5_Init(&ctx);
- + const char *addon = "LFRAdvanced";
- + MD5_Update(&ctx, addon, strlen(addon));
- + uint8 name_hash[16];
- + MD5_Final(name_hash, &ctx);
- + data.append(name_hash, 16); // Name MD5
- +
- + MD5_Init(&ctx);
- + const char *version = "";
- + MD5_Update(&ctx, version, strlen(version));
- + uint8 version_hash[16];
- + MD5_Final(version_hash, &ctx);
- + data.append(version_hash, 16); // Version MD5
- +
- + data << uint32(time(NULL)); // timestamp?
- + data << uint32(1); // state - should have low bit set! (client checks state & 1)
- + }
- SendPacket(&data);
- }
- diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h
- index 19f40cd..ac1d6d3 100644
- --- a/src/game/WorldSession.h
- +++ b/src/game/WorldSession.h
- @@ -77,16 +77,18 @@ struct AccountData
- struct AddonInfo
- {
- - AddonInfo(const std::string& name, uint8 enabled, uint32 crc) :
- + AddonInfo(const std::string& name, uint8 has_pub_key, uint32 pub_key_crc, uint32 url_crc) :
- Name(name),
- - Enabled(enabled),
- - CRC(crc)
- + has_pub_key(has_pub_key),
- + pub_key_crc(pub_key_crc),
- + url_crc(url_crc)
- {
- }
- std::string Name;
- - uint8 Enabled;
- - uint32 CRC;
- + uint8 has_pub_key;
- + uint32 pub_key_crc;
- + uint32 url_crc;
- };
- typedef std::list<AddonInfo> AddonsList;