diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control
index 94b983af04..be260988d7 100644
--- a/pandora_agents/unix/DEBIAN/control
+++ b/pandora_agents/unix/DEBIAN/control
@@ -1,5 +1,5 @@
package: pandorafms-agent-unix
-Version: 7.0NG.716-171205
+Version: 7.0NG.716-171213
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 b24e637840..33c99951e0 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.716-171205"
+pandora_version="7.0NG.716-171213"
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 e836cc9bab..9b282f3de7 100755
--- a/pandora_agents/unix/pandora_agent
+++ b/pandora_agents/unix/pandora_agent
@@ -41,7 +41,7 @@ my $Sem = undef;
my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.716';
-use constant AGENT_BUILD => '171205';
+use constant AGENT_BUILD => '171213';
# 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 f7684c3403..95982e5d7c 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.716
-%define release 171205
+%define release 171213
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 69216b3634..310103bddf 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.716
-%define release 171205
+%define release 171213
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 f11c62f8f0..ae359d7249 100755
--- a/pandora_agents/unix/pandora_agent_installer
+++ b/pandora_agents/unix/pandora_agent_installer
@@ -10,7 +10,7 @@
# **********************************************************************
PI_VERSION="7.0NG.716"
-PI_BUILD="171205"
+PI_BUILD="171213"
OS_NAME=`uname -s`
FORCE=0
diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi
index 0e14c086ab..f3bd68d178 100644
--- a/pandora_agents/win32/installer/pandora.mpi
+++ b/pandora_agents/win32/installer/pandora.mpi
@@ -186,7 +186,7 @@ UpgradeApplicationID
{}
Version
-{171205}
+{171213}
ViewReadme
{Yes}
diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc
index 56c43b8a22..2e1df353a1 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.716(Build 171205)")
+#define PANDORA_VERSION ("7.0NG.716(Build 171213)")
string pandora_path;
string pandora_dir;
diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc
index 406e6ba068..a3622b0ec5 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.716(Build 171205))"
+ VALUE "ProductVersion", "(7.0NG.716(Build 171213))"
VALUE "FileVersion", "1.0.0.0"
END
END
diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control
index 75c8bcbaf2..c3c3361d94 100644
--- a/pandora_console/DEBIAN/control
+++ b/pandora_console/DEBIAN/control
@@ -1,5 +1,5 @@
package: pandorafms-console
-Version: 7.0NG.716-171205
+Version: 7.0NG.716-171213
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 b2a2da6dbd..33f8ef0df1 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.716-171205"
+pandora_version="7.0NG.716-171213"
package_pear=0
package_pandora=1
diff --git a/pandora_console/extras/mr/10.sql b/pandora_console/extras/mr/10.sql
index 2b58ce08c4..53c7c7bcc6 100644
--- a/pandora_console/extras/mr/10.sql
+++ b/pandora_console/extras/mr/10.sql
@@ -2,6 +2,11 @@ START TRANSACTION;
ALTER TABLE tsnmp_filter ADD unified_filters_id int(10) NOT NULL DEFAULT 0;
ALTER TABLE treport_content_template ADD COLUMN hide_no_data tinyint(1) DEFAULT 0;
-ALTER TABLE tgraph_source ADD COLUMN `order` int(10) NOT NULL default 0;
+ALTER TABLE tgraph_source ADD COLUMN `field_order` int(10) NOT NULL default 0;
+UPDATE tgraph_source c, (SELECT @n := 0) m SET c.field_order = @n := @n + 1;
+
+ALTER TABLE tgraph ADD COLUMN `summatory_series` tinyint(1) UNSIGNED NOT NULL default '0';
+ALTER TABLE tgraph ADD COLUMN `average_series` tinyint(1) UNSIGNED NOT NULL default '0';
+ALTER TABLE tgraph ADD COLUMN `modules_series` tinyint(1) UNSIGNED NOT NULL default '0';
COMMIT;
\ No newline at end of file
diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
index 14a1285b5f..78ff5bf563 100644
--- a/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
+++ b/pandora_console/extras/pandoradb_migrate_6.0_to_7.0.mysql.sql
@@ -1263,6 +1263,7 @@ UPDATE tagente_modulo SET cron_interval = '' WHERE cron_interval LIKE '% %';
ALTER TABLE tgraph ADD COLUMN `percentil` int(4) unsigned default '0';
ALTER TABLE tgraph ADD COLUMN `summatory_series` tinyint(1) UNSIGNED NOT NULL default '0';
ALTER TABLE tgraph ADD COLUMN `average_series` tinyint(1) UNSIGNED NOT NULL default '0';
+ALTER TABLE tgraph ADD COLUMN `modules_series` tinyint(1) UNSIGNED NOT NULL default '0';
-- ---------------------------------------------------------------------
-- Table `tnetflow_filter`
@@ -1434,7 +1435,7 @@ ALTER TABLE tserver_export MODIFY `name` varchar(600) BINARY NOT NULL default ''
-- ---------------------------------------------------------------------
ALTER TABLE tgraph_source ADD COLUMN id_server int(11) UNSIGNED NOT NULL default 0;
-ALTER TABLE tgraph_source ADD COLUMN `order` int(10) NOT NULL default 0;
+ALTER TABLE tgraph_source ADD COLUMN `field_order` int(10) NOT NULL default 0;
-- ---------------------------------------------------------------------
-- Table `tserver_export_data`
diff --git a/pandora_console/godmode/reporting/graph_builder.graph_editor.php b/pandora_console/godmode/reporting/graph_builder.graph_editor.php
index 4daaf0c18d..da612b6e33 100644
--- a/pandora_console/godmode/reporting/graph_builder.graph_editor.php
+++ b/pandora_console/godmode/reporting/graph_builder.graph_editor.php
@@ -61,10 +61,10 @@ switch ($action) {
switch ($config["dbtype"]) {
case "mysql":
$items = db_get_all_rows_sql('
- SELECT id_gs, `order`
+ SELECT id_gs, `field_order`
FROM tgraph_source
WHERE id_graph = ' . $id_graph . '
- ORDER BY `order`');
+ ORDER BY `field_order`');
break;
}
@@ -77,7 +77,7 @@ switch ($action) {
switch ($config["dbtype"]) {
case "mysql":
db_process_sql_update('tgraph_source',
- array('`order`' => $order_temp),
+ array('`field_order`' => $order_temp),
array('id_gs' => $item['id_rc']));
break;
}
@@ -89,10 +89,10 @@ switch ($action) {
switch ($config["dbtype"]) {
case "mysql":
$items = db_get_all_rows_sql('
- SELECT id_gs, `order`
+ SELECT id_gs, `field_order`
FROM tgraph_source
WHERE id_graph = ' . $id_graph . '
- ORDER BY `order`');
+ ORDER BY `field_order`');
break;
}
@@ -106,7 +106,7 @@ switch ($action) {
foreach ($items as $item) {
//Remove the contents from the block to sort
if (array_search($item['id_gs'], $ids) === false) {
- $temp[$item['order']] = $item['id_gs'];
+ $temp[$item['field_order']] = $item['id_gs'];
}
}
$items = $temp;
@@ -142,7 +142,7 @@ switch ($action) {
case "mysql":
db_process_sql_update('tgraph_source',
- array('`order`' => ($order + 1)),
+ array('`field_order`' => ($order + 1)),
array('id_gs' => $id));
break;
}
@@ -166,7 +166,7 @@ if ($editGraph) {
WHERE t2.id_agente_modulo = t1.id_agent_module))
AS agent_name
FROM tgraph_source t1
- WHERE t1.id_graph = " . $id_graph . " order by `order`");
+ WHERE t1.id_graph = " . $id_graph . " order by `field_order`");
$position_array = array();
$module_array = array();
$weight_array = array();
@@ -183,7 +183,7 @@ if ($editGraph) {
$weight_array[] = $graphRow['weight'];
$label_array[] = $graphRow['label'];
$agent_array[] = $graphRow['agent_name'];
- $position_array[] = $graphRow['order'];
+ $position_array[] = $graphRow['field_order'];
}
$graphInTgraph = db_get_row_sql("SELECT * FROM tgraph WHERE id_graph = " . $id_graph);
@@ -280,9 +280,9 @@ if (defined("METACONSOLE")) {
else {
$table->data[0][0] = "". __("Sort items") . "";
}
-$table->data[1][0] = __('Sort selected items from position: ');
+$table->data[1][0] = __('Sort selected items');
$table->data[1][1] = html_print_select_style(
- array('before' => __('Move before to'), 'after' => __('Move after to')), 'move_to',
+ array('before' => __('before to'), 'after' => __('after to')), 'move_to',
'', '', '', '', 0, true);
$table->data[1][2] = html_print_input_text_extended('position_to_sort', 1,
'text-position_to_sort', '', 3, 10, false, "only_numbers('position_to_sort');", '', true);
diff --git a/pandora_console/godmode/reporting/graph_builder.main.php b/pandora_console/godmode/reporting/graph_builder.main.php
index 9c95f2263b..cb2c5f265c 100644
--- a/pandora_console/godmode/reporting/graph_builder.main.php
+++ b/pandora_console/godmode/reporting/graph_builder.main.php
@@ -66,6 +66,9 @@ if ($edit_graph) {
$height = $graphInTgraph['height'];
$check = false;
$percentil = $graphInTgraph['percentil'];
+ $summatory_series = $graphInTgraph['summatory_series'];
+ $average_series = $graphInTgraph['average_series'];
+ $modules_series = $graphInTgraph['modules_series'];
if ($stacked == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){
$stacked = CUSTOM_GRAPH_BULLET_CHART;
@@ -84,6 +87,9 @@ else {
$stacked = 4;
$check = false;
$percentil = 0;
+ $summatory_series = 0;
+ $average_series = 0;
+ $modules_series = 0;
}
@@ -177,6 +183,16 @@ echo "";
echo "
".__('Percentil')." | ";
echo "" . html_print_checkbox ("percentil", 1, $percentil, true) . " |
";
+echo "".__('Add summatory series') .
+ ui_print_help_tip (__("Adds synthetic series to the graph, using all module
+ values to calculate the summation and/or average in each time interval.
+ This feature could be used instead of synthetic modules if you only want to see a graph."), true) . " | ";
+echo "" . html_print_checkbox ("summatory_series", 1, $summatory_series, true) . " |
+".__('Add average series')." | ";
+echo "" . html_print_checkbox ("average_series", 1, $average_series, true) . " |
";
+echo "".__('Modules and series')." | ";
+
+echo "" . html_print_checkbox ("modules_series", 1, $modules_series, true) . " |
";
echo "";
if ($edit_graph) {
@@ -195,6 +211,12 @@ echo '';
?>
diff --git a/pandora_console/godmode/reporting/graph_builder.php b/pandora_console/godmode/reporting/graph_builder.php
index 317f562e6f..79cb82302a 100644
--- a/pandora_console/godmode/reporting/graph_builder.php
+++ b/pandora_console/godmode/reporting/graph_builder.php
@@ -87,6 +87,9 @@ if ($add_graph) {
$period = get_parameter_post ("period");
$threshold = get_parameter('threshold');
$percentil = get_parameter ("percentil", 0);
+ $summatory_series = get_parameter ("summatory_series", 0);
+ $average_series = get_parameter ("average_series", 0);
+ $modules_series = get_parameter ("modules_series", 0);
if ($threshold == CUSTOM_GRAPH_BULLET_CHART_THRESHOLD){
$stacked = $threshold;
@@ -103,7 +106,10 @@ if ($add_graph) {
'private' => 0,
'id_group' => $idGroup,
'stacked' => $stacked,
- 'percentil' => $percentil
+ 'percentil' => $percentil,
+ 'summatory_series' => $summatory_series,
+ 'average_series' => $average_series,
+ 'modules_series' => $modules_series
);
if (trim($name) != "") {
@@ -131,6 +137,9 @@ if ($update_graph) {
$period = get_parameter('period');
$stacked = get_parameter('stacked');
$percentil = get_parameter('percentil');
+ $summatory_series = get_parameter ("summatory_series");
+ $average_series = get_parameter ("average_series");
+ $modules_series = get_parameter ("modules_series");
$alerts = get_parameter('alerts');
$threshold = get_parameter('threshold');
@@ -141,7 +150,10 @@ if ($update_graph) {
if (trim($name) != "") {
$success = db_process_sql_update('tgraph',
- array('name' => $name, 'id_group' => $id_group, 'description' => $description, 'width' => $width, 'height' => $height, 'period' => $period, 'stacked' => $stacked, 'percentil' => $percentil ),
+ array('name' => $name, 'id_group' => $id_group, 'description' => $description,
+ 'width' => $width, 'height' => $height, 'period' => $period, 'stacked' => $stacked,
+ 'percentil' => $percentil, 'summatory_series' => $summatory_series,
+ 'average_series' => $average_series, 'modules_series' => $modules_series),
array('id_graph' => $id_graph));
if ($success !== false)
db_pandora_audit("Report management", "Update graph #$id_graph");
@@ -179,10 +191,14 @@ if ($add_module) {
implode("','", $id_modules).
"')");
- if (count($id_agent_modules) > 0 && $id_agent_modules != '') {
- foreach($id_agent_modules as $id_agent_module)
- $result = db_process_sql_insert('tgraph_source', array('id_graph' => $id_graph, 'id_agent_module' => $id_agent_module['id_agente_modulo'], 'weight' => $weight));
- }
+ if (count($id_agent_modules) > 0 && $id_agent_modules != '') {
+ $order = db_get_row_sql("SELECT `field_order` from tgraph_source ORDER BY `field_order` DESC");
+ $order = $order['field_order'];
+ foreach($id_agent_modules as $id_agent_module){
+ $order++;
+ $result = db_process_sql_insert('tgraph_source', array('id_graph' => $id_graph, 'id_agent_module' => $id_agent_module['id_agente_modulo'], 'weight' => $weight, 'field_order' => $order));
+ }
+ }
else
$result = false;
}
diff --git a/pandora_console/include/ajax/snmp.ajax.php b/pandora_console/include/ajax/snmp.ajax.php
index a372d50e11..29fefa026e 100644
--- a/pandora_console/include/ajax/snmp.ajax.php
+++ b/pandora_console/include/ajax/snmp.ajax.php
@@ -60,7 +60,6 @@ if ($update_snmp_translation) {
if ($delete_snmp_filter) {
$filter_id = get_parameter('filter_id');
-html_debug($filter_id, true);
db_process_sql_delete('tsnmp_filter', array('id_snmp_filter' => $filter_id));
return;
diff --git a/pandora_console/include/auth/mysql.php b/pandora_console/include/auth/mysql.php
index bb3bea97b1..77ce04e257 100644
--- a/pandora_console/include/auth/mysql.php
+++ b/pandora_console/include/auth/mysql.php
@@ -709,36 +709,52 @@ function ldap_process_user_login ($login, $password) {
$filter="(" . $config['ldap_login_attr'] . "=" . io_safe_output($login) . ")";
$justthese = array("objectclass=group");
- $sr = ldap_search($ds, $dc, $filter, $justthese);
+ $sr=local_ldap_search($config["ldap_server"], $config["ldap_port"], $config["ldap_version"], $dc, $config['ldap_login_attr'], io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'], io_safe_output($login));
+
+ if (!$sr == false){
+ $user_dn=$sr["dn"];
+
+ $ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : '';
- $memberof = ldap_get_entries($ds, $sr);
-
- if ($memberof["count"] == 0 && !isset($memberof[0]["memberof"])) {
+ $correct = false;
+ if(!empty($ldap_base_dn)) {
+ if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($user_dn), $password) ) {
+ $correct = true;
+ }
+ } else {
+ if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($login), $password) ) {
+ $correct = true;
+ }
+ }
@ldap_close ($ds);
- return false;
- }
- else {
- $memberof = $memberof[0];
- }
-
- unset($memberof["count"]);
+
+ } else {
+ $sr = ldap_search($ds, $dc, $filter, $justthese);
- $ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : '';
-
- $correct = false;
- if(!empty($ldap_base_dn)) {
- if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($memberof['dn']), $password) ) {
- $correct = true;
- }
- }
- else {
- if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($login), $password) ) {
- $correct = true;
- }
- }
-
- @ldap_close ($ds);
+ $memberof = ldap_get_entries($ds, $sr);
+ if ($memberof["count"] == 0 && !isset($memberof[0]["memberof"])) {
+ @ldap_close ($ds);
+ return false;
+ } else {
+ $memberof = $memberof[0];
+ }
+ unset($memberof["count"]);
+
+ $ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : '';
+ $correct = false;
+ if(!empty($ldap_base_dn)) {
+ if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($memberof['dn']), $password) ) {
+ $correct = true;
+ }
+ } else {
+ if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($login), $password) ) {
+ $correct = true;
+ }
+ }
+ @ldap_close ($ds);
+ }
+
if ($correct) {
return true;
}
@@ -802,22 +818,26 @@ function get_ldap_login_attr ($login) {
$filter="(" . $config['ldap_login_attr'] . "=" . io_safe_output($id_user) . ")";
$justthese = array("mail");
- $sr = ldap_search($ds, $dc, $filter, $justthese);
-
- $info = ldap_get_entries($ds, $sr);
+ $sr=local_ldap_search($config["ldap_server"], $config["ldap_port"], $config["ldap_version"], $dc, $config['ldap_login_attr'],io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'], io_safe_output($login));
- if ($info["count"] == 0 && !isset($info[0]["mail"])) {
+ if (!$sr == false){
+ $id_user=$sr["mail"];
+ @ldap_close ($ds);
+ } else {
+ $sr = ldap_search($ds, $dc, $filter, $justthese, 0, 0 ,2);
+
+ $info = ldap_get_entries($ds, $sr);
+ if ($info["count"] == 0 && !isset($info[0]["mail"])) {
+ @ldap_close ($ds);
+ return $id_user;
+ } else {
+ $info = $info[0];
+ }
+
+ $id_user = $info['mail'][0];
@ldap_close ($ds);
- return $id_user;
}
- else {
- $info = $info[0];
- }
-
- $id_user = $info['mail'][0];
-
- @ldap_close ($ds);
-
+
break;
}
@@ -904,39 +924,58 @@ function prepare_permissions_groups_of_user_ldap ($id_user, $password,
#Search group of this user it belong.
$filter="(" . $config['ldap_login_attr'] . "=" . io_safe_output($id_user) . ")";
$justthese = array("objectclass=group");
-
- $sr = ldap_search($ds, $dc, $filter, $justthese);
-
- $memberof = ldap_get_entries($ds, $sr);
-
- if ($memberof["count"] == 0 && !isset($memberof[0]["memberof"])) {
- @ldap_close ($ds);
- return false;
- }
- else {
- $memberof = $memberof[0];
- }
-
- unset($memberof["count"]);
- $ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : '';
-
- $correct = false;
- if(!empty($ldap_base_dn)) {
- if (strlen($password) != 0 && @ldap_bind($ds, $memberof['dn'], $password) ) {
- $correct = true;
- }
- }
- else {
- if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($login), $password) ) {
- $correct = true;
- }
- }
-
- if (!$correct) {
- @ldap_close ($ds);
+ $sr=local_ldap_search($config["ldap_server"], $config["ldap_port"], $config["ldap_version"], $dc, $config['ldap_login_attr'], io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'], io_safe_output($id_user));
- return false;
+ if (!$sr == false) {
+ $user_dn=$sr["dn"];
+ $ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : '';
+
+ $correct = false;
+ if(!empty($ldap_base_dn)) {
+ if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($user_dn), $password) ) {
+ $correct = true;
+ }
+ } else {
+ if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($login), $password) ) {
+ $correct = true;
+ }
+ }
+ if (!$correct) {
+ @ldap_close ($ds);
+ return false;
+ }
+ } else {
+ $sr = ldap_search($ds, $dc, $filter, $justthese, 0, 0, 2);
+
+ $memberof = ldap_get_entries($ds, $sr);
+
+ if ($memberof["count"] == 0 && !isset($memberof[0]["memberof"])) {
+ @ldap_close ($ds);
+ return false;
+ } else {
+ $memberof = $memberof[0];
+ }
+
+ unset($memberof["count"]);
+
+ $ldap_base_dn = !empty($config["ldap_base_dn"]) ? "," . io_safe_output($config["ldap_base_dn"]) : '';
+
+ $correct = false;
+ if(!empty($ldap_base_dn)) {
+ if (strlen($password) != 0 && @ldap_bind($ds, $memberof['dn'], $password) ) {
+ $correct = true;
+ }
+ } else {
+ if (strlen($password) != 0 && @ldap_bind($ds, io_safe_output($login), $password) ) {
+ $correct = true;
+ }
+ }
+
+ if (!$correct) {
+ @ldap_close ($ds);
+ return false;
+ }
}
$permissions = array();
@@ -1014,21 +1053,27 @@ function prepare_permissions_groups_of_user_ldap ($id_user, $password,
$filter="(" . $config['ldap_login_attr'] . "=" . io_safe_output($id_user) . ")";
$justthese = array("mail");
- $sr = ldap_search($ds, $dc, $filter, $justthese);
+ $sr=local_ldap_search($config["ldap_server"], $config["ldap_port"], $config["ldap_version"], $dc, $config['ldap_login_attr'], io_safe_output($config['ldap_admin_login']), $config['ldap_admin_pass'], io_safe_output($id_user));
+
+ if (!$sr == false){
+ $id_user=$sr["mail"];
+ $user_info['fullname']=$sr["mail"];
+ } else {
+ $sr = ldap_search($ds, $dc, $filter, $justthese, 0, 0, 2);
+
+ $info = ldap_get_entries($ds, $sr);
+ if ($info["count"] == 0 && !isset($info[0]["mail"])) {
+ @ldap_close ($ds);
+ return false;
+ } else {
+ $info = $info[0];
+ }
+
+ $id_user = $info['mail'][0];
+ $user_info['fullname'] = $id_user;
+
+ }
- $info = ldap_get_entries($ds, $sr);
-
- if ($info["count"] == 0 && !isset($info[0]["mail"])) {
- @ldap_close ($ds);
- return false;
- }
- else {
- $info = $info[0];
- }
-
- $id_user = $info['mail'][0];
- $user_info['fullname'] = $id_user;
-
break;
}
}
@@ -1341,6 +1386,35 @@ function delete_user_pass_ldap ($id_user) {
return;
}
+function local_ldap_search($ldap_host, $ldap_port=389, $ldap_version=3, $dn, $access_attr, $ldap_admin_user, $ldap_admin_pass, $user) {
+ $filter="(" . $access_attr . "=" . $user . ")";
+ $shell_ldap_search = explode("\n", shell_exec('ldapsearch -LLL -o ldif-wrap=no -x -h ' . $ldap_host . ' -p ' . $ldap_port . ' -P ' . $ldap_version . ' -E pr=10000/noprompt -D "' . $ldap_admin_user . '" -w ' . $ldap_admin_pass . ' -b "' . $dn . '" -s sub "' . $filter . '" | grep -v "^#\|^$" | sed "s/:\+ /=>/g"'));
+ foreach($shell_ldap_search as $line) {
+ $values = explode("=>", $line);
+ if(!empty($values[0]) && !empty($values[1])) {
+ $user_attr[$values[0]] = $values[1];
+ }
+ }
+
+ if (empty($user_attr)) {
+ return false;
+ }
+
+ $user_dn = safe_output_accute(base64_decode($user_attr["dn"]));
+ if(strlen($user_dn) > 0) {
+ $user_attr["dn"]=$user_dn;
+ }
+
+ return $user_attr;
+}
+
+function safe_output_accute($string) {
+ $no_allowed= array ("á","é","í","ó","ú","Á","É","Í","Ó","Ú","ñ","Ñ");
+ $allowed= array ("a","e","i","o","u","A","E","I","O","U","n","N");
+ $result = str_replace($no_allowed, $allowed ,$string);
+ return $result;
+}
+
//Reference the global use authorization error to last auth error.
$config["auth_error"] = &$mysql_cache["auth_error"];
?>
\ No newline at end of file
diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php
index 679c33f0cb..c7f40ecead 100644
--- a/pandora_console/include/config_process.php
+++ b/pandora_console/include/config_process.php
@@ -22,7 +22,7 @@
/**
* Pandora build version and version
*/
-$build_version = 'PC171205';
+$build_version = 'PC171213';
$pandora_version = 'v7.0NG.716';
// Do not overwrite default timezone set if defined.
diff --git a/pandora_console/include/functions_custom_graphs.php b/pandora_console/include/functions_custom_graphs.php
index adf077ec6a..d037e773e7 100644
--- a/pandora_console/include/functions_custom_graphs.php
+++ b/pandora_console/include/functions_custom_graphs.php
@@ -202,6 +202,11 @@ function custom_graphs_print($id_graph, $height, $width, $period,
$sources = db_get_all_rows_field_filter('tgraph_source', 'id_graph',
$id_graph);
+ $series = db_get_all_rows_sql('SELECT summatory_series,average_series,modules_series FROM tgraph WHERE id_graph = '.$id_graph);
+ $summatory = $series[0]['summatory_series'];
+ $average = $series[0]['average_series'];
+ $modules_series = $series[0]['modules_series'];
+
$modules = array ();
$weights = array ();
$labels = array ();
@@ -262,7 +267,10 @@ function custom_graphs_print($id_graph, $height, $width, $period,
$percentil,
$from_interface,
$id_widget_dashboard,
- $fullscale);
+ $fullscale,
+ $summatory,
+ $average,
+ $modules_series);
if ($return)
return $output;
diff --git a/pandora_console/include/functions_gis.php b/pandora_console/include/functions_gis.php
index 8f1a02f9f0..ee14a2f707 100644
--- a/pandora_console/include/functions_gis.php
+++ b/pandora_console/include/functions_gis.php
@@ -573,14 +573,17 @@ function gis_get_agent_icon_map($idAgent, $state = false, $status = null) {
switch ($status) {
case 1:
case 4:
+ case 100:
//Critical (BAD or ALERT)
$state = ".bad";
break;
case 0:
+ case 300:
//Normal (OK)
$state = ".ok";
break;
case 2:
+ case 200:
//Warning
$state = ".warning";
break;
diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php
index 07b9a287e7..11260d6316 100644
--- a/pandora_console/include/functions_graph.php
+++ b/pandora_console/include/functions_graph.php
@@ -1125,11 +1125,11 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$name_list = array(), $unit_list = array(), $show_last = true, $show_max = true,
$show_min = true, $show_avg = true, $labels = array(), $dashboard = false,
$vconsole = false, $percentil = null, $from_interface = false,
- $id_widget_dashboard=false, $fullscale = false) {
+ $id_widget_dashboard=false, $fullscale = false, $summatory = 0, $average = 0, $modules_series = 0) {
global $config;
global $graphic_type;
-
+
if(!$fullscale){
$time_format_2 = '';
$temp_range = $period;
@@ -1216,7 +1216,8 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$weight_list[$i] = 1;
}
}
-
+
+ $aux_array = array();
// Set data containers
for ($i = 0; $i < $resolution; $i++) {
$timestamp = $datelimit + ($interval * $i);/*
@@ -1268,12 +1269,12 @@ function graphic_combined_module ($module_list, $weight_list, $period,
// If its a projection graph,
// first module will be data and second will be the projection
+
if ($projection != false && $i != 0) {
if ($automatic_custom_graph_meta)
$agent_module_id = $module_list[0]['module'];
else
$agent_module_id = $module_list[0];
-
$id_module_type = modules_get_agentmodule_type ($agent_module_id);
$module_type = modules_get_moduletype_name ($id_module_type);
$uncompressed_module = is_module_uncompressed ($module_type);
@@ -1284,7 +1285,6 @@ function graphic_combined_module ($module_list, $weight_list, $period,
else
$agent_module_id = $module_list[$i];
-
$id_module_type = modules_get_agentmodule_type ($agent_module_id);
$module_type = modules_get_moduletype_name ($id_module_type);
$uncompressed_module = is_module_uncompressed ($module_type);
@@ -1358,6 +1358,21 @@ function graphic_combined_module ($module_list, $weight_list, $period,
continue;
}
+ // if(empty($aux_array)){
+ // foreach ($data as $key => $value) {
+ // $aux_array[$value['utimestamp']] = $value['datos'];
+ // }
+ // } else {
+ // foreach ($data as $key => $value) {
+ // if(array_key_exists($value['utimestamp'],$aux_array)){
+ // $aux_array[$value['utimestamp']] = $aux_array[$value['utimestamp']] + $value['datos'];
+ // } else {
+ // $aux_array[$value['utimestamp']] = $value['datos'];
+ // }
+ // }
+ // }
+
+ // html_debug($aux_array);
if (!empty($name_list) && $names_number == $module_number && isset($name_list[$i])) {
if ($labels[$agent_module_id] != '')
$module_name_list[$i] = $labels[$agent_module_id];
@@ -2150,7 +2165,91 @@ function graphic_combined_module ($module_list, $weight_list, $period,
$threshold_data['red_inverse'] = (bool)$red_inverse;
}
}
+
+ //summatory and average series
+ if($stacked == CUSTOM_GRAPH_AREA || $stacked == CUSTOM_GRAPH_LINE) {
+ if($summatory && $average) {
+ foreach ($graph_values as $key => $value) {
+ $cont = count($value);
+ $summ = array_sum($value);
+ array_push($value,$summ);
+ array_push($value,$summ/$cont);
+ $graph_values[$key] = $value;
+ if(!$modules_series) {
+ array_splice($graph_values[$key],0,count($graph_values[$key])-2);
+ }
+ }
+
+ if(!$modules_series) {
+ if(is_null($percentil)) {
+ array_splice($module_name_list,0,count($module_name_list));
+ } else {
+ array_splice($module_name_list,0,count($module_name_list)-(count($module_name_list)/2));
+ }
+ array_unshift($module_name_list,'' . __('summatory'). '');
+ array_unshift($module_name_list,'' . __('average'). '');
+ } else {
+ if(is_null($percentil)) {
+ array_push($module_name_list,'' . __('summatory'). '');
+ array_push($module_name_list,'' . __('average'). '');
+ } else {
+ array_splice($module_name_list,(count($module_name_list)/2),0,'' . __('average'). '');
+ array_splice($module_name_list,(count($module_name_list)/2),0,'' . __('summatory'). '');
+ }
+
+ }
+
+ } elseif($summatory) {
+ foreach ($graph_values as $key => $value) {
+ array_push($value,array_sum($value));
+ $graph_values[$key] = $value;
+ if(!$modules_series){
+ array_splice($graph_values[$key],0,count($graph_values[$key])-1);
+ }
+ }
+ if(!$modules_series) {
+ if(is_null($percentil)) {
+ array_splice($module_name_list,0,count($module_name_list));
+ } else {
+ array_splice($module_name_list,0,count($module_name_list)-(count($module_name_list)/2));
+ }
+ array_unshift($module_name_list,'' . __('summatory'). '');
+ } else {
+ if(is_null($percentil)) {
+ array_push($module_name_list,'' . __('summatory'). '');
+ } else {
+ array_splice($module_name_list,(count($module_name_list)/2),0,'' . __('summatory'). '');
+ }
+ }
+
+ } elseif($average) {
+ foreach ($graph_values as $key => $value) {
+ $summ = array_sum($value) / count($value);
+ array_push($value,$summ);
+ $graph_values[$key] = $value;
+ if(!$modules_series){
+ array_splice($graph_values[$key],0,count($graph_values[$key])-1);
+ }
+ }
+
+ if(!$modules_series) {
+ if(is_null($percentil)) {
+ array_splice($module_name_list,0,count($module_name_list));
+ } else {
+ array_splice($module_name_list,0,count($module_name_list)-(count($module_name_list)/2));
+ }
+ array_unshift($module_name_list,'' . __('average'). '');
+ } else {
+ if(is_null($percentil)) {
+ array_push($module_name_list,'' . __('average'). '');
+ } else {
+ array_splice($module_name_list,(count($module_name_list)/2),0,'' . __('average'). '');
+ }
+ }
+ }
+ }
+
switch ($stacked) {
case CUSTOM_GRAPH_AREA:
return area_graph($flash_charts, $graph_values, $width,
diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php
index 92988575a8..15058a3a4b 100755
--- a/pandora_console/include/functions_modules.php
+++ b/pandora_console/include/functions_modules.php
@@ -998,6 +998,7 @@ function modules_is_string($id_agentmodule) {
function modules_is_boolean_type ($id_type) {
$type_name = modules_get_type_name($id_type);
+ if ($type_name === "keep_alive") return true;
return (bool)preg_match('/_proc$/', $type_name);
}
diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php
index 334ad3cfe9..2c77fdd812 100644
--- a/pandora_console/include/graphs/functions_flot.php
+++ b/pandora_console/include/graphs/functions_flot.php
@@ -185,7 +185,6 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
include_javascript_dependencies_flot_graph();
$menu = (int)$menu;
-
// Get a unique identifier to graph
$graph_id = uniqid('graph_');
@@ -500,6 +499,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
$short_data = false;
}
+
// Javascript code
$return .= "