diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control
index 065c44aa1c..cc77419afa 100644
--- a/pandora_agents/unix/DEBIAN/control
+++ b/pandora_agents/unix/DEBIAN/control
@@ -1,5 +1,5 @@
package: pandorafms-agent-unix
-Version: 7.0NG.746-200615
+Version: 7.0NG.746-200616
Architecture: all
Priority: optional
Section: admin
diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh
index d9f481d9ce..db089152dc 100644
--- a/pandora_agents/unix/DEBIAN/make_deb_package.sh
+++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-pandora_version="7.0NG.746-200615"
+pandora_version="7.0NG.746-200616"
echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent
index ee20a81c3a..ab83553edb 100755
--- a/pandora_agents/unix/pandora_agent
+++ b/pandora_agents/unix/pandora_agent
@@ -55,7 +55,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.746';
-use constant AGENT_BUILD => '200615';
+use constant AGENT_BUILD => '200616';
# Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000;
diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec
index 7e81922366..d3bb97711b 100644
--- a/pandora_agents/unix/pandora_agent.redhat.spec
+++ b/pandora_agents/unix/pandora_agent.redhat.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.746
-%define release 200615
+%define release 200616
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}
diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec
index 49bf28595a..afc829aed9 100644
--- a/pandora_agents/unix/pandora_agent.spec
+++ b/pandora_agents/unix/pandora_agent.spec
@@ -3,7 +3,7 @@
#
%define name pandorafms_agent_unix
%define version 7.0NG.746
-%define release 200615
+%define release 200616
Summary: Pandora FMS Linux agent, PERL version
Name: %{name}
diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer
index d81b610641..ccdc111946 100755
--- a/pandora_agents/unix/pandora_agent_installer
+++ b/pandora_agents/unix/pandora_agent_installer
@@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.746"
-PI_BUILD="200615"
+PI_BUILD="200616"
OS_NAME=`uname -s`
FORCE=0
diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi
index 994e9017fd..c1b56b1298 100644
--- a/pandora_agents/win32/installer/pandora.mpi
+++ b/pandora_agents/win32/installer/pandora.mpi
@@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
-{200615}
+{200616}
ViewReadme
{Yes}
diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc
index 0f2e395d48..aba40e6f80 100644
--- a/pandora_agents/win32/pandora.cc
+++ b/pandora_agents/win32/pandora.cc
@@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1
-#define PANDORA_VERSION ("7.0NG.746(Build 200615)")
+#define PANDORA_VERSION ("7.0NG.746(Build 200616)")
string pandora_path;
string pandora_dir;
diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc
index e09ee9ea45..6bca3a735a 100644
--- a/pandora_agents/win32/versioninfo.rc
+++ b/pandora_agents/win32/versioninfo.rc
@@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Artica ST"
VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent"
- VALUE "ProductVersion", "(7.0NG.746(Build 200615))"
+ VALUE "ProductVersion", "(7.0NG.746(Build 200616))"
VALUE "FileVersion", "1.0.0.0"
END
END
diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control
index ad19521c2a..dd1f5f5dba 100644
--- a/pandora_console/DEBIAN/control
+++ b/pandora_console/DEBIAN/control
@@ -1,5 +1,5 @@
package: pandorafms-console
-Version: 7.0NG.746-200615
+Version: 7.0NG.746-200616
Architecture: all
Priority: optional
Section: admin
diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh
index 37592bfd49..f0a953b59d 100644
--- a/pandora_console/DEBIAN/make_deb_package.sh
+++ b/pandora_console/DEBIAN/make_deb_package.sh
@@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-pandora_version="7.0NG.746-200615"
+pandora_version="7.0NG.746-200616"
package_pear=0
package_pandora=1
diff --git a/pandora_console/include/api.php b/pandora_console/include/api.php
index f263350685..ed366f64c6 100644
--- a/pandora_console/include/api.php
+++ b/pandora_console/include/api.php
@@ -261,6 +261,13 @@ if ($correctLogin) {
}
break;
+ case 'event':
+ // Preventive check for users if not available write events
+ if (! check_acl($config['id_user'], $event['id_grupo'], 'EW')) {
+ return false;
+ }
+ break;
+
default:
// Ignore.
break;
diff --git a/pandora_console/include/chart_generator.php b/pandora_console/include/chart_generator.php
index edd8208b05..97fdf32b9c 100644
--- a/pandora_console/include/chart_generator.php
+++ b/pandora_console/include/chart_generator.php
@@ -277,7 +277,8 @@ if (file_exists('languages/'.$user_language.'.mo') === true) {
$params['ttl'],
$params['sizeForTicks'],
$params['show'],
- $params['date_to']
+ $params['date_to'],
+ $params['server_id']
);
break;
diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php
index b459d0008d..de27481752 100644
--- a/pandora_console/include/config_process.php
+++ b/pandora_console/include/config_process.php
@@ -20,7 +20,7 @@
/**
* Pandora build version and version
*/
-$build_version = 'PC200615';
+$build_version = 'PC200616';
$pandora_version = 'v7.0NG.746';
// Do not overwrite default timezone set if defined.
diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php
index 8194416ef3..1855997f11 100644
--- a/pandora_console/include/functions.php
+++ b/pandora_console/include/functions.php
@@ -2142,7 +2142,7 @@ function check_sql($sql)
{
// We remove "*" to avoid things like SELECT * FROM tusuario
// Check that it not delete_ as "delete_pending" (this is a common field in pandora tables).
- if (preg_match('/\*|delete[^_]|drop|alter|modify|password|pass|insert|update/i', $sql)) {
+ if (preg_match('/([ ]*(delete|drop|alter|modify|password|pass|insert|update)\b[ \\]+)/i', $sql)) {
return '';
}
diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php
index ea2b7494da..d045577f4e 100644
--- a/pandora_console/include/functions_api.php
+++ b/pandora_console/include/functions_api.php
@@ -8796,6 +8796,11 @@ function otherParameter2Filter($other, $return_as_array=false, $use_agent_name=f
}
}
+ // Esto es extraño, hablar con Tati
+ /*
+ $filter['1'] = $filter['sql'];
+ unset($filter['sql']); */
+
if (isset($other['data'][4]) && $other['data'][4] != '') {
$idTemplate = db_get_value_filter('id', 'talert_templates', ['name' => $other['data'][4]]);
if ($idTemplate !== false) {
@@ -10727,6 +10732,83 @@ function get_events_with_user($trash1, $trash2, $other, $returnType, $user_in_db
}
+/**
+ * Update an event
+ *
+ * @param string $id_event Id of the event for change.
+ * @param string $unused1 Without use.
+ * @param array $params Dictionary with field,value format with the data for update.
+ * @param string $unused2 Without use.
+ * @param string $unused3 Without use.
+ *
+ * @return void
+ */
+function api_set_event($id_event, $unused1, $params, $unused2, $unused3)
+{
+ // Get the event
+ $event = events_get_event($id_event, false, is_metaconsole());
+ // If event not exists, end the execution.
+ if ($event === false) {
+ returnError(
+ 'event_not_exists',
+ 'Event not exists'
+ );
+ return false;
+ }
+
+ $paramsSerialize = [];
+ // Serialize the data for update
+ if ($params['type'] === 'array') {
+ // Keys that is not available to change
+ $invalidKeys = [
+ 'id_evento',
+ 'id_agente',
+ 'id_grupo',
+ 'timestamp',
+ 'utimestamp',
+ 'id_agentmodule',
+ 'ack_utimestamp',
+ 'data',
+ ];
+
+ foreach ($params['data'] as $key_value) {
+ list($key, $value) = explode(',', $key_value, 2);
+ if (in_array($key, $invalidKeys) == false) {
+ $paramsSerialize[$key] = $value;
+ }
+ }
+ }
+
+ // In meta or node.
+ if (is_metaconsole() === true) {
+ $table = 'tmetaconsole_event';
+ } else {
+ $table = 'tevento';
+ }
+
+ // TODO. Stablish security for prevent sql injection?
+ // Update the row
+ $result = db_process_sql_update(
+ $table,
+ $paramsSerialize,
+ [ 'id_evento' => $id_event ]
+ );
+
+ // If update results failed
+ if (empty($result) === true || $result === false) {
+ returnError(
+ 'failed_event_update',
+ __('Failed event update')
+ );
+ return false;
+ } else {
+ returnData('string', ['data' => 'Event updated']);
+ }
+
+ return;
+}
+
+
/**
*
* @param $trash1
diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php
index 1a74f456b2..9666196a6c 100644
--- a/pandora_console/include/graphs/functions_flot.php
+++ b/pandora_console/include/graphs/functions_flot.php
@@ -699,6 +699,7 @@ function flot_slicesbar_graph(
'show' => $show,
'return_img_base_64' => true,
'date_to' => $date_to,
+ 'server_id' => $server_id,
];
$graph = '";
$return .= "//";
$return .= '';
diff --git a/pandora_console/install.php b/pandora_console/install.php
index 916492ea12..7a088e199f 100644
--- a/pandora_console/install.php
+++ b/pandora_console/install.php
@@ -129,7 +129,7 @@