From 3e73a52df1b600233f4adf371fabe0247b3eef17 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Thu, 20 Oct 2022 12:41:10 +0200 Subject: [PATCH] Add pandora_agent_exec.exe to the win32 agent. --- .../win32/bin/util/pandora_agent_exec.exe | 3 +++ pandora_server/lib/PandoraFMS/Omnishell.pm | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 pandora_agents/win32/bin/util/pandora_agent_exec.exe diff --git a/pandora_agents/win32/bin/util/pandora_agent_exec.exe b/pandora_agents/win32/bin/util/pandora_agent_exec.exe new file mode 100644 index 0000000000..29599adc28 --- /dev/null +++ b/pandora_agents/win32/bin/util/pandora_agent_exec.exe @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7b6c28a6b03b3c10f17f016d30539b5a7e704f86a76af26bfcb343358d325857 +size 4780527 diff --git a/pandora_server/lib/PandoraFMS/Omnishell.pm b/pandora_server/lib/PandoraFMS/Omnishell.pm index ebfb247183..5867d9e854 100644 --- a/pandora_server/lib/PandoraFMS/Omnishell.pm +++ b/pandora_server/lib/PandoraFMS/Omnishell.pm @@ -449,22 +449,22 @@ sub cleanup_old_commands { } ################################################################################ -# Executes a command using defined timeout. +# Executes a command. ################################################################################ sub execute_command_timeout { - my ($self, $cmd, $timeout) = @_; + my ($self, $cmd, $std_files, $timeout) = @_; if (!defined($timeout) || !looks_like_number($timeout) || $timeout <= 0 ) { - `$cmd`; + `($cmd) $std_files`; } elsif ($^O eq 'MSWin32') { - `pandora_agent_exec.exe $timeout $cmd`; + `(pandora_agent_exec.exe $timeout $cmd) $std_files`; } else { - `pandora_agent_exec $timeout $cmd`; + `(pandora_agent_exec $timeout $cmd) $std_files`; } - + return $?>>8; } @@ -490,7 +490,8 @@ sub execute_command_block { do { $err_level = $self->execute_command_timeout( - "($commands) $std_files", + $commands, + $std_files, $timeout ); @@ -506,7 +507,8 @@ sub execute_command_block { do { $err_level = $self->execute_command_timeout( - "($comm) $std_files", + $comm, + $std_files, $timeout );