1. src/game/WorldSession.cpp | 51 ++++++++++++++++++++++++++++++-----------------
  2. src/game/WorldSession.h | 12 ++++++-----
  3. 2 files changed, 40 insertions(+), 23 deletions(-)
  4. diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp
  5. index 12ea9fe..f6ec7a7 100644
  6. --- a/src/game/WorldSession.cpp
  7. +++ b/src/game/WorldSession.cpp
  8. @@ -38,6 +38,7 @@
  9. #include "SocialMgr.h"
  10. #include "Auth/AuthCrypt.h"
  11. #include "Auth/HMACSHA1.h"
  12. +#include <openssl/md5.h>
  13. #include "zlib/zlib.h"
  14. // select opcodes appropriate for processing in Map::Update context for current session state
  15. @@ -833,13 +834,13 @@ void WorldSession::ReadAddonsInfo(WorldPacket& data)
  16. if (uncompress(const_cast<uint8*>(addonInfo.contents()), &uSize, const_cast<uint8*>(data.contents() + pos), data.size() - pos) == Z_OK)
  17. {
  18. uint32 addonsCount;
  19. - addonInfo >> addonsCount; // addons count
  20. + addonInfo >> addonsCount; // addons count
  21. for (uint32 i = 0; i < addonsCount; ++i)
  22. {
  23. std::string addonName;
  24. - uint8 enabled;
  25. - uint32 crc, unk1;
  26. + uint8 has_pub_key;
  27. + uint32 pub_key_crc, url_crc;
  28. // check next addon data format correctness
  29. if (addonInfo.rpos() + 1 > addonInfo.size())
  30. @@ -847,15 +848,15 @@ void WorldSession::ReadAddonsInfo(WorldPacket& data)
  31. addonInfo >> addonName;
  32. - addonInfo >> enabled >> crc >> unk1;
  33. + addonInfo >> has_pub_key >> pub_key_crc >> url_crc;
  34. - DEBUG_LOG("ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk1);
  35. + 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);
  36. - m_addonsList.push_back(AddonInfo(addonName, enabled, crc));
  37. + m_addonsList.push_back(AddonInfo(addonName, has_pub_key, pub_key_crc, url_crc));
  38. }
  39. - uint32 unk2;
  40. - addonInfo >> unk2;
  41. + uint32 bannedTimeStamp;
  42. + addonInfo >> bannedTimeStamp; // LatestBannedAddOnTimestamp
  43. if (addonInfo.rpos() != addonInfo.size())
  44. DEBUG_LOG("packet under read!");
  45. @@ -897,7 +898,7 @@ void WorldSession::SendAddonsInfo()
  46. data << uint8(unk1);
  47. if (unk1)
  48. {
  49. - uint8 unk2 = (itr->CRC != 0x4c1c776d); // If addon is Standard addon CRC
  50. + uint8 unk2 = (itr->pub_key_crc != 0x4c1c776d); // If addon is Standard addon CRC
  51. data << uint8(unk2); // if 1, than add addon public signature
  52. if (unk2) // if CRC is wrong, add public key (client need it)
  53. data.append(tdata, sizeof(tdata));
  54. @@ -916,17 +917,31 @@ void WorldSession::SendAddonsInfo()
  55. m_addonsList.clear();
  56. - uint32 count = 0;
  57. + uint32 count = 1;
  58. data << uint32(count); // BannedAddons count
  59. - /*for(uint32 i = 0; i < count; ++i)
  60. + for (uint32 i = 0; i < count; ++i)
  61. {
  62. - uint32
  63. - string (16 bytes)
  64. - string (16 bytes)
  65. - uint32
  66. - uint32
  67. - uint32
  68. - }*/
  69. + data << uint32(1); // index?
  70. +
  71. + MD5_CTX ctx;
  72. +
  73. + MD5_Init(&ctx);
  74. + const char *addon = "LFRAdvanced";
  75. + MD5_Update(&ctx, addon, strlen(addon));
  76. + uint8 name_hash[16];
  77. + MD5_Final(name_hash, &ctx);
  78. + data.append(name_hash, 16); // Name MD5
  79. +
  80. + MD5_Init(&ctx);
  81. + const char *version = "";
  82. + MD5_Update(&ctx, version, strlen(version));
  83. + uint8 version_hash[16];
  84. + MD5_Final(version_hash, &ctx);
  85. + data.append(version_hash, 16); // Version MD5
  86. +
  87. + data << uint32(time(NULL)); // timestamp?
  88. + data << uint32(1); // state - should have low bit set! (client checks state & 1)
  89. + }
  90. SendPacket(&data);
  91. }
  92. diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h
  93. index 19f40cd..ac1d6d3 100644
  94. --- a/src/game/WorldSession.h
  95. +++ b/src/game/WorldSession.h
  96. @@ -77,16 +77,18 @@ struct AccountData
  97. struct AddonInfo
  98. {
  99. - AddonInfo(const std::string& name, uint8 enabled, uint32 crc) :
  100. + AddonInfo(const std::string& name, uint8 has_pub_key, uint32 pub_key_crc, uint32 url_crc) :
  101. Name(name),
  102. - Enabled(enabled),
  103. - CRC(crc)
  104. + has_pub_key(has_pub_key),
  105. + pub_key_crc(pub_key_crc),
  106. + url_crc(url_crc)
  107. {
  108. }
  109. std::string Name;
  110. - uint8 Enabled;
  111. - uint32 CRC;
  112. + uint8 has_pub_key;
  113. + uint32 pub_key_crc;
  114. + uint32 url_crc;
  115. };
  116. typedef std::list<AddonInfo> AddonsList;