From 24b096205c08eef2922b30baf33a5042da1611c5 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Sat, 18 Jun 2022 10:43:03 -0700 Subject: [PATCH] Fixed server exception if no agent signing cert is present. --- meshcentral.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meshcentral.js b/meshcentral.js index 66a7603a..48def834 100644 --- a/meshcentral.js +++ b/meshcentral.js @@ -3003,7 +3003,7 @@ function CreateMeshCentralServer(config, args) { // Load the agent with a random msh added to it. const outStream = new require('stream').Duplex(); outStream.meshAgentBinary = objx.meshAgentBinaries[archid]; - outStream.meshAgentBinary.randomMsh = agentSignCertInfo.cert.subject.hash; + if (agentSignCertInfo) { outStream.meshAgentBinary.randomMsh = agentSignCertInfo.cert.subject.hash; } else { outStream.meshAgentBinary.randomMsh = obj.crypto.randomBytes(16).toString('hex'); } outStream.bufferList = []; outStream._write = function (chunk, encoding, callback) { this.bufferList.push(chunk); if (callback) callback(); }; // Append the chuck. outStream._read = function (size) { }; // Do nothing, this is not going to be called.