mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-21 10:43:36 +00:00
Updated behavior so if agent update is disabled, it will send an agent hash of all zeros to the server, when asked for agent hash. This fixes a bug where the new version of the server only pushes a core, if the hash check succeeds.
This commit is contained in:
@@ -2390,14 +2390,19 @@ void MeshServer_ProcessCommand(ILibWebClient_StateObject WebStateObject, MeshAge
|
|||||||
}
|
}
|
||||||
case MeshCommand_AgentHash:
|
case MeshCommand_AgentHash:
|
||||||
{
|
{
|
||||||
if (agent->disableUpdate != 0) { break; }
|
|
||||||
|
|
||||||
// This is a request for the hash of the agent binary
|
// This is a request for the hash of the agent binary
|
||||||
// Built the response that includes our self hash
|
// Built the response that includes our self hash
|
||||||
MeshCommand_BinaryPacket_CoreModule *rcm = (MeshCommand_BinaryPacket_CoreModule*)ILibScratchPad2;
|
MeshCommand_BinaryPacket_CoreModule *rcm = (MeshCommand_BinaryPacket_CoreModule*)ILibScratchPad2;
|
||||||
rcm->command = htons(MeshCommand_AgentHash); // MeshCommand_AgentHash (12), SHA384 hash of the agent executable
|
rcm->command = htons(MeshCommand_AgentHash); // MeshCommand_AgentHash (12), SHA384 hash of the agent executable
|
||||||
rcm->request = htons(requestid); // Request id
|
rcm->request = htons(requestid); // Request id
|
||||||
|
if (agent->disableUpdate != 0)
|
||||||
|
{
|
||||||
|
memset(rcm->coreModuleHash, 0, UTIL_SHA384_HASHSIZE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
memcpy_s(rcm->coreModuleHash, sizeof(rcm->coreModuleHash), agent->agentHash, UTIL_SHA384_HASHSIZE);// SHA384 hash of the agent executable
|
memcpy_s(rcm->coreModuleHash, sizeof(rcm->coreModuleHash), agent->agentHash, UTIL_SHA384_HASHSIZE);// SHA384 hash of the agent executable
|
||||||
|
}
|
||||||
|
|
||||||
// Send the self hash back to the server
|
// Send the self hash back to the server
|
||||||
ILibWebClient_WebSocket_Send(WebStateObject, ILibWebClient_WebSocket_DataType_BINARY, (char*)rcm, sizeof(MeshCommand_BinaryPacket_CoreModule), ILibAsyncSocket_MemoryOwnership_USER, ILibWebClient_WebSocket_FragmentFlag_Complete);
|
ILibWebClient_WebSocket_Send(WebStateObject, ILibWebClient_WebSocket_DataType_BINARY, (char*)rcm, sizeof(MeshCommand_BinaryPacket_CoreModule), ILibAsyncSocket_MemoryOwnership_USER, ILibWebClient_WebSocket_FragmentFlag_Complete);
|
||||||
|
|||||||
Reference in New Issue
Block a user