mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-20 18:55:28 +00:00
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:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user