From 313733d071f99700c5f569c5063a7c5cdc39b04b Mon Sep 17 00:00:00 2001 From: manuel Date: Fri, 25 Oct 2019 09:49:55 +0200 Subject: [PATCH 01/18] Fixed bug in CSV export --- pandora_console/include/functions_reporting.php | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 1d0355cf97..f4dd6bed69 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -4221,14 +4221,7 @@ function reporting_sql_graph( case 'data': $data = []; - foreach ($modules as $key => $value) { - $data[$value] = modules_get_agentmodule_data( - $value, - $content['period'], - $report['datetime'] - ); - } - + $data = db_get_all_rows_sql($content['external_source']); $return['chart'] = $data; break; } From a0f767ccc77f9a576f004f7bfd8164e36431f9af Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Mon, 18 Nov 2019 15:28:34 +0100 Subject: [PATCH 02/18] fixed module cron minute selectors --- pandora_console/include/functions_html.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index ab3aad9c7a..6a5d261e7d 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -1178,8 +1178,13 @@ function html_print_extended_select_for_cron($hour='*', $minute='*', $mday='*', } // Minutes - for ($i = 0; $i < 60; $i += 5) { + for ($i = 0; $i < 60; $i++) { $minutes[$i] = $i; + + // If minute is not a multiple of 5, then add style to option in order to hide it from minute select but still is a valid value that input can adopt. We want this in case a value that is not a multiple of 5 is entered in module's data configuration. + if (($i % 5) != 0) { + $minutes_hidden_options[$i] = 'display: none;'; + } } // Month days @@ -1216,13 +1221,13 @@ function html_print_extended_select_for_cron($hour='*', $minute='*', $mday='*', if ($to) { $table->data[0][0] = html_print_select($hours, 'hour_to', $hour, '', __('Any'), '*', true, false, false, '', $disabled); - $table->data[0][1] = html_print_select($minutes, 'minute_to', $minute, '', __('Any'), '*', true, false, false, '', $disabled); + $table->data[0][1] = html_print_select($minutes, 'minute_to', $minute, '', __('Any'), '*', true, false, false, '', $disabled, false, $minutes_hidden_options); $table->data[0][2] = html_print_select($mdays, 'mday_to', $mday, '', __('Any'), '*', true, false, false, '', $disabled); $table->data[0][3] = html_print_select($months, 'month_to', $month, '', __('Any'), '*', true, false, false, '', $disabled); $table->data[0][4] = html_print_select($wdays, 'wday_to', $wday, '', __('Any'), '*', true, false, false, '', $disabled); } else { $table->data[0][0] = html_print_select($hours, 'hour_from', $hour, '', __('Any'), '*', true, false, false, '', $disabled); - $table->data[0][1] = html_print_select($minutes, 'minute_from', $minute, '', __('Any'), '*', true, false, false, '', $disabled); + $table->data[0][1] = html_print_select($minutes, 'minute_from', $minute, '', __('Any'), '*', true, false, false, '', $disabled, false, $minutes_hidden_options); $table->data[0][2] = html_print_select($mdays, 'mday_from', $mday, '', __('Any'), '*', true, false, false, '', $disabled); $table->data[0][3] = html_print_select($months, 'month_from', $month, '', __('Any'), '*', true, false, false, '', $disabled); $table->data[0][4] = html_print_select($wdays, 'wday_from', $wday, '', __('Any'), '*', true, false, false, '', $disabled); From b2b2cdbede782f26b6bb683c26e83174cdfcdb35 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Wed, 11 Dec 2019 12:05:57 +0100 Subject: [PATCH 03/18] Fixed public_console height --- .../operation/visual_console/legacy_public_view.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pandora_console/operation/visual_console/legacy_public_view.php b/pandora_console/operation/visual_console/legacy_public_view.php index ab6def4f70..4a316eee60 100644 --- a/pandora_console/operation/visual_console/legacy_public_view.php +++ b/pandora_console/operation/visual_console/legacy_public_view.php @@ -87,8 +87,8 @@ if ($layout) { $id_layout, true, true, - $width, - $height, + $bwidth, + $bheight, '../../', true, true, @@ -196,7 +196,6 @@ $ignored_params['refr'] = ''; $('body').css('background-color',''); $('body').css('margin','0'); - $('body').css('height','100%'); $('body').css('overflow','hidden'); $(".module_graph .menu_graph").css('display','none'); From 22eb76b56b4df08a8ef71248a0a8f38acafa2844 Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Wed, 18 Dec 2019 19:00:34 +0100 Subject: [PATCH 04/18] Fixed meta regex agent matching ids --- pandora_console/include/functions_agents.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 5bda3bac1a..98063e3437 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -3512,13 +3512,18 @@ function agents_get_status_animation($up=true) function agents_get_agent_id_by_alias_regex($alias_regex, $flag='i', $limit=0) { $agents_id = []; - $all_agents = agents_get_agents(false, ['id_agente', 'alias']); + if (is_metaconsole()) { + $all_agents = agents_meta_get_agents('AR', '|'); + } else { + $all_agents = agents_get_group_agents(0, true, 'lower', false, false, true, '|'); + } + $agent_match = '/'.$alias_regex.'/'.$flag; - foreach ($all_agents as $agent) { - $result_agent_match = preg_match($agent_match, $agent['alias']); + foreach ($all_agents as $agent_id => $agent_alias) { + $result_agent_match = preg_match($agent_match, $agent_alias); if ($result_agent_match) { - $agents_id[] = $agent['id_agente']; + $agents_id[] = $agent_id; $i++; if ($i === $limit) { break; From b245b3b4a8946652d68e026616bfe029d091f761 Mon Sep 17 00:00:00 2001 From: Junichi Satoh Date: Fri, 20 Dec 2019 11:25:01 +0900 Subject: [PATCH 05/18] Added support for MySQL 8.0. --- pandora_console/include/functions_servers.php | 6 ++++-- pandora_console/install.php | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/functions_servers.php b/pandora_console/include/functions_servers.php index 4049df62c9..a3649994fc 100644 --- a/pandora_console/include/functions_servers.php +++ b/pandora_console/include/functions_servers.php @@ -919,9 +919,10 @@ function servers_get_info($id_server=-1) // Remote servers LAG Calculation (server_type != 0). if ($server['server_type'] != 0) { + // MySQL 8.0 has function lag(). So, lag must be enclosed in quotations. $result = db_get_row_sql( 'SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, - AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS lag + AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS "lag" FROM tagente_estado, tagente_modulo, tagente WHERE utimestamp > 0 AND tagente.disabled = 0 @@ -935,9 +936,10 @@ function servers_get_info($id_server=-1) ); } else { // Local/Dataserver server LAG calculation. + // MySQL 8.0 has function lag(). So, lag must be enclosed in quotations. $result = db_get_row_sql( 'SELECT COUNT(tagente_modulo.id_agente_modulo) AS module_lag, - AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS lag + AVG(UNIX_TIMESTAMP() - utimestamp - current_interval) AS "lag" FROM tagente_estado, tagente_modulo, tagente WHERE utimestamp > 0 AND tagente.disabled = 0 diff --git a/pandora_console/install.php b/pandora_console/install.php index 01dd3aba64..c891e8f385 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -965,9 +965,12 @@ function install_step4() $step5 = mysqli_query( $connection, - "GRANT ALL PRIVILEGES ON `$dbname`.* to pandora@$host - IDENTIFIED BY '".$random_password."'" + "CREATE USER pandora@$host IDENTIFIED BY '".$random_password."'" ); + $step5 |= mysqli_query( + $connection, + "GRANT ALL PRIVILEGES ON `$dbname`.* to pandora@$host" + ); mysqli_query($connection, 'FLUSH PRIVILEGES'); check_generic($step5, "Established privileges for user pandora. A new random password has been generated: $random_password
Please write it down, you will need to setup your Pandora FMS server, editing the /etc/pandora/pandora_server.conf file
"); From c79a4b2c0181761488c648b46e6a82b7103ca378 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 31 Dec 2019 11:24:54 +0100 Subject: [PATCH 06/18] fixed file vulnerability --- pandora_console/include/functions_filemanager.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/pandora_console/include/functions_filemanager.php b/pandora_console/include/functions_filemanager.php index b3aa490edf..2c8ed90ee4 100644 --- a/pandora_console/include/functions_filemanager.php +++ b/pandora_console/include/functions_filemanager.php @@ -106,12 +106,8 @@ if (!function_exists('mime_content_type')) { finfo_close($finfo); return $mimetype; } else { - $temp = exec('file '.$filename); - if (isset($temp) && $temp != '') { - return $temp; - } else { - return 'application/octet-stream'; - } + error_log('Warning: Cannot find finfo_open function. Fileinfo extension is not enabled. Please add "extension=fileinfo.so" or "extension=fileinfo.dll" in your php.ini'); + return 'unknown'; } } From f6163f4f80b54f9972a9cb57cb35c3f6ef08b34d Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Tue, 7 Jan 2020 17:31:14 +0100 Subject: [PATCH 07/18] Secured get_file script for unauthorized file download --- .../extensions/files_repo/files_repo_list.php | 8 ++-- .../include/functions_filemanager.php | 10 +++-- pandora_console/include/get_file.php | 41 ++++++++++++------- 3 files changed, 38 insertions(+), 21 deletions(-) diff --git a/pandora_console/extensions/files_repo/files_repo_list.php b/pandora_console/extensions/files_repo/files_repo_list.php index 80de4563ae..e0ca07366d 100644 --- a/pandora_console/extensions/files_repo/files_repo_list.php +++ b/pandora_console/extensions/files_repo/files_repo_list.php @@ -64,9 +64,11 @@ if (!empty($files)) { $document_root = str_replace('\\', '/', io_safe_output($_SERVER['DOCUMENT_ROOT'])); $file['location'] = str_replace('\\', '/', io_safe_output($file['location'])); $relative_path = str_replace($document_root, '', $file['location']); - $file_path = base64_encode($relative_path); - $hash = md5($relative_path.$config['dbpass']); - $url = ui_get_full_url("include/get_file.php?file=$file_path&hash=$hash"); + $file_name = explode('/', $file['location']); + $file_decoded = $file_name[(count($file_name) - 1)]; + $file_path = base64_encode($file_decoded); + $hash = md5($file_path.$config['dbpass']); + $url = ui_get_full_url('include/get_file.php?file='.urlencode($file_path).'&hash='.$hash); $date_format = ($config['date_format']) ? io_safe_output($config['date_format']) : 'F j, Y - H:m'; $data[0] = "".$file['name'].''; diff --git a/pandora_console/include/functions_filemanager.php b/pandora_console/include/functions_filemanager.php index b3aa490edf..801ead1d82 100644 --- a/pandora_console/include/functions_filemanager.php +++ b/pandora_console/include/functions_filemanager.php @@ -694,8 +694,9 @@ function filemanager_file_explorer( $data[1] = ''.$fileinfo['name'].''; } else { - $hash = md5($relative_path.$config['dbpass']); - $data[1] = ''.$fileinfo['name'].''; + $filename = base64_encode($relative_directory.'/'.$fileinfo['name']); + $hash = md5($filename.$config['dbpass']); + $data[1] = ''.$fileinfo['name'].''; } // Notice that uploaded php files could be dangerous @@ -755,8 +756,9 @@ function filemanager_file_explorer( } if ((!$fileinfo['is_dir']) && ($download_button)) { - $hash = md5($fileinfo['realpath'].$config['dbpass']); - $data[4] .= ''; + $filename = base64_encode($fileinfo['name']); + $hash = md5($filename.$config['dbpass']); + $data[4] .= ''; $data[4] .= html_print_image('images/file.png', true); $data[4] .= ''; } diff --git a/pandora_console/include/get_file.php b/pandora_console/include/get_file.php index 0f0fd30353..550e7e92fd 100644 --- a/pandora_console/include/get_file.php +++ b/pandora_console/include/get_file.php @@ -29,29 +29,42 @@ if ($auth_method != 'ad' && $auth_method != 'ldap') { $styleError = 'background:url("../images/err.png") no-repeat scroll 0 0 transparent; padding:4px 1px 6px 30px; color:#CC0000;'; -$file = get_parameter('file', null); +$file_raw = get_parameter('file', null); -$file = base64_decode($file); +$file = base64_decode(urldecode($file_raw)); $hash = get_parameter('hash', null); -$testHash = md5($file.$config['dbpass']); - -if ($hash != $testHash) { +if ($file === '' || $hash === '' || $hash !== md5($file_raw.$config['dbpass']) || !isset($_SERVER['HTTP_REFERER'])) { echo "

".__('Security error. Please contact the administrator.').'

'; -} else if (!empty($file) && !empty($hash)) { - // echo $file; - if (!file_exists($file)) { - $file = $_SERVER['DOCUMENT_ROOT'].$file; +} else { + $downloadable_file = ''; + $parse_all_queries = explode('&', parse_url($_SERVER['HTTP_REFERER'], PHP_URL_QUERY)); + $parse_sec2_query = explode('=', $parse_all_queries[1]); + if ($parse_sec2_query[0] === 'sec2') { + switch ($parse_sec2_query[1]) { + case 'godmode/setup/file_manager': + $downloadable_file = $_SERVER['DOCUMENT_ROOT'].'/pandora_console/'.$file; + break; + + case 'extensions/files_repo': + $downloadable_file = $_SERVER['DOCUMENT_ROOT'].'/pandora_console/attachment/files_repo/'.$file; + break; + + default: + $downloadable_file = ''; + // Do nothing + break; + } } - if (!file_exists($file)) { + if ($downloadable_file === '' || !file_exists($downloadable_file)) { echo "

".__('File is missing in disk storage. Please contact the administrator.').'

'; } else { header('Content-type: aplication/octet-stream;'); - header('Content-type: '.mime_content_type($file).';'); - header('Content-Length: '.filesize($file)); - header('Content-Disposition: attachment; filename="'.basename($file).'"'); - readfile($file); + header('Content-type: '.mime_content_type($downloadable_file).';'); + header('Content-Length: '.filesize($downloadable_file)); + header('Content-Disposition: attachment; filename="'.basename($downloadable_file).'"'); + readfile($downloadable_file); } } From b6d5d1a15ae4762dd6e06a1428f343726cc5b253 Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Wed, 8 Jan 2020 15:23:39 +0100 Subject: [PATCH 08/18] Fixed bug with clock item in the visual consoles in meta --- pandora_console/include/functions_visual_map.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 417b6dc587..ca91f8aaa6 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -1593,6 +1593,7 @@ function visual_map_print_item( case CLOCK: if ((get_parameter('action') == 'edit') || (get_parameter('operation') == 'edit_visualmap')) { + $image_prefix = (is_metaconsole()) ? '../../' : ''; if ($width == 0) { if ($layoutData['id_metaconsole'] != 0) { if ($layoutData['clock_animation'] == 'analogic_1') { @@ -1606,17 +1607,16 @@ function visual_map_print_item( } } else { if ($layoutData['clock_animation'] == 'analogic_1') { - $img = ''; + $img = ''; } else { if ($layoutData['time_format'] == 'time') { - $img = ''; + $img = ''; } else { - $img = ''; + $img = ''; } } } } else { - $image_prefix = ($layoutData['id_metaconsole'] != 0) ? '../../' : ''; if ($layoutData['clock_animation'] == 'analogic_1') { $img = ''; } else { @@ -1901,7 +1901,7 @@ function visual_map_print_item( } } else { $is_meta = is_metaconsole(); - + $agents_critical = agents_get_agents( [ 'disabled' => 0, From 49e03f5e4420e2c200a818f742670c39e88fda66 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Mon, 13 Jan 2020 11:29:18 +0100 Subject: [PATCH 09/18] Fixed XSS vulnerability --- pandora_console/godmode/reporting/graphs.php | 2 +- pandora_console/include/functions_reporting.php | 4 +++- pandora_console/include/functions_reporting_html.php | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pandora_console/godmode/reporting/graphs.php b/pandora_console/godmode/reporting/graphs.php index 155eb560db..958819a95b 100644 --- a/pandora_console/godmode/reporting/graphs.php +++ b/pandora_console/godmode/reporting/graphs.php @@ -290,7 +290,7 @@ $table_aux = new stdClass(); foreach ($result_graphs as $graph) { $data = []; - $data[0] = ''.ui_print_truncate_text(io_safe_output($graph['name']), 70).''; + $data[0] = ''.ui_print_truncate_text($graph['name'], 70).''; $data[1] = ui_print_truncate_text($graph['description'], 70); diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 7bffd6087d..44b6651c3b 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -190,6 +190,8 @@ function reporting_make_reporting_data( $metaconsole_on = is_metaconsole(); $index_content = 0; foreach ($contents as $content) { + $content['name'] = io_safe_input($content['name']); + $content['description'] = io_safe_input($content['description']); if (!empty($content['id_agent_module']) && !empty($content['id_agent']) && tags_has_user_acl_tags($config['id_user']) ) { @@ -7640,7 +7642,7 @@ function reporting_custom_graph( $return['title'] = $content['name']; $return['landscape'] = $content['landscape']; $return['pagebreak'] = $content['pagebreak']; - $return['subtitle'] = io_safe_output($graph['name']); + $return['subtitle'] = $graph['name']; $return['agent_name'] = $agent_alias; $return['module_name'] = $module_name; $return['description'] = $content['description']; diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index ac7ee7cd21..b81024559f 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -130,7 +130,7 @@ function html_do_report_info($report) $html .= ' - '.__('Description').': '.io_safe_output($report['description']).' + '.__('Description').': '.htmlspecialchars($report['description']).' '.''; From 40a86384c24de8542608de43195d6f89f9493288 Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Mon, 13 Jan 2020 13:00:43 +0100 Subject: [PATCH 10/18] Add comment in events when status is changed --- pandora_console/include/functions_events.php | 32 +++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 53005037df..aa4bb5edec 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -624,7 +624,37 @@ function events_update_status($id_evento, $status, $filter=null, $history=false) break; } - return db_process_sql($update_sql); + $result = db_process_sql($update_sql); + + if ($result) { + switch ($status) { + case EVENT_STATUS_NEW: + $status_string = 'New'; + break; + + case EVENT_STATUS_VALIDATED: + $status_string = 'Validated'; + break; + + case EVENT_STATUS_INPROCESS: + $status_string = 'In process'; + break; + + default: + $status_string = ''; + break; + } + + events_comment( + $id_evento, + '', + 'Change status to '.$status_string, + is_metaconsole() ? true : false, + $history + ); + } + + return $result; } From 1747806256f72fd2fdd4a26e20860f8503930535 Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Mon, 13 Jan 2020 18:19:50 +0100 Subject: [PATCH 11/18] Ent 3136 no se ven los eventos en el mapa de servicios cuando haces click en los elementos de un servicio creado en la meta --- pandora_console/operation/events/events.php | 32 +++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 700a2026c1..9cabe15b47 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -135,6 +135,10 @@ $id_agent = get_parameter( 'filter[id_agent]', $filter['id_agent'] ); +$text_module = get_parameter( + 'filter[text_module]', + $filter['text_module'] +); $id_agent_module = get_parameter( 'filter[id_agent_module]', $filter['id_agent_module'] @@ -210,10 +214,38 @@ $id_source_event = get_parameter( $filter['id_source_event'] ); +$server_id = get_parameter( + 'filter[server_id]', + $filter['id_server_meta'] +); + +if (is_metaconsole()) { + // Connect to node database. + $id_node = $server_id; + if ($id_node != 0) { + if (metaconsole_connect(null, $id_node) != NOERR) { + return false; + } + } +} + + if (empty($text_agent) && !empty($id_agent)) { $text_agent = agents_get_alias($id_agent); } +if (empty($text_module) && !empty($id_agent_module)) { + $text_module = modules_get_agentmodule_name($id_agent_module); + $text_agent = agents_get_alias(modules_get_agentmodule_agent($id_agent_module)); +} + +if (is_metaconsole()) { + // Return to metaconsole database. + if ($id_node != 0) { + metaconsole_restore_db(); + } +} + // Ajax responses. if (is_ajax()) { $get_events = get_parameter('get_events', 0); From db49db371116bcc4bf6b2c88045062c816d1e000 Mon Sep 17 00:00:00 2001 From: Luis Date: Mon, 13 Jan 2020 18:21:48 +0100 Subject: [PATCH 12/18] report font not depending of custom report front enabled --- .../godmode/reporting/reporting_builder.php | 4 +-- .../godmode/setup/setup_visuals.php | 28 +++++++++---------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index e5e7121b10..4ff734bef9 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -1207,8 +1207,7 @@ switch ($action) { $report_id_user = get_parameter('report_id_user'); $non_interactive = get_parameter('non_interactive', 0); - // Pretty font by default for pdf. - $custom_font = 'FreeSans.ttf'; + $custom_font = $config['custom_report_front_font']; switch ($type_access_selected) { case 'group_view': @@ -1284,7 +1283,6 @@ switch ($action) { $metaconsole_report = (int) is_metaconsole(); if ($config['custom_report_front']) { - $custom_font = $config['custom_report_front_font']; $logo = $config['custom_report_front_logo']; $header = $config['custom_report_front_header']; $first_page = $config['custom_report_front_firstpage']; diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index 60da29ea46..32268e7c1a 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -1048,6 +1048,20 @@ $row++; $row++; + $table_report->data[$row][0] = __('PDF font family'); + $table_report->data[$row][1] = html_print_select( + $fonts, + 'custom_report_front_font', + $config['custom_report_front_font'], + false, + __('Default'), + '', + true + ); + + $row++; + + $table_report->data[$row][0] = __('Graph image height for HTML reports'); $table_report->data[$row][0] .= ui_print_help_tip( __('This is the height in pixels of the module graph or custom graph in the reports (only: HTML)'), @@ -1078,18 +1092,6 @@ $row++; } } - // Font - $table_report->data['custom_report_front-font'][0] = __('Custom report front').' - '.__('Font family'); - $table_report->data['custom_report_front-font'][1] = html_print_select( - $fonts, - 'custom_report_front_font', - $config['custom_report_front_font'], - false, - __('Default'), - '', - true - ); - // Logo $table_report->data['custom_report_front-logo'][0] = __('Custom report front').' - '.__('Custom logo').ui_print_help_tip( __("The dir of custom logos is in your www Console in 'images/custom_logo'. You can upload more files (ONLY JPEG AND PNG) in upload tool in console."), @@ -1397,7 +1399,6 @@ function edit_csv_divider () { function display_custom_report_front (show,table) { if (show == true) { - $('tr#'+table+'-custom_report_front-font').show(); $('tr#'+table+'-custom_report_front-logo').show(); $('tr#'+table+'-custom_report_front-preview').show(); $('tr#'+table+'-custom_report_front-header').show(); @@ -1405,7 +1406,6 @@ function display_custom_report_front (show,table) { $('tr#'+table+'-custom_report_front-footer').show(); } else { - $('tr#'+table+'-custom_report_front-font').hide(); $('tr#'+table+'-custom_report_front-logo').hide(); $('tr#'+table+'-custom_report_front-preview').hide(); $('tr#'+table+'-custom_report_front-header').hide(); From 7204e7c0f2e5bcceb1a26fc835aedf3662987265 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Mon, 13 Jan 2020 18:24:29 +0100 Subject: [PATCH 13/18] Ent 4862 mas opciones en los filtros de severidad --- pandora_console/extras/mr/35.sql | 5 + .../pandoradb_migrate_6.0_to_7.0.mysql.sql | 1 + .../godmode/events/event_edit_filter.php | 21 +++- pandora_console/include/ajax/events.php | 12 +- pandora_console/include/functions_events.php | 103 ++++++++++++------ pandora_console/include/styles/events.css | 8 +- pandora_console/operation/events/events.php | 40 ++++--- pandora_console/pandoradb.sql | 2 +- 8 files changed, 126 insertions(+), 66 deletions(-) create mode 100644 pandora_console/extras/mr/35.sql diff --git a/pandora_console/extras/mr/35.sql b/pandora_console/extras/mr/35.sql new file mode 100644 index 0000000000..86236df36f --- /dev/null +++ b/pandora_console/extras/mr/35.sql @@ -0,0 +1,5 @@ +START TRANSACTION; + +ALTER TABLE `tevent_filter` MODIFY `severity` TEXT NOT NULL; + +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 ca415cd52a..0c95628752 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 @@ -1401,6 +1401,7 @@ ALTER TABLE tevent_filter ADD COLUMN `source` tinytext NOT NULL; ALTER TABLE tevent_filter ADD COLUMN `id_extra` tinytext NOT NULL; ALTER TABLE tevent_filter ADD COLUMN `id_source_event` int(10); ALTER TABLE `tevent_filter` MODIFY COLUMN `user_comment` text NOT NULL; +ALTER TABLE `tevent_filter` MODIFY COLUMN `severity` text NOT NULL; -- --------------------------------------------------------------------- -- Table `tusuario` diff --git a/pandora_console/godmode/events/event_edit_filter.php b/pandora_console/godmode/events/event_edit_filter.php index 41068372d4..a677c6f801 100644 --- a/pandora_console/godmode/events/event_edit_filter.php +++ b/pandora_console/godmode/events/event_edit_filter.php @@ -55,7 +55,7 @@ if ($id) { $id_group = $filter['id_group']; $id_name = $filter['id_name']; $event_type = $filter['event_type']; - $severity = $filter['severity']; + $severity = explode(',', $filter['severity']); $status = $filter['status']; $search = $filter['search']; $text_agent = $filter['text_agent']; @@ -123,7 +123,7 @@ if ($update || $create) { $id_group_filter = get_parameter('id_group_filter'); $id_name = (string) get_parameter('id_name'); $event_type = get_parameter('event_type', ''); - $severity = get_parameter('severity', ''); + $severity = implode(',', get_parameter('severity', -1)); $status = get_parameter('status', ''); $search = get_parameter('search', ''); $text_agent = get_parameter('text_agent', ''); @@ -172,6 +172,8 @@ if ($update || $create) { 'user_comment' => $user_comment, 'filter_only_alert' => $filter_only_alert, ]; + + $severity = explode(',', $severity); } if ($update) { @@ -289,15 +291,24 @@ $table->data[3][1] = html_print_select( true ); +if (empty($severity) && $severity !== '0') { + $severity = -1; +} + $table->data[4][0] = ''.__('Severity').''; $table->data[4][1] = html_print_select( get_priorities(), - 'severity', + 'severity[]', $severity, '', __('All'), - '-1', - true + -1, + true, + true, + true, + '', + false, + 'width: 175px' ); $fields = events_get_all_status(); diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index 24fa8be341..2a068e0214 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -231,7 +231,7 @@ if ($save_event_filter) { $values['id_name'] = get_parameter('id_name'); $values['id_group'] = get_parameter('id_group'); $values['event_type'] = get_parameter('event_type'); - $values['severity'] = get_parameter('severity'); + $values['severity'] = implode(',', get_parameter('severity', -1)); $values['status'] = get_parameter('status'); $values['search'] = get_parameter('search'); $values['text_agent'] = get_parameter('text_agent'); @@ -278,7 +278,7 @@ if ($update_event_filter) { $id = get_parameter('id'); $values['id_group'] = get_parameter('id_group'); $values['event_type'] = get_parameter('event_type'); - $values['severity'] = get_parameter('severity'); + $values['severity'] = implode(',', get_parameter('severity', -1)); $values['status'] = get_parameter('status'); $values['search'] = get_parameter('search'); $values['text_agent'] = get_parameter('text_agent'); @@ -439,8 +439,10 @@ function load_form_filter() { $("#id_group").val(val); if (i == 'event_type') $("#event_type").val(val); - if (i == 'severity') - $("#severity").val(val); + if (i == 'severity') { + const multiple = val.split(","); + $("#severity").val(multiple); + } if (i == 'status') $("#status").val(val); if (i == 'search') @@ -1579,7 +1581,7 @@ if ($get_list_events_agents) { $id_agent = get_parameter('id_agent'); $server_id = get_parameter('server_id'); $event_type = get_parameter('event_type'); - $severity = get_parameter('severity'); + $severity = implode(',', get_parameter('severity', -1)); $status = get_parameter('status'); $search = get_parameter('search'); $id_agent_module = get_parameter('id_agent_module'); diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 53005037df..3734c93092 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -751,43 +751,78 @@ function events_get_all( } if (isset($filter['severity']) && $filter['severity'] > 0) { - switch ($filter['severity']) { - case EVENT_CRIT_MAINTENANCE: - case EVENT_CRIT_INFORMATIONAL: - case EVENT_CRIT_NORMAL: - case EVENT_CRIT_MINOR: - case EVENT_CRIT_WARNING: - case EVENT_CRIT_MAJOR: - case EVENT_CRIT_CRITICAL: - default: - $sql_filters[] = sprintf( - ' AND criticity = %d ', - $filter['severity'] - ); - break; + if (is_array($filter['severity'])) { + if (!in_array(-1, $filter['severity'])) { + $not_normal = array_search(EVENT_CRIT_NOT_NORMAL, $filter['severity']); + if ($not_normal !== false) { + unset($filter['severity'][$not_normal]); + $sql_filters[] = sprintf( + ' AND criticity != %d', + EVENT_CRIT_NORMAL + ); + } else { + $critical_warning = array_search(EVENT_CRIT_WARNING_OR_CRITICAL, $filter['severity']); + if ($critical_warning !== false) { + unset($filter['severity'][$critical_warning]); + $filter['severity'][] = EVENT_CRIT_WARNING; + $filter['severity'][] = EVENT_CRIT_CRITICAL; + } - case EVENT_CRIT_WARNING_OR_CRITICAL: - $sql_filters[] = sprintf( - ' AND (criticity = %d OR criticity = %d)', - EVENT_CRIT_WARNING, - EVENT_CRIT_CRITICAL - ); - break; + $critical_normal = array_search(EVENT_CRIT_OR_NORMAL, $filter['severity']); + if ($critical_normal !== false) { + unset($filter['severity'][$critical_normal]); + $filter['severity'][] = EVENT_CRIT_NORMAL; + $filter['severity'][] = EVENT_CRIT_CRITICAL; + } - case EVENT_CRIT_NOT_NORMAL: - $sql_filters[] = sprintf( - ' AND criticity != %d', - EVENT_CRIT_NORMAL - ); - break; + if (!empty($filter['severity'])) { + $filter['severity'] = implode(',', $filter['severity']); + $sql_filters[] = sprintf( + ' AND criticity IN (%s)', + $filter['severity'] + ); + } + } + } + } else { + switch ($filter['severity']) { + case EVENT_CRIT_MAINTENANCE: + case EVENT_CRIT_INFORMATIONAL: + case EVENT_CRIT_NORMAL: + case EVENT_CRIT_MINOR: + case EVENT_CRIT_WARNING: + case EVENT_CRIT_MAJOR: + case EVENT_CRIT_CRITICAL: + default: + $sql_filters[] = sprintf( + ' AND criticity = %d ', + $filter['severity'] + ); + break; - case EVENT_CRIT_OR_NORMAL: - $sql_filters[] = sprintf( - ' AND (criticity = %d OR criticity = %d)', - EVENT_CRIT_NORMAL, - EVENT_CRIT_CRITICAL - ); - break; + case EVENT_CRIT_WARNING_OR_CRITICAL: + $sql_filters[] = sprintf( + ' AND (criticity = %d OR criticity = %d)', + EVENT_CRIT_WARNING, + EVENT_CRIT_CRITICAL + ); + break; + + case EVENT_CRIT_NOT_NORMAL: + $sql_filters[] = sprintf( + ' AND criticity != %d', + EVENT_CRIT_NORMAL + ); + break; + + case EVENT_CRIT_OR_NORMAL: + $sql_filters[] = sprintf( + ' AND (criticity = %d OR criticity = %d)', + EVENT_CRIT_NORMAL, + EVENT_CRIT_CRITICAL + ); + break; + } } } diff --git a/pandora_console/include/styles/events.css b/pandora_console/include/styles/events.css index 9461fcf424..a0b2fdf89c 100644 --- a/pandora_console/include/styles/events.css +++ b/pandora_console/include/styles/events.css @@ -30,7 +30,6 @@ div.mini-criticity.h100p { form.flex-row div.filter_input, form.flex-row ul { width: 30%; - min-width: 300px; display: flex; flex-direction: row; align-items: baseline; @@ -47,12 +46,13 @@ div.filter_input_little { flex-direction: row; align-items: baseline; flex-wrap: nowrap; - margin: 0.5em 0 0.5em 1em; + margin: 0.5em 0 0.5em 0em; } form.flex-row div.filter_input.large { flex: 1; - min-width: 470px; + min-width: 700px; + max-width: 100%; } div.filter_input > label, @@ -120,6 +120,8 @@ table.dataTable tbody td { .filter_input { align-items: center; + min-width: 400px; + max-width: 450px; } .filter_input_little > select, diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 9cabe15b47..3b065f9c12 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -894,22 +894,6 @@ $in = '
'; $in .= $data.'
'; $inputs[] = $in; -// Criticity - severity. -$severity_select .= html_print_select( - get_priorities(), - 'severity', - $severity, - '', - __('All'), - '-1', - true, - false, - false -); -$in = '
'; -$in .= $severity_select.'
'; -$inputs[] = $in; - // Event status. $data = html_print_select( events_get_all_status(), @@ -961,6 +945,28 @@ $in = '
'; $in .= $data.'
'; $inputs[] = $in; +if (empty($severity) && $severity !== '0') { + $severity = -1; +} + +// Criticity - severity. +$data = html_print_select( + get_priorities(), + 'severity', + $severity, + '', + __('All'), + -1, + true, + true, + true, + '', + false +); +$in = '
'; +$in .= $data.'
'; +$inputs[] = $in; + $buttons = []; $buttons[] = [ @@ -1115,8 +1121,6 @@ if (is_metaconsole()) { $adv_inputs[] = $in; } -// Gap. -$adv_inputs[] = '
'; // Date from. $data = html_print_input_text( diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index d1db588a10..a42a9592c3 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1098,7 +1098,7 @@ CREATE TABLE IF NOT EXISTS `tevent_filter` ( `id_name` varchar(600) NOT NULL, `id_group` int(10) NOT NULL default 0, `event_type` text NOT NULL, - `severity` int(10) NOT NULL default -1, + `severity` text NOT NULL, `status` int(10) NOT NULL default -1, `search` TEXT, `text_agent` TEXT, From 8038e16c25ea5540849dc5e1dfa38908bcb07ca8 Mon Sep 17 00:00:00 2001 From: artica Date: Tue, 14 Jan 2020 00:01:11 +0100 Subject: [PATCH 14/18] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.rhel7.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 3a3027a6fd..ccf1e6c2ad 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.742-200113 +Version: 7.0NG.742-200114 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 c9453f3fb2..7314499ab3 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.742-200113" +pandora_version="7.0NG.742-200114" 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 4d728d0008..6e1efa4868 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.742'; -use constant AGENT_BUILD => '200113'; +use constant AGENT_BUILD => '200114'; # 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 047ee13afe..f47a498bdc 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.742 -%define release 200113 +%define release 200114 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 9aa2292cee..acb7a38982 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.742 -%define release 200113 +%define release 200114 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 e163bd087c..051e123b28 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.742" -PI_BUILD="200113" +PI_BUILD="200114" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index bec07f8982..83bfea33da 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{200113} +{200114} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 004eccac56..8a3003ecd3 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.742(Build 200113)") +#define PANDORA_VERSION ("7.0NG.742(Build 200114)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 07f4a61cc6..f4af970791 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.742(Build 200113))" + VALUE "ProductVersion", "(7.0NG.742(Build 200114))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index cd5255f13a..ac738db348 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.742-200113 +Version: 7.0NG.742-200114 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 5616aecefa..7017eea4f8 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.742-200113" +pandora_version="7.0NG.742-200114" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 56ec47231b..4e63624557 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 = 'PC200113'; +$build_version = 'PC200114'; $pandora_version = 'v7.0NG.742'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 8f532b8d49..c568f67531 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 6ce68748b8..c689ba7a7a 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.742 -%define release 200113 +%define release 200114 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 7bed1022d4..ce662c1222 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.742 -%define release 200113 +%define release 200114 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 25a89cfce6..20a9682602 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.742" -PI_BUILD="200113" +PI_BUILD="200114" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 1092e461f5..61e03cf39d 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.742 PS200113"; +my $version = "7.0NG.742 PS200114"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 221d99dbb1..f068b6d93a 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.742 PS200113"; +my $version = "7.0NG.742 PS200114"; # save program name for logging my $progname = basename($0); From 7c928b8100c573a0563fdd0b1eb966ac5e57ded3 Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Tue, 14 Jan 2020 08:37:04 +0100 Subject: [PATCH 15/18] Ent 4795 check seleccionar todos queda marcado --- pandora_console/include/javascript/pandora_events.js | 2 +- pandora_console/operation/events/events.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/javascript/pandora_events.js b/pandora_console/include/javascript/pandora_events.js index 79668406e1..8f23339692 100644 --- a/pandora_console/include/javascript/pandora_events.js +++ b/pandora_console/include/javascript/pandora_events.js @@ -214,8 +214,8 @@ function show_massive_response_dialog( $("#button-submit_event_response").show(); }, close: function() { + $("#checkbox-all_validate_box").prop("checked", false); $(".chk_val").prop("checked", false); - $("#event_response_command_window").dialog("close"); }, width: response["modal_width"], height: response["modal_height"] diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 3b065f9c12..3c758fde12 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -1670,6 +1670,10 @@ function process_datatables_callback(table, settings) { } + // Uncheck checkbox to select all. + if ($('#checkbox-all_validate_box').length) { + $('#checkbox-all_validate_box').uncheck(); + } } function process_datatables_item(item) { From 6bf5d07a2cf64e00ed415164b35781c0627cecc7 Mon Sep 17 00:00:00 2001 From: artica Date: Wed, 15 Jan 2020 00:01:09 +0100 Subject: [PATCH 16/18] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.rhel7.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index ccf1e6c2ad..a54002818d 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.742-200114 +Version: 7.0NG.742-200115 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 7314499ab3..ec00c3d207 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.742-200114" +pandora_version="7.0NG.742-200115" 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 6e1efa4868..366e7ad559 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.742'; -use constant AGENT_BUILD => '200114'; +use constant AGENT_BUILD => '200115'; # 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 f47a498bdc..fd41ec1f90 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.742 -%define release 200114 +%define release 200115 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 acb7a38982..920028aef8 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.742 -%define release 200114 +%define release 200115 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 051e123b28..df8455a431 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.742" -PI_BUILD="200114" +PI_BUILD="200115" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 83bfea33da..214118aaff 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{200114} +{200115} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 8a3003ecd3..6889d27878 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.742(Build 200114)") +#define PANDORA_VERSION ("7.0NG.742(Build 200115)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index f4af970791..a206edfda6 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.742(Build 200114))" + VALUE "ProductVersion", "(7.0NG.742(Build 200115))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index ac738db348..543a1c91f4 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.742-200114 +Version: 7.0NG.742-200115 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 7017eea4f8..0048357d77 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.742-200114" +pandora_version="7.0NG.742-200115" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 4e63624557..9585142299 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 = 'PC200114'; +$build_version = 'PC200115'; $pandora_version = 'v7.0NG.742'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index c568f67531..dd26d01916 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index c689ba7a7a..9bf45f239b 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.742 -%define release 200114 +%define release 200115 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index ce662c1222..9d3f896141 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.742 -%define release 200114 +%define release 200115 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 20a9682602..528e0568d4 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.742" -PI_BUILD="200114" +PI_BUILD="200115" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 61e03cf39d..8864f9ddac 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.742 PS200114"; +my $version = "7.0NG.742 PS200115"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index f068b6d93a..81eabe2acc 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.742 PS200114"; +my $version = "7.0NG.742 PS200115"; # save program name for logging my $progname = basename($0); From 2926ead13b50df8cfc8c207473ef9b1c8b54d276 Mon Sep 17 00:00:00 2001 From: Luis Date: Wed, 15 Jan 2020 12:14:37 +0100 Subject: [PATCH 17/18] Fixed group change on networkmap.ACL and source group working separated --- pandora_console/extras/mr/35.sql | 3 +- .../pandoradb_migrate_6.0_to_7.0.mysql.sql | 2 + .../include/functions_networkmap.php | 14 +++ .../agentes/pandora_networkmap.editor.php | 90 +++++++++++++++++-- .../operation/agentes/pandora_networkmap.php | 63 ++++++++----- .../agentes/pandora_networkmap.view.php | 10 +-- pandora_console/pandoradb.sql | 1 + 7 files changed, 148 insertions(+), 35 deletions(-) diff --git a/pandora_console/extras/mr/35.sql b/pandora_console/extras/mr/35.sql index 86236df36f..3a002f44f8 100644 --- a/pandora_console/extras/mr/35.sql +++ b/pandora_console/extras/mr/35.sql @@ -1,5 +1,6 @@ START TRANSACTION; +ALTER TABLE `tmap` ADD COLUMN `id_group_map` INT(10) UNSIGNED NOT NULL default 0; ALTER TABLE `tevent_filter` MODIFY `severity` TEXT NOT NULL; -COMMIT; \ No newline at end of file +COMMIT; 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 0c95628752..bbc07ad08c 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 @@ -1195,6 +1195,8 @@ CREATE TABLE IF NOT EXISTS `tmap` ( `generation_method` INTEGER UNSIGNED NOT NULL default 0, `generated` INTEGER UNSIGNED NOT NULL default 0, `filter` TEXT, + `id_group_map` INT(10) UNSIGNED NOT NULL default 0, + PRIMARY KEY(`id`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php index dda25538ee..56172331c6 100644 --- a/pandora_console/include/functions_networkmap.php +++ b/pandora_console/include/functions_networkmap.php @@ -1453,6 +1453,20 @@ function networkmap_delete_nodes($id_map) } +/** + * Delete relations given id_map + * + * @param integer $id_map + * @return integer result + */ +function networkmap_delete_relations($id_map) +{ + $result = db_process_sql_delete('trel_item', ['id_map' => $id_map]); + + return $result; +} + + function get_networkmaps($id) { $groups = array_keys(users_get_groups(null, 'IW')); diff --git a/pandora_console/operation/agentes/pandora_networkmap.editor.php b/pandora_console/operation/agentes/pandora_networkmap.editor.php index 7f698d8653..d719df08cd 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.editor.php +++ b/pandora_console/operation/agentes/pandora_networkmap.editor.php @@ -81,8 +81,8 @@ if ($edit_networkmap) { $id_group = $values['id_group']; // ACL for the network map. - $networkmap_write = check_acl($config['id_user'], $id_group, 'MW'); - $networkmap_manage = check_acl($config['id_user'], $id_group, 'MM'); + $networkmap_write = check_acl($config['id_user'], $id_group_map, 'MW'); + $networkmap_manage = check_acl($config['id_user'], $id_group_map, 'MM'); if (!$networkmap_write && !$networkmap_manage) { db_pandora_audit( @@ -95,6 +95,9 @@ if ($edit_networkmap) { $name = io_safe_output($values['name']); + // Id group of the map itself, not data source. + $id_group_map = $values['id_group_map']; + $description = $values['description']; $filter = json_decode($values['filter'], true); @@ -267,8 +270,8 @@ if ($not_found) { $config['id_user'], 'AR', true, - 'id_group', - $id_group, + 'id_group_map', + $id_group_map, '', '', '', @@ -329,6 +332,28 @@ if ($not_found) { $table->data['source_data_ip_mask'][0] = __('Source from CIDR IP mask'); $table->data['source_data_ip_mask'][1] = html_print_input_text('ip_mask', $ip_mask, '', 20, 255, true, $disabled_source); + $table->data['source_data_group'][0] = __('Source group'); + $table->data['source_data_group'][1] = html_print_select_groups( + $config['id_user'], + 'AR', + true, + 'id_group', + $id_group, + '', + '', + '', + true + ); + $table->data['source_data_group'][1] .= html_print_image( + 'images/error.png', + true, + [ + 'id' => 'group_change_warning', + 'title' => __('Source id group changed. All elements in networkmap will be lost.'), + 'style' => 'display : none', + ] + ); + $table->data['source_data_dont_show_subgroups'][0] = __('Don\'t show subgroups:'); $table->data['source_data_dont_show_subgroups'][1] = html_print_checkbox( 'dont_show_subgroups', @@ -379,7 +404,7 @@ if ($not_found) { $table->data['kval'][0] = __('Default ideal node separation'); $table->data['kval'][1] = html_print_input_text('kval', $kval, '', 5, 10, true, $disabled_source, false, $itemClass).ui_print_help_tip(__('Only fdp. Default ideal node separation in the layout. By default 0.3'), true); - echo '
'; + echo ''; html_print_table($table); @@ -420,8 +445,11 @@ $(document).ready(function() { .css('display', 'none'); $("#form_editor-source_data_dont_show_subgroups") .css('display', 'none'); + $("#form_editor-source_data_group") + .css('display', 'none'); $("#form_editor-source_data_recon_task") .css('display', ''); + } else if (source == 'ip_mask') { $("#form_editor-source_data_ip_mask") @@ -430,6 +458,8 @@ $(document).ready(function() { .css('display', 'none'); $("#form_editor-source_data_dont_show_subgroups") .css('display', 'none'); + $("#form_editor-source_data_group") + .css('display', 'none'); } else if (source == 'group') { $("#form_editor-source_data_ip_mask") @@ -438,6 +468,8 @@ $(document).ready(function() { .css('display', 'none'); $("#form_editor-source_data_dont_show_subgroups") .css('display', ''); + $("#form_editor-source_data_group") + .css('display', ''); } }); @@ -508,5 +540,53 @@ $(document).ready(function() { $("input[name='source']").trigger("change"); $("#method").trigger("change"); + + + // Control if id_group has changed. + var id_group_old = $("#id_group").val(); + var id_group_changed = false; + + $("#id_group").on('change',{id_group_old: id_group_old}, function () { + + var id_group_new = $("#id_group").val(); + if((id_group_old != id_group_new) && (update_networkmap == 1 )) { + id_group_changed = true; + $("#group_change_warning").show(); + + } else { + id_group_changed = false; + $("#group_change_warning").hide(); + } + }); + + var update_networkmap = 0; + // Show advice if id_group has changed. + update_networkmap = $("input[name='update_networkmap']").val(); + + $( "#submit-crt" ).click(function( event ) { + + if(update_networkmap == 1 && id_group_changed === true) { + confirmDialog({ + title: '', + message: '', + ok: '', + cancel: '', + onDeny: function() { + // Continue execution. + return false; + }, + onAccept: function () { + // Submit form + $("#networkmap_options_form").submit(); + } + }) + event.preventDefault(); + } + }); + + +}); + + diff --git a/pandora_console/operation/agentes/pandora_networkmap.php b/pandora_console/operation/agentes/pandora_networkmap.php index 2aa1404e30..97ebcf82c3 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.php +++ b/pandora_console/operation/agentes/pandora_networkmap.php @@ -12,10 +12,10 @@ // Load global variables global $config; -// Check user credentials +// Check user credentials. check_login(); -// General ACL for the network maps +// General ACL for the network maps. $networkmaps_read = check_acl($config['id_user'], 0, 'MR'); $networkmaps_write = check_acl($config['id_user'], 0, 'MW'); $networkmaps_manage = check_acl($config['id_user'], 0, 'MM'); @@ -53,11 +53,12 @@ if (enterprise_installed()) { if ($save_empty_networkmap) { $id_group = (int) get_parameter('id_group', 0); + $id_group_map = (int) get_paramater('id_group_map', 0); - // ACL for the network map + // ACL for the network map. // $networkmap_read = check_acl ($config['id_user'], $id_group, "MR"); - $networkmap_write = check_acl($config['id_user'], $id_group, 'MW'); - $networkmap_manage = check_acl($config['id_user'], $id_group, 'MM'); + $networkmap_write = check_acl($config['id_user'], $id_group_map, 'MW'); + $networkmap_manage = check_acl($config['id_user'], $id_group_map, 'MM'); if (!$networkmap_write && !$networkmap_manage) { db_pandora_audit( @@ -93,6 +94,7 @@ if (enterprise_installed()) { $values['description'] = $description; $values['source'] = 0; $values['source_data'] = $id_group; + $values['id_group_map'] = $id_group_map; if (!$networkmap_write && !$networkmap_manage) { @@ -139,10 +141,12 @@ if (enterprise_installed()) { } } else if ($update_empty_networkmap) { $id_group = (int) get_parameter('id_group', 0); + $id_group_map = (int) get_parameter('id_group_map', 0); + // ACL for the new network map - $networkmap_write_new = check_acl($config['id_user'], $id_group, 'MW'); - $networkmap_manage_new = check_acl($config['id_user'], $id_group, 'MM'); + $networkmap_write_new = check_acl($config['id_user'], $id_group_map, 'MW'); + $networkmap_manage_new = check_acl($config['id_user'], $id_group_map, 'MM'); if (!$networkmap_write && !$networkmap_manage) { db_pandora_audit( @@ -221,11 +225,13 @@ if ($new_networkmap || $save_networkmap) { if ($save_networkmap) { $id_group = (int) get_parameter('id_group', 0); + $id_group_map = (int) get_parameter('id_group_map', 0); + // ACL for the network map // $networkmap_read = check_acl ($config['id_user'], $id_group, "MR"); - $networkmap_write = check_acl($config['id_user'], $id_group, 'MW'); - $networkmap_manage = check_acl($config['id_user'], $id_group, 'MM'); + $networkmap_write = check_acl($config['id_user'], $id_group_map, 'MW'); + $networkmap_manage = check_acl($config['id_user'], $id_group_map, 'MM'); if (!$networkmap_write && !$networkmap_manage) { db_pandora_audit( @@ -282,6 +288,7 @@ if ($new_networkmap || $save_networkmap) { $values['height'] = $height; $values['id_user'] = $config['id_user']; $values['description'] = $description; + $values['id_group_map'] = $id_group_map; switch ($method) { case 'twopi': @@ -401,8 +408,10 @@ else if ($update_networkmap || $copy_networkmap || $delete) { return; } - $id_group_old = db_get_value('id_group', 'tmap', 'id', $id); - if ($id_group_old === false) { + // ACL for the network map. + $id_group_map_old = db_get_value('id_group_map', 'tmap', 'id', $id); + + if ($id_group_map_old === false) { db_pandora_audit( 'ACL Violation', 'Trying to accessnode graph builder' @@ -411,9 +420,8 @@ else if ($update_networkmap || $copy_networkmap || $delete) { return; } - // ACL for the network map - $networkmap_write = check_acl($config['id_user'], $id_group_old, 'MW'); - $networkmap_manage = check_acl($config['id_user'], $id_group_old, 'MM'); + $networkmap_write = check_acl($config['id_user'], $id_group_map_old, 'MW'); + $networkmap_manage = check_acl($config['id_user'], $id_group_map_old, 'MM'); if (!$networkmap_write && !$networkmap_manage) { db_pandora_audit( @@ -426,10 +434,14 @@ else if ($update_networkmap || $copy_networkmap || $delete) { if ($update_networkmap) { $id_group = (int) get_parameter('id_group', 0); + // Get id of old group source to check changes. + $id_group_old = db_get_value('id_group', 'tmap', 'id', $id); + // ACL for the new network map - $networkmap_write_new = check_acl($config['id_user'], $id_group, 'MW'); - $networkmap_manage_new = check_acl($config['id_user'], $id_group, 'MM'); + $id_group_map = (int) get_parameter('id_group_map', 0); + $networkmap_write_new = check_acl($config['id_user'], $id_group_map, 'MW'); + $networkmap_manage_new = check_acl($config['id_user'], $id_group_map, 'MM'); if (!$networkmap_write && !$networkmap_manage) { db_pandora_audit( @@ -456,6 +468,7 @@ else if ($update_networkmap || $copy_networkmap || $delete) { $values = []; $values['name'] = $name; $values['id_group'] = $id_group; + $values['id_group_map'] = $id_group_map; $description = get_parameter('description', ''); $values['description'] = $description; @@ -493,6 +506,8 @@ else if ($update_networkmap || $copy_networkmap || $delete) { // If change the group, the map must be regenerated if ($id_group != $id_group_old) { networkmap_delete_nodes($id); + // Delete relations. + networkmap_delete_relations($id); } $networkmap_write = $networkmap_write_new; @@ -701,9 +716,9 @@ switch ($tab) { $network_maps = db_get_all_rows_filter( 'tmap', [ - 'id_group' => $id_groups, - 'limit' => $limit, - 'offset' => $offset, + 'id_group_map' => $id_groups, + 'limit' => $limit, + 'offset' => $offset, ] ); @@ -712,9 +727,9 @@ switch ($tab) { foreach ($network_maps as $network_map) { // ACL for the network map - $networkmap_read = check_acl($config['id_user'], $network_map['id_group'], 'MR'); - $networkmap_write = check_acl($config['id_user'], $network_map['id_group'], 'MW'); - $networkmap_manage = check_acl($config['id_user'], $network_map['id_group'], 'MM'); + $networkmap_read = check_acl($config['id_user'], $network_map['id_group_map'], 'MR'); + $networkmap_write = check_acl($config['id_user'], $network_map['id_group_map'], 'MW'); + $networkmap_manage = check_acl($config['id_user'], $network_map['id_group_map'], 'MM'); if (!$networkmap_read && !$networkmap_write && !$networkmap_manage) { db_pandora_audit( @@ -722,7 +737,7 @@ switch ($tab) { 'Trying to access networkmap enterprise' ); include 'general/noaccess.php'; - return; + continue; } $data = []; @@ -768,7 +783,7 @@ switch ($tab) { } } - $data['groups'] = ui_print_group_icon($network_map['id_group'], true); + $data['groups'] = ui_print_group_icon($network_map['id_group_map'], true); if ($networkmap_write || $networkmap_manage) { $table->cellclass[] = [ diff --git a/pandora_console/operation/agentes/pandora_networkmap.view.php b/pandora_console/operation/agentes/pandora_networkmap.view.php index 2ee34806d9..3c4565fe9a 100644 --- a/pandora_console/operation/agentes/pandora_networkmap.view.php +++ b/pandora_console/operation/agentes/pandora_networkmap.view.php @@ -576,8 +576,8 @@ if (is_ajax()) { $filter = json_encode($array_filter); // ACL for the network map. - $networkmap_write = check_acl($config['id_user'], $networkmap['id_group'], 'MW'); - $networkmap_manage = check_acl($config['id_user'], $networkmap['id_group'], 'MM'); + $networkmap_write = check_acl($config['id_user'], $networkmap['id_group_map'], 'MW'); + $networkmap_manage = check_acl($config['id_user'], $networkmap['id_group_map'], 'MM'); if (!$networkmap_write && !$networkmap_manage) { db_pandora_audit( @@ -800,9 +800,9 @@ if ($networkmap === false) { return; } else { // ACL for the network map. - $networkmap_read = check_acl($config['id_user'], $networkmap['id_group'], 'MR'); - $networkmap_write = check_acl($config['id_user'], $networkmap['id_group'], 'MW'); - $networkmap_manage = check_acl($config['id_user'], $networkmap['id_group'], 'MM'); + $networkmap_read = check_acl($config['id_user'], $networkmap['id_group_map'], 'MR'); + $networkmap_write = check_acl($config['id_user'], $networkmap['id_group_map'], 'MW'); + $networkmap_manage = check_acl($config['id_user'], $networkmap['id_group_map'], 'MM'); if (!$networkmap_read && !$networkmap_write && !$networkmap_manage) { db_pandora_audit( diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index a42a9592c3..134eceba32 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -2188,6 +2188,7 @@ CREATE TABLE IF NOT EXISTS `tmap` ( `generation_method` INTEGER UNSIGNED NOT NULL default 0, `generated` INTEGER UNSIGNED NOT NULL default 0, `filter` TEXT, + `id_group_map` INT(10) UNSIGNED NOT NULL default 0, PRIMARY KEY(`id`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8; From 28b585196b08339137f7a29d58aaf1fc353ec90a Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Wed, 15 Jan 2020 14:11:36 +0100 Subject: [PATCH 18/18] Ent 5099 dobles interfaces en mapas de red no se visualizan --- pandora_console/include/class/NetworkMap.class.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pandora_console/include/class/NetworkMap.class.php b/pandora_console/include/class/NetworkMap.class.php index b28b43f502..43fb9138c7 100644 --- a/pandora_console/include/class/NetworkMap.class.php +++ b/pandora_console/include/class/NetworkMap.class.php @@ -1340,6 +1340,10 @@ class NetworkMap if ($rel['parent_type'] == NODE_MODULE && $rel['child_type'] == NODE_MODULE ) { + // Keep std references. + $ref_id_parent = $id_parent; + $ref_id_child = $id_child; + // Module information available. $id_parent = $rel['id_parent_source_data']; $id_child = $rel['id_child_source_data']; @@ -1374,6 +1378,12 @@ class NetworkMap 'index' => $index, 'priority' => $priority, ]; + + // Keep node reference mapping - low precedence relationship. + $rel_map[$ref_id_parent.'_'.$ref_id_child] = [ + 'index' => $index, + 'priority' => $priority, + ]; } } else if ($rel['parent_type'] == NODE_AGENT && $rel['child_type'] == NODE_AGENT