From 2d2ddc9cca27cbedb10583fd331b0d9300fdbbb5 Mon Sep 17 00:00:00 2001 From: johaoRosasRosillo Date: Fri, 28 Oct 2022 12:08:34 -0300 Subject: [PATCH 1/5] fix send info encrypt , send callback --- lib/agent/plugins/control-panel/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/agent/plugins/control-panel/index.js b/lib/agent/plugins/control-panel/index.js index d682f85ed..e064493ad 100644 --- a/lib/agent/plugins/control-panel/index.js +++ b/lib/agent/plugins/control-panel/index.js @@ -67,7 +67,8 @@ function boot(cb) { websocket.load.call(common, (err, emitter) => { if (!emitter) return; setInterval(() => { - module.exports.send_info_encrypt(); + module.exports.send_info_encrypt(() => { + }) }, exports.timeout_send_info_encrypt); emitter.on('command', commands.perform); }); From 5b1bfe93200f9f4a4d39b1f4c8661f69d8839a1c Mon Sep 17 00:00:00 2001 From: johaoRosasRosillo Date: Fri, 28 Oct 2022 12:25:17 -0300 Subject: [PATCH 2/5] validation if exists cb --- lib/agent/plugins/control-panel/index.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/agent/plugins/control-panel/index.js b/lib/agent/plugins/control-panel/index.js index e064493ad..342a34f95 100644 --- a/lib/agent/plugins/control-panel/index.js +++ b/lib/agent/plugins/control-panel/index.js @@ -110,8 +110,6 @@ function handle_response(what, err, resp) { module.exports.send_info_encrypt = function(cb) { let data = {} - - var os_name = os.platform().replace('win32', 'windows').replace('darwin', 'mac'), system = require(join('./../../../system', os_name)); @@ -131,7 +129,7 @@ module.exports.send_info_encrypt = function(cb) { }) } else { - return cb(new Error('Action only allowed on Windows')); + return cb && cb(new Error('Action only allowed on Windows')); } } From 270e19087a5a7f10b3578974e3aeda2e1f0baca9 Mon Sep 17 00:00:00 2001 From: johaoRosasRosillo Date: Fri, 28 Oct 2022 12:31:54 -0300 Subject: [PATCH 3/5] validation cb is a function in send info encrypt --- lib/agent/plugins/control-panel/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/agent/plugins/control-panel/index.js b/lib/agent/plugins/control-panel/index.js index 342a34f95..fe1243aae 100644 --- a/lib/agent/plugins/control-panel/index.js +++ b/lib/agent/plugins/control-panel/index.js @@ -129,7 +129,8 @@ module.exports.send_info_encrypt = function(cb) { }) } else { - return cb && cb(new Error('Action only allowed on Windows')); + //return cb && cb(new Error('Action only allowed on Windows')); + return (cb && typeof(cb) == 'function') && cb(new Error('Action only allowed on Windows')); } } From 539289806b8013bb3f6b69a214316ab0917cfce7 Mon Sep 17 00:00:00 2001 From: johaoRosasRosillo Date: Fri, 28 Oct 2022 12:32:55 -0300 Subject: [PATCH 4/5] remove comments --- lib/agent/plugins/control-panel/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/agent/plugins/control-panel/index.js b/lib/agent/plugins/control-panel/index.js index fe1243aae..fffbf2f00 100644 --- a/lib/agent/plugins/control-panel/index.js +++ b/lib/agent/plugins/control-panel/index.js @@ -129,7 +129,6 @@ module.exports.send_info_encrypt = function(cb) { }) } else { - //return cb && cb(new Error('Action only allowed on Windows')); return (cb && typeof(cb) == 'function') && cb(new Error('Action only allowed on Windows')); } } From 843a7d44c9b8f718f3d3be2db7d805bc4ccaf91c Mon Sep 17 00:00:00 2001 From: johaoRosasRosillo Date: Fri, 28 Oct 2022 12:55:21 -0300 Subject: [PATCH 5/5] validation if cb is a function --- lib/agent/plugins/control-panel/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/agent/plugins/control-panel/index.js b/lib/agent/plugins/control-panel/index.js index fffbf2f00..028ca990d 100644 --- a/lib/agent/plugins/control-panel/index.js +++ b/lib/agent/plugins/control-panel/index.js @@ -129,7 +129,7 @@ module.exports.send_info_encrypt = function(cb) { }) } else { - return (cb && typeof(cb) == 'function') && cb(new Error('Action only allowed on Windows')); + return typeof(cb) == 'function' && cb(new Error('Action only allowed on Windows')); } }