Merge remote-tracking branch 'origin/develop' into ent-7730-visualizacion-update-manager-en-tema-oscuro

This commit is contained in:
marcos 2021-07-07 14:15:03 +02:00
commit 6252da395c
29 changed files with 159 additions and 30 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix
Version: 7.0NG.755-210706
Version: 7.0NG.755-210707
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.755-210706"
pandora_version="7.0NG.755-210707"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1015,7 +1015,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.755';
use constant AGENT_BUILD => '210706';
use constant AGENT_BUILD => '210707';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.755
%define release 210706
%define release 210707
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.755
%define release 210706
%define release 210707
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}

View File

@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.755"
PI_BUILD="210706"
PI_BUILD="210707"
OS_NAME=`uname -s`
FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
{210706}
{210707}
ViewReadme
{Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.755 Build 210706")
#define PANDORA_VERSION ("7.0NG.755 Build 210707")
string pandora_path;
string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.755(Build 210706))"
VALUE "ProductVersion", "(7.0NG.755(Build 210707))"
VALUE "FileVersion", "1.0.0.0"
END
END

View File

@ -1,5 +1,5 @@
package: pandorafms-console
Version: 7.0NG.755-210706
Version: 7.0NG.755-210707
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.755-210706"
pandora_version="7.0NG.755-210707"
package_pear=0
package_pandora=1

View File

@ -23,4 +23,6 @@ UPDATE `tuser_task_scheduled` SET
ALTER TABLE `tlayout` ADD COLUMN `auto_adjust` INTEGER UNSIGNED NOT NULL default 0;
DELETE ta FROM `tagente` ta LEFT JOIN `tgrupo` tg on ta.`id_grupo` = tg.`id_grupo` WHERE tg.`id_grupo` IS NULL;
COMMIT;

View File

@ -20,7 +20,7 @@
/**
* Pandora build version and version
*/
$build_version = 'PC210706';
$build_version = 'PC210707';
$pandora_version = 'v7.0NG.755';
// Do not overwrite default timezone set if defined.

View File

@ -3958,7 +3958,7 @@ function api_set_create_plugin_module($id, $thrash1, $other, $thrash3)
'plugin_pass' => $other['data'][24],
'plugin_parameter' => $other['data'][25],
'disabled_types_event' => $disabled_types_event,
'macros' => base64_decode($other['data'][27]),
'macros' => base64_decode(str_replace('&#x20', '+', $other['data'][27])),
'module_macros' => $other['data'][28],
'each_ff' => $other['data'][29],
'min_ff_event_normal' => $other['data'][30],
@ -3969,6 +3969,22 @@ function api_set_create_plugin_module($id, $thrash1, $other, $thrash3)
'ff_type' => $other['data'][35],
];
$plugin = db_get_row('tplugin', 'id', $values['id_plugin']);
if (empty($plugin)) {
returnError('id_not_found');
return;
}
$plugin_command_macros = $plugin['macros'];
if (!empty($values['macros'])) {
$macros = io_safe_input_json($values['macros']);
if (empty($macros)) {
returnError('JSON string in macros is invalid.');
exit;
}
$values['macros'] = io_merge_json_value($plugin_command_macros, $macros);
}
if (! $values['descripcion']) {
$values['descripcion'] = '';
// Column 'descripcion' cannot be null.
@ -4119,13 +4135,29 @@ function api_set_update_plugin_module($id_module, $thrash1, $other, $thrash3)
$values[$field] = $other['data'][$cont];
if ($field === 'macros') {
$values[$field] = base64_decode($values[$field]);
$values[$field] = base64_decode(str_replace('&#x20', '+', $values[$field]));
}
}
$cont++;
}
$plugin = db_get_row('tplugin', 'id', $values['id_plugin']);
if (empty($plugin)) {
returnError('id_not_found');
return;
}
$plugin_command_macros = $plugin['macros'];
if (!empty($values['macros'])) {
$macros = io_safe_input_json($values['macros']);
if (empty($macros)) {
returnError('JSON string in macros is invalid.');
exit;
}
$values['macros'] = io_merge_json_value($plugin_command_macros, $macros);
}
$values['policy_linked'] = 0;
$result_update = modules_update_agent_module($id_module, $values);
@ -8205,7 +8237,7 @@ function api_set_add_plugin_module_policy($id, $thrash1, $other, $thrash3)
return;
}
if ($other['data'][22] == '') {
if ($other['data'][21] == '') {
returnError('The plugin module could not be added. Id_plugin cannot be left blank.');
return;
}
@ -8248,7 +8280,7 @@ function api_set_add_plugin_module_policy($id, $thrash1, $other, $thrash3)
$values['plugin_pass'] = $other['data'][23];
$values['plugin_parameter'] = $other['data'][24];
$values['disabled_types_event'] = $disabled_types_event;
$values['macros'] = base64_decode($other['data'][26]);
$values['macros'] = base64_decode(str_replace('&#x20', '+', $other['data'][26]));
$values['module_macros'] = $other['data'][27];
$values['each_ff'] = $other['data'][28];
$values['min_ff_event_normal'] = $other['data'][29];
@ -8263,6 +8295,22 @@ function api_set_add_plugin_module_policy($id, $thrash1, $other, $thrash3)
}
}
$plugin = db_get_row('tplugin', 'id', $values['id_plugin']);
if (empty($plugin)) {
returnError('id_not_found');
return;
}
$plugin_command_macros = $plugin['macros'];
if (!empty($values['macros'])) {
$macros = io_safe_input_json($values['macros']);
if (empty($macros)) {
returnError('JSON string in macros is invalid.');
exit;
}
$values['macros'] = io_merge_json_value($plugin_command_macros, $macros);
}
$success = enterprise_hook('policies_create_module', [$other['data'][0], $id, 4, $values, false]);
if ($success) {

View File

@ -622,3 +622,82 @@ function io_safe_html_tags(string $string)
return $output;
}
/**
* Execute io_safe_input againt each values in JSON.
*
* @param string json
*
* @return string json where each value is encoded
*/
function io_safe_input_json($json)
{
$output_json = "";
if (empty($json)) {
return $output_json;
}
$array_json = json_decode($json, true);
if (json_last_error() != JSON_ERROR_NONE) {
return $output_json;
}
foreach ($array_json as $key => $value) {
if (is_array($value)) {
$value_json = json_encode($value, JSON_UNESCAPED_UNICODE);
$array_json[$key] = json_decode(io_safe_input_json($value_json), true);
} else {
$array_json[$key] = io_safe_input($value);
}
}
$output_json = json_encode($array_json, JSON_UNESCAPED_UNICODE);
return $output_json;
}
/**
* Merge json value in $json_merge to $json
*
* @param string json to be merged.
* @param string json containing the values to merge.
* @param boolean limit the values to be merged to those with a key of 'value', true by default.
*
* @retrun string merged json
*
* e.g.)
* arg1 json: {"1":{"macro":"_field1_","desc":"DESCRIPTION","help":"HELP","value":"","hide":""}}
* arg2 json: {"1":{"value":"xxxx"}}
* -> return json: {"1":{"macro":"_field1_","desc":"DESCRIPTION","help":"HELP","value":"xxxx","hide":""}}
*/
function io_merge_json_value($json, $json_merge, $value_key_only=true)
{
$output_json = "";
$array_json = json_decode($json, true);
if (json_last_error() != JSON_ERROR_NONE) {
return $output_json;
}
$array_json_merge = json_decode($json_merge, true);
if (json_last_error() != JSON_ERROR_NONE) {
return $output_json;
}
foreach ($array_json_merge as $key => $value) {
if (is_array($value) && !empty($array_json[$key])) {
$merged_json = io_merge_json_value(
json_encode($array_json[$key], JSON_UNESCAPED_UNICODE),
json_encode($value, JSON_UNESCAPED_UNICODE),
$value_key_only);
$array_json[$key] = json_decode($merged_json, true);
} else {
if (array_key_exists($key, $array_json) &&
($value_key_only == false || $key == 'value')) {
$array_json[$key] = $array_json_merge[$key];
}
}
}
$output_json = json_encode($array_json, JSON_UNESCAPED_UNICODE);
return $output_json;
}

View File

@ -351,7 +351,7 @@ ul.tree-group
/* login.css */
div.login_nick input,
div.login_pass input {
background-color: #fff !important;
background-color: #111 !important;
}
/* user edit */

View File

@ -129,7 +129,7 @@
<div style='height: 10px'>
<?php
$version = '7.0NG.755';
$build = '210706';
$build = '210707';
$banner = "v$version Build $build";
error_reporting(0);

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.755
%define release 210706
%define release 210707
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.755
%define release 210706
%define release 210707
# User and Group under which Apache is running
%define httpd_name httpd

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_console
%define version 7.0NG.755
%define release 210706
%define release 210707
%define httpd_name httpd
# User and Group under which Apache is running
%define httpd_name apache2

View File

@ -1,5 +1,5 @@
package: pandorafms-server
Version: 7.0NG.755-210706
Version: 7.0NG.755-210707
Architecture: all
Priority: optional
Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
pandora_version="7.0NG.755-210706"
pandora_version="7.0NG.755-210707"
package_cpan=0
package_pandora=1

View File

@ -45,7 +45,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.755";
my $pandora_build = "210706";
my $pandora_build = "210707";
our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash

View File

@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.755";
my $pandora_build = "210706";
my $pandora_build = "210707";
our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.755
%define release 210706
%define release 210707
Summary: Pandora FMS Server
Name: %{name}

View File

@ -3,7 +3,7 @@
#
%define name pandorafms_server
%define version 7.0NG.755
%define release 210706
%define release 210707
Summary: Pandora FMS Server
Name: %{name}

View File

@ -9,7 +9,7 @@
# **********************************************************************
PI_VERSION="7.0NG.755"
PI_BUILD="210706"
PI_BUILD="210707"
MODE=$1
if [ $# -gt 1 ]; then

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB;
# version: define current version
my $version = "7.0NG.755 Build 210706";
my $version = "7.0NG.755 Build 210707";
# Pandora server configuration
my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv;
# version: define current version
my $version = "7.0NG.755 Build 210706";
my $version = "7.0NG.755 Build 210707";
# save program name for logging
my $progname = basename($0);