diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 0a90587226..306ac8f2a5 100644 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -7,31 +7,34 @@ Cacti CHANGELOG 1.1.28 -issue#958: User Group Tree permissions not calculated fully --issue#959: Issue viewing email reports due to email client decoder issues --issue#992: RRDfile naming issues that result from random sorting during export on prior versions --issue#1012: Issue where disabled devices will not appear on the Tree edit page --issue#1044: Handle invalid exclusion regex properly when viewing the Cacti Log +-issue#959: Issue viewing email reports due to email client decoding problems +-issue#992: RRDfile naming issues that result from random sorting during export +-issue#1012: Issue where disabled devices will not appear in Tree editor +-issue#1044: Handle invalid exclusion regex properly when viewing the log -issue#1045: Issue with multiple pages and confirmation dialogs --issue#1048: Issue importing vdefs from a template --issue#1053: Remote Data Collector issues with https and self signed certificates +-issue#1048: Problem importing vdefs from templates +-issue#1053: Remote Data Collector now works with https and self signed certificates -issue#1055: Errors in data source statistics inserts when invalid output is encountered -issue#1057: CVE-2017-16641 - Potential vulnerability in RRDtool functions -issue#1058: ICMP Ping to and IPv6 address fails to gather data for ping latency -issue#1059: Aggregate item filter should use regular expressions to avoid SQL errors due to flawed filter logic -issue#1064: When a Device Template is removed, Automation Templates for that Device Template remain -issue#1066: CVE-2017-16660 in remote_agent.php logging function --issue#1066: CVE-2017-16661 in view Cacti log file --issue#1071: CVE-2017-16785 in global_session.php Reflection XSS issue +-issue#1066: CVE-2017-16661 in view log file +-issue#1071: CVE-2017-16785 in global_session.php Reflection XSS +-issue#1074: Boost records get stuck in archive -issue#1079: Undefined index in lib/snmpagent.php --issue#1085: Undefined function html_log_input_error in debug --issue#1087: add_device.php --proxy option does not work with non-snmp devices --issue: Minor performance increase in boost process +-issue#1085: Undefined function html_log_input_error +-issue#1086: Rerun data queries in automation process has no effect +-issue#1087: cli/add_device.php --proxy option does not work with non-snmp devices +-issue#1088: Set timeout for remote data collector context +-issue: Minor performance increase in boost processing -issue: Poller output not empty not processed correctly on Log tab --feature: Add a timeout to the remote agent for realtime graphs --feature: updated Dutch translations +-feature: Timeout to the remote agent for realtime graphs +-feature: Updated Dutch translations -feature: Database update adding additional indexes for increased performance --feature: updated PHPMailer to version 5.2.26 --feature: updated phpseclib to version 2.0.7 +-feature: Updated PHPMailer to version 5.2.26 +-feature: Updated phpseclib to version 2.0.7 1.1.27 -issue#1033: Issues inserting into dsstats table due to legacy data diff --git a/lib/boost.php b/lib/boost.php index f1a30f063b..18f0285694 100644 --- a/lib/boost.php +++ b/lib/boost.php @@ -554,9 +554,10 @@ function boost_timer_get_overhead() { /* boost_get_arch_table_name - returns current archive boost table or false if no arch table is present currently */ function boost_get_arch_table_name() { global $database_default; + $tables = db_fetch_assoc("SELECT table_name AS name FROM information_schema.tables - WHERE table_schema='$database_default' + WHERE table_schema = '$database_default' AND table_name LIKE 'poller_output_boost_arch_%'"); foreach($tables as $table) { @@ -565,6 +566,7 @@ function boost_get_arch_table_name() { return $table['name']; } } + return false; } @@ -595,7 +597,7 @@ function boost_process_poller_output($local_data_id = '', $rrdtool_pipe = '') { $orig_local_data_id = $local_data_id; /* aquire lock in order to prevent race conditions */ - while (!db_fetch_cell("SELECT GET_LOCK('boost.single_ds.$local_data_id', 1)")) { + while (!db_fetch_cell("SELECT GET_LOCK('boost.single_ds.$orig_local_data_id', 1)")) { usleep(50000); } } else { @@ -618,19 +620,22 @@ function boost_process_poller_output($local_data_id = '', $rrdtool_pipe = '') { /* get the records */ if ($single_local_data_id) { $query_string = ''; - $arch_tables = db_fetch_assoc("SELECT table_name AS name + $arch_tables = db_fetch_assoc("SELECT table_name AS name FROM information_schema.tables - WHERE table_schema='$database_default' + WHERE table_schema = '$database_default' AND table_name LIKE 'poller_output_boost_arch_%'"); if (count($arch_tables)) { foreach($arch_tables as $table) { - $rows = db_fetch_cell('SELECT COUNT(*) FROM '.$table['name']); + $rows = db_fetch_cell('SELECT COUNT(*) FROM ' . $table['name']); if (db_table_exists($table['name']) && is_numeric($rows) && intval($rows) > 0) { if ($query_string != '') { $query_string .= ' UNION '; } - $query_string .= ' (SELECT local_data_id, UNIX_TIMESTAMP(time) AS timestamp, rrd_name, output FROM ' . $table['name'] . " WHERE local_data_id='$local_data_id') "; + + $query_string .= ' (SELECT local_data_id, UNIX_TIMESTAMP(time) AS timestamp, rrd_name, output + FROM ' . $table['name'] . " + WHERE local_data_id = $local_data_id) "; } } } @@ -643,14 +648,32 @@ function boost_process_poller_output($local_data_id = '', $rrdtool_pipe = '') { $query_string .= " (SELECT local_data_id, UNIX_TIMESTAMP(time) AS timestamp, rrd_name, output FROM poller_output_boost - WHERE local_data_id=$orig_local_data_id - AND time < FROM_UNIXTIME('$timestamp'))"; + WHERE local_data_id = $orig_local_data_id + AND time < FROM_UNIXTIME($timestamp))"; - $query_string .= ' ORDER BY local_data_id ASC, timestamp ASC, rrd_name ASC '; + $query_string .= ' ORDER BY timestamp ASC, rrd_name ASC '; } else { - $query_string = "SELECT local_data_id, UNIX_TIMESTAMP(time) AS timestamp, rrd_name, output - FROM $archive_table FORCE INDEX (PRIMARY) - ORDER BY local_data_id ASC, time ASC, rrd_name ASC + $query_string = ''; + $arch_tables = db_fetch_assoc("SELECT table_name AS name + FROM information_schema.tables + WHERE table_schema = '$database_default' + AND table_name LIKE 'poller_output_boost_arch_%'"); + + if (count($arch_tables)) { + foreach($arch_tables as $table) { + $rows = db_fetch_cell('SELECT COUNT(*) FROM ' . $table['name']); + if (db_table_exists($table['name']) && is_numeric($rows) && intval($rows) > 0) { + if ($query_string != '') { + $query_string .= ' UNION '; + } + + $query_string .= ' (SELECT local_data_id, UNIX_TIMESTAMP(time) AS timestamp, rrd_name, output + FROM ' . $table['name'] . ') '; + } + } + } + + $query_string .= "ORDER BY local_data_id ASC, time ASC, rrd_name ASC LIMIT $data_ids_to_get "; } @@ -660,7 +683,8 @@ function boost_process_poller_output($local_data_id = '', $rrdtool_pipe = '') { /* log memory */ if ($get_memory) { - $cur_memory = memory_get_usage(); + $cur_memory = memory_get_usage(); + if ($cur_memory > $memory_used) { $memory_used = $cur_memory; } @@ -676,19 +700,24 @@ function boost_process_poller_output($local_data_id = '', $rrdtool_pipe = '') { cacti_log("NOTE: Updating Local Data ID:'$local_data_id', Total of '" . sizeof($results) . "' Updates to Process", false, 'BOOST', $log_verbosity); } - if (sizeof($results) > 0) { + if (sizeof($results)) { $rrdp_auto_close = false; + if (!$rrdtool_pipe) { - $rrdtool_pipe = rrd_init(); + $rrdtool_pipe = rrd_init(); $rrdp_auto_close = true; } /* create an array keyed off of each .rrd file */ - $local_data_id = -1; - $time = -1; - $outbuf = ''; - $last_update = -1; - $last_item = array('local_data_id' => -1, 'timestamp' => -1, 'rrd_name' => ''); + $local_data_id = -1; + $time = -1; + $outbuf = ''; + $last_update = -1; + $last_item = array( + 'local_data_id' => -1, + 'timestamp' => -1, + 'rrd_name' => '' + ); /* we are going to blow away all record if ok */ $vals_in_buffer = 0; @@ -696,12 +725,17 @@ function boost_process_poller_output($local_data_id = '', $rrdtool_pipe = '') { /* cut last DS (likely to be incomplete due to LIMIT)*/ if (!$single_local_data_id) { reset($results); + $first_ds = $results[key($results)]; $first_ds = intval($first_ds['local_data_id']); + end($results); + $last_ds = $results[key($results)]; $last_ds = intval($last_ds['local_data_id']); + reset($results); + if ($first_ds == $last_ds) { if (sizeof($results) == $data_ids_to_get) { cacti_log("FALURE: Current LIMIT ($data_ids_to_get) is too low to run multiple DS RRD writes, consider raising it", false, 'BOOST'); @@ -722,6 +756,7 @@ function boost_process_poller_output($local_data_id = '', $rrdtool_pipe = '') { $outlen = 0; boost_timer('results_cycle', BOOST_TIMER_START); + /* go through each poller_output_boost entries and process */ foreach ($results as $item) { $item['timestamp'] = trim($item['timestamp']); @@ -734,7 +769,9 @@ function boost_process_poller_output($local_data_id = '', $rrdtool_pipe = '') { continue; } - if (!$single_local_data_id && $first_ds != $last_ds && $last_ds == $item['local_data_id']) { + if (!$single_local_data_id && + $first_ds != $last_ds && + $last_ds == $item['local_data_id']) { /* we faced last and possibly incomplete DS, bail out */ break; } @@ -802,6 +839,7 @@ function boost_process_poller_output($local_data_id = '', $rrdtool_pipe = '') { cacti_log("WARNING: RRD Update Warning '" . $return_value . "' for Local Data ID '$local_data_id'", false, 'BOOST'); } } + $output = ' ' . $item['timestamp']; $outbuf .= $output; $outlen += strlen($output); @@ -838,6 +876,7 @@ function boost_process_poller_output($local_data_id = '', $rrdtool_pipe = '') { $first_tmpl = true; $multi_ok = false; + for ($i=0; $i 0) { + if (sizeof($data_sources)) { foreach ($data_sources as $data_source) { /* use the cacti ds name by default or the user defined one, if entered */ $data_source_name = get_data_source_item_name($data_source['id']); diff --git a/lib/functions.php b/lib/functions.php index 7b95e7afb7..7daf112fb6 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -4527,9 +4527,10 @@ function get_url_type() { * * @returns - an array of stream context options or false */ function get_default_contextoption($protocol = false, $options = false) { - $fgc_contextoption = false; + $timeout = read_config_option('script_timeout'); + if (!$protocol) { $protocol = get_url_type(); } @@ -4544,11 +4545,22 @@ function get_default_contextoption($protocol = false, $options = false) { ); } + if ($protocol == 'https') { + $fgc_contextoption['https'] = array( + 'timeout' => $timeout + ); + } elseif ($protocol == 'http') { + $fgc_contextoption['http'] = array( + 'timeout' => $timeout + ); + } + if (is_array($options)) { $fgc_contextoption = array_replace_recursive($fgc_contextoption, $options); } $fgc_contextoption = api_plugin_hook_function('fgc_contextoption', $fgc_contextoption); + return $fgc_contextoption; } diff --git a/lib/html.php b/lib/html.php index 0569a54e55..c1a134eb7b 100644 --- a/lib/html.php +++ b/lib/html.php @@ -827,7 +827,7 @@ function html_escape($string) { $charset = 'UTF-8'; } - return htmlspecialchars($string, ENT_QUOTES, $charset, true); + return htmlspecialchars($string, ENT_QUOTES, $charset, false); } /* html_split_string - takes a string and breaks it into a number of
separated segments diff --git a/lib/html_graph.php b/lib/html_graph.php index 2fd6c2f1e6..ed552437e4 100644 --- a/lib/html_graph.php +++ b/lib/html_graph.php @@ -309,6 +309,8 @@ function html_graph_preview_filter($page, $action, $devices_where = '', $templat + +