fix: adapt the login packet tests to a session key that differs every time

The tests compared the login response and SET_SESSION_KEY of the old
hand written code with the structs byte for byte, with the same seed
for both. The key no longer comes from the seeded engine, so the tests
leave its bytes out, and the copy of the old code writes the key the
way main writes it now.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-11-10 16:48:56 -06:00
parent 83a82355d0
commit ead394d991
2 changed files with 27 additions and 6 deletions

View File

@@ -117,10 +117,8 @@ inline void SendLoginResponse(dServer* server, const SystemAddress& sysAddr, eLo
loginResponse.Write(version_minor);
// Writes the user key
uint32_t sessionKey = GeneralUtils::GenerateRandomNumber<uint32_t>();
std::string userHash = std::to_string(sessionKey);
userHash = md5(userHash);
loginResponse.Write(LUWString(userHash));
const std::string sessionKey = GeneralUtils::GenerateUnpredictableHexString(16);
loginResponse.Write(LUWString(sessionKey));
// World Server IP
loginResponse.Write(LUString(wServerIP));
@@ -162,7 +160,7 @@ inline void SendLoginResponse(dServer* server, const SystemAddress& sysAddr, eLo
if (responseCode == eLoginResponse::SUCCESS) {
CBITSTREAM;
BitStreamUtils::WriteHeader(bitStream, ServiceType::MASTER, MessageType::Master::SET_SESSION_KEY);
bitStream.Write(sessionKey);
bitStream.Write(LUString(sessionKey));
bitStream.Write(LUString(username));
server->SendToMaster(bitStream);