Merge remote-tracking branch 'origin/develop' into ent-3357-7329-comision-europea-ordenar-consolas-por-nombre-en-metaconsola-y-anadir-buscador

This commit is contained in:
fbsanchez 2020-09-17 11:51:29 +02:00
commit 79bedb4982
36 changed files with 98 additions and 53 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.749-200916 Version: 7.0NG.749-200917
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.749" PI_VERSION="7.0NG.749"
PI_BUILD="200916" PI_BUILD="200917"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{200916} {200917}
ViewReadme ViewReadme
{Yes} {Yes}

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.749-200916 Version: 7.0NG.749-200917
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

@ -116,7 +116,7 @@ if ($create_special_day) {
$same_day = (string) get_parameter('same_day'); $same_day = (string) get_parameter('same_day');
$values = []; $values = [];
$values['id_group'] = (string) get_parameter('id_group'); $values['id_group'] = (string) get_parameter('id_group');
$values['description'] = (string) get_parameter('description'); $values['description'] = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description'))));
$aviable_description = true; $aviable_description = true;
if (preg_match('/script/i', $values['description'])) { if (preg_match('/script/i', $values['description'])) {
@ -180,7 +180,7 @@ if ($update_special_day) {
$date = (string) get_parameter('date'); $date = (string) get_parameter('date');
$date_orig = (string) get_parameter('date_orig'); $date_orig = (string) get_parameter('date_orig');
$same_day = (string) get_parameter('same_day'); $same_day = (string) get_parameter('same_day');
$description = (string) get_parameter('description'); $description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description'))));
$id_group = (string) get_parameter('id_group'); $id_group = (string) get_parameter('id_group');
$id_group_orig = (string) get_parameter('id_group_orig'); $id_group_orig = (string) get_parameter('id_group_orig');
@ -515,7 +515,11 @@ for ($month = 1; $month <= 12; $month++) {
break; break;
} }
$cal_table->data[$cal_line][$week] .= ui_print_help_tip($special_day['description'], true); // Only show description if is filled.
if (empty($special_day['description']) === false) {
$cal_table->data[$cal_line][$week] .= ui_print_help_tip($special_day['description'], true);
}
if ($special_day['id_group'] || ($can_manage_group_all && $special_day['id_group'] == 0)) { if ($special_day['id_group'] || ($can_manage_group_all && $special_day['id_group'] == 0)) {
$cal_table->data[$cal_line][$week] .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_special_days&id='.$special_day['id'].'" title='; $cal_table->data[$cal_line][$week] .= '<a href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_special_days&id='.$special_day['id'].'" title=';
$cal_table->data[$cal_line][$week] .= __('Edit'); $cal_table->data[$cal_line][$week] .= __('Edit');

View File

@ -81,8 +81,8 @@ if (defined('METACONSOLE')) {
} }
$type = (int) get_parameter('type'); $type = (int) get_parameter('type');
$name = (string) get_parameter('name'); $name = io_safe_input(strip_tags(io_safe_output((string) get_parameter('name'))));
$description = (string) get_parameter('description'); $description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description'))));
$max = (int) get_parameter('max'); $max = (int) get_parameter('max');
$min = (int) get_parameter('min'); $min = (int) get_parameter('min');
$tcp_send = (string) get_parameter('tcp_send'); $tcp_send = (string) get_parameter('tcp_send');

View File

@ -37,8 +37,8 @@ if ($idOS) {
$description = $os['description']; $description = $os['description'];
$icon = $os['icon_name']; $icon = $os['icon_name'];
} else { } else {
$name = get_parameter('name', ''); $name = io_safe_input(strip_tags(io_safe_output((string) get_parameter('name'))));
$description = get_parameter('description', ''); $description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description'))));
$icon = get_parameter('icon', 0); $icon = get_parameter('icon', 0);
} }
@ -91,8 +91,8 @@ switch ($action) {
break; break;
case 'update': case 'update':
$name = get_parameter('name', ''); $name = io_safe_input(strip_tags(io_safe_output((string) get_parameter('name'))));
$description = get_parameter('description', ''); $description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description'))));
$icon = get_parameter('icon', 0); $icon = get_parameter('icon', 0);
$values = []; $values = [];

View File

@ -313,7 +313,7 @@ if ($create_user) {
$password_confirm = (string) get_parameter('password_confirm', ''); $password_confirm = (string) get_parameter('password_confirm', '');
$values['email'] = (string) get_parameter('email'); $values['email'] = (string) get_parameter('email');
$values['phone'] = (string) get_parameter('phone'); $values['phone'] = (string) get_parameter('phone');
$values['comments'] = (string) get_parameter('comments'); $values['comments'] = io_safe_input(strip_tags(io_safe_output((string) get_parameter('comments'))));
$values['is_admin'] = $user_is_admin; $values['is_admin'] = $user_is_admin;
$values['language'] = get_parameter('language', 'default'); $values['language'] = get_parameter('language', 'default');
$values['timezone'] = (string) get_parameter('timezone'); $values['timezone'] = (string) get_parameter('timezone');
@ -500,7 +500,7 @@ if ($update_user) {
$values['lastname'] = (string) get_parameter('lastname'); $values['lastname'] = (string) get_parameter('lastname');
$values['email'] = (string) get_parameter('email'); $values['email'] = (string) get_parameter('email');
$values['phone'] = (string) get_parameter('phone'); $values['phone'] = (string) get_parameter('phone');
$values['comments'] = (string) get_parameter('comments'); $values['comments'] = io_safe_input(strip_tags(io_safe_output((string) get_parameter('comments'))));
$values['is_admin'] = get_parameter('is_admin', 0); $values['is_admin'] = get_parameter('is_admin', 0);
$values['language'] = (string) get_parameter('language'); $values['language'] = (string) get_parameter('language');
$values['timezone'] = (string) get_parameter('timezone'); $values['timezone'] = (string) get_parameter('timezone');

View File

@ -495,8 +495,8 @@ class ConfigPEN extends HTML
public function add() public function add()
{ {
$pen = get_parameter('pen', 0); $pen = get_parameter('pen', 0);
$manufacturer = get_parameter('manufacturer', ''); $manufacturer = io_safe_input(strip_tags(io_safe_output((string) get_parameter('manufacturer'))));
$description = get_parameter('description', ''); $description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description'))));
$is_new = (bool) get_parameter('is_new', false); $is_new = (bool) get_parameter('is_new', false);
if (empty($pen)) { if (empty($pen)) {

View File

@ -180,7 +180,7 @@ class ManageNetScanScripts extends Wizard
$result = []; $result = [];
$reconscript_name = get_parameter('form_name', ''); $reconscript_name = get_parameter('form_name', '');
$reconscript_description = get_parameter('form_description', ''); $reconscript_description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('form_description'))));
$reconscript_script = get_parameter('form_script', ''); $reconscript_script = get_parameter('form_script', '');
// Get macros. // Get macros.
@ -260,7 +260,7 @@ class ManageNetScanScripts extends Wizard
// If modified any parameter. // If modified any parameter.
$reconscript_name = get_parameter('form_name', ''); $reconscript_name = get_parameter('form_name', '');
$reconscript_description = get_parameter('form_description', ''); $reconscript_description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('form_description'))));
$reconscript_script = get_parameter('form_script', ''); $reconscript_script = get_parameter('form_script', '');
// Get macros. // Get macros.

View File

@ -303,8 +303,8 @@ class ModuleTemplates extends HTML
if (!empty($this->action)) { if (!empty($this->action)) {
// Success variable. // Success variable.
$success = false; $success = false;
$this->name = get_parameter('name', ''); $this->name = io_safe_input(strip_tags(io_safe_output((string) get_parameter('name'))));
$this->description = get_parameter('description', ''); $this->description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description'))));
$this->pen = get_parameter('pen', ''); $this->pen = get_parameter('pen', '');
switch ($this->action) { switch ($this->action) {

View File

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

View File

@ -372,6 +372,9 @@ define('MODULE_PREDICTION_CLUSTER_AP', 7);
// Forced agent OS ID for cluster agents. // Forced agent OS ID for cluster agents.
define('CLUSTER_OS_ID', 100); define('CLUSTER_OS_ID', 100);
// Forced agent OS ID for satellite agents.
define('SATELLITE_OS_ID', 19);
// Type of Webserver Modules. // Type of Webserver Modules.
define('MODULE_WEBSERVER_CHECK_LATENCY', 30); define('MODULE_WEBSERVER_CHECK_LATENCY', 30);
define('MODULE_WEBSERVER_CHECK_SERVER_RESPONSE', 31); define('MODULE_WEBSERVER_CHECK_SERVER_RESPONSE', 31);

View File

@ -4360,7 +4360,8 @@ function html_print_input($data, $wrapper='div', $input_only=false)
((isset($data['value']) === true) ? $data['value'] : ''), ((isset($data['value']) === true) ? $data['value'] : ''),
((isset($data['attributes']) === true) ? $data['attributes'] : ''), ((isset($data['attributes']) === true) ? $data['attributes'] : ''),
((isset($data['return']) === true) ? $data['return'] : false), ((isset($data['return']) === true) ? $data['return'] : false),
((isset($data['class']) === true) ? $data['class'] : '') ((isset($data['class']) === true) ? $data['class'] : ''),
((isset($data['disabled']) === true) ? $data['disabled'] : false)
); );
break; break;

View File

@ -63,11 +63,16 @@ class Agent extends Entity
) { ) {
$table = 'tagente'; $table = 'tagente';
$filter = ['id_agente' => $id_agent]; $filter = ['id_agente' => $id_agent];
$enterprise_class = '\PandoraFMS\Enterprise\Agent';
if (is_numeric($id_agent) === true if (is_numeric($id_agent) === true
&& $id_agent > 0 && $id_agent > 0
) { ) {
parent::__construct($table, $filter); parent::__construct(
$table,
$filter,
$enterprise_class
);
if ($load_modules === true) { if ($load_modules === true) {
$rows = \db_get_all_rows_filter( $rows = \db_get_all_rows_filter(
'tagente_modulo', 'tagente_modulo',
@ -84,7 +89,7 @@ class Agent extends Entity
} }
} else { } else {
// Create empty skel. // Create empty skel.
parent::__construct($table); parent::__construct($table, null, $enterprise_class);
// New agent has no modules. // New agent has no modules.
$this->modulesLoaded = true; $this->modulesLoaded = true;
@ -408,11 +413,12 @@ class Agent extends Entity
/** /**
* Search for modules into this agent. * Search for modules into this agent.
* *
* @param array $filter Filters. * @param array $filter Filters.
* @param integer $limit Limit search results.
* *
* @return PandoraFMS\Module Module found. * @return PandoraFMS\Module Module found.
*/ */
public function searchModules(array $filter) public function searchModules(array $filter, int $limit=0)
{ {
$filter['id_agente'] = $this->id_agente(); $filter['id_agente'] = $this->id_agente();
@ -423,7 +429,7 @@ class Agent extends Entity
foreach ($this->modules as $module) { foreach ($this->modules as $module) {
$found = true; $found = true;
foreach ($filter as $field => $value) { foreach ($filter as $field => $value) {
if ($module->{$field}() !== $value) { if ($module->{$field}() != $value) {
$found = false; $found = false;
break; break;
} }
@ -437,7 +443,7 @@ class Agent extends Entity
return $results; return $results;
} else { } else {
// Search in db. // Search in db.
return Module::search($filter); return Module::search($filter, $limit);
} }
} }

View File

@ -50,6 +50,13 @@ abstract class Entity
*/ */
protected $table = ''; protected $table = '';
/**
* Enterprise capabilities object.
*
* @var object
*/
private $enterprise;
/** /**
* Instances a new object using array definition. * Instances a new object using array definition.
@ -74,13 +81,17 @@ abstract class Entity
/** /**
* Defines a generic constructor to extract information of the object. * Defines a generic constructor to extract information of the object.
* *
* @param string $table Table. * @param string $table Table.
* @param array $filters Filters, for instance ['id' => $id]. * @param array|null $filters Filters, for instance ['id' => $id].
* @param string|null $enterprise_class Enterprise class name.
* *
* @throws \Exception On error. * @throws \Exception On error.
*/ */
public function __construct(string $table, ?array $filters=null) public function __construct(
{ string $table,
?array $filters=null,
?string $enterprise_class=null
) {
if (empty($table) === true) { if (empty($table) === true) {
throw new \Exception( throw new \Exception(
get_class($this).' error, table name is not defined' get_class($this).' error, table name is not defined'
@ -116,6 +127,12 @@ abstract class Entity
$this->fields[$row['Field']] = null; $this->fields[$row['Field']] = null;
} }
} }
if (\enterprise_installed() === true
&& $enterprise_class !== null
) {
$this->enterprise = new $enterprise_class($this);
}
} }
@ -135,6 +152,20 @@ abstract class Entity
return $this->{$methodName}($params); return $this->{$methodName}($params);
} }
// Enterprise capabilities.
if (\enterprise_installed() === true
&& $this->enterprise !== null
&& method_exists($this->enterprise, $methodName) === true
) {
return call_user_func_array(
[
$this->enterprise,
$methodName,
],
$params
);
}
if (array_key_exists($methodName, $this->fields) === true) { if (array_key_exists($methodName, $this->fields) === true) {
if (empty($params) === true) { if (empty($params) === true) {
return $this->fields[$methodName]; return $this->fields[$methodName];

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.749-200916 Version: 7.0NG.749-200917
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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