Fixed server exception if no agent signing cert is present.
Ylian Saint-Hilaire committed
Jun 18, 2022 at 10:43 UTC
24b096205c08eef2922b30baf33a5042da1611c5
1 file changed
+1
-1
meshcentral.js
+1
-1
@@ -3003,7 +3003,7 @@ function CreateMeshCentralServer(config, args) {
3003
// Load the agent with a random msh added to it.
3004
const outStream = new require('stream').Duplex();
3005
outStream.meshAgentBinary = objx.meshAgentBinaries[archid];
3006
- outStream.meshAgentBinary.randomMsh = agentSignCertInfo.cert.subject.hash;
3006
+ if (agentSignCertInfo) { outStream.meshAgentBinary.randomMsh = agentSignCertInfo.cert.subject.hash; } else { outStream.meshAgentBinary.randomMsh = obj.crypto.randomBytes(16).toString('hex'); }
3007
outStream.bufferList = [];
3008
outStream._write = function (chunk, encoding, callback) { this.bufferList.push(chunk); if (callback) callback(); }; // Append the chuck.
3009
outStream._read = function (size) { }; // Do nothing, this is not going to be called.