Skip to content

Commit

Permalink
QA: Porting 1.2.24 Changes back to the Develop Branch (#5246)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheWitness committed Feb 24, 2023
1 parent 8753cef commit ca7a352
Show file tree
Hide file tree
Showing 47 changed files with 1,696 additions and 1,347 deletions.
28 changes: 28 additions & 0 deletions CHANGELOG
Expand Up @@ -83,6 +83,34 @@ Cacti CHANGELOG
-issue#5184: Cacti permission checks generate SQL errors is the user has been deleted
-issue#5185: Repair Database does not prune old Poller Item Records
-issue#5187: Getting SQL errors in the Cacti due to plugin calling register function in wrong location
-issue#5188: Device Template Filter broken
-issue#5190: When using Gradient Support GPRINT Text Format is misaligned
-issue#5194: CSRF directory needs to be writeable for creating the csrf-secret.php file
-issue#5195: Spikekill Backtrace Argument #1 ($string) must be passed by reference, value given
-issue#5196: Gradient support breaks certain Graphs with special characters in them
-issue#5197: Realtime graph on remote poller not working in 1.2.23
-issue#5198: PHP Diff Renderer throws warnings
-issue#5199: When trying to obtain data, cacti should not log Transport Read errors
-issue#5200: Cacti function throws errors when attempting to render classic images in PHP8
-issue#5201: Minor issues in modern and dark prevent weathermaps from rendering correctly
-issue#5202: When importing packages, Graph Size does not get updated to Graph Templates
-issue#5203: Scripts ss_net_snmp_device_io.php and ss_net_snmp_device_bytes.php break when using HMIB plugin and PHP8.1
-issue#5204: Compatibility improvements for Audit Database under PHP 8.x
-issue#5205: When using Diff Viewer, rendering is not always correct under certain themes
-issue#5207: Compatibility improvements for Installer under PHP 8.x
-issue#5208: Package form objects use the wrong text domain in their i18n strings
-issue#5211: Undefined variable $user_id when creating new graph
-issue#5214: Basic Auth is timing out and logging users off automatically
-issue#5223: When using callback form functions, name and id field may not be correctly set
-issue#5224: When poller runtime is exceeded, time should be display as a rounded number
-issue#5227: When debugging a data source, errors may be shown if no RRDfile created yet
-issue#5232: On large systems statistics gathering at the beginning of a poller run lead to excessive polling times
-issue#5236: Edit Graph Template link missing base_url
-issue#5238: Searching for Poller Items Generates SQL Errors
-issue#5239: SNMP-Options - Bulk Walk Maximum Repetitions ignored
-issue#5241: "Balance Process Load" dont work after upgrade to 1.2.23
-issue#5243: Template Export missing Graph Template columns multiple and test_source
-issue#5247: Rebuilding Poller Cache from Utilities does not respect poller interval due to lack or ordering

1.2.23
-security#4920: Add .htaccess file to scripts folder
Expand Down
36 changes: 19 additions & 17 deletions automation_snmp.php
Expand Up @@ -132,23 +132,25 @@ function form_automation_snmp_save() {
get_filter_request_var('id');
/* ==================================================== */

$save = array();
$save['id'] = form_input_validate(get_nfilter_request_var('item_id'), '', '^[0-9]+$', false, 3);
$save['snmp_id'] = form_input_validate(get_nfilter_request_var('id'), 'snmp_id', '^[0-9]+$', false, 3);
$save['sequence'] = form_input_validate(get_nfilter_request_var('sequence'), 'sequence', '^[0-9]+$', false, 3);
$save['snmp_community'] = form_input_validate(get_nfilter_request_var('snmp_community'), 'snmp_community', '', false, 3);
$save['snmp_version'] = form_input_validate(get_nfilter_request_var('snmp_version'), 'snmp_version', '', false, 3);
$save['snmp_username'] = form_input_validate(get_nfilter_request_var('snmp_username'), 'snmp_username', '', true, 3);
$save['snmp_password'] = form_input_validate(get_nfilter_request_var('snmp_password'), 'snmp_password', '', true, 3);
$save['snmp_auth_protocol'] = form_input_validate(get_nfilter_request_var('snmp_auth_protocol'), 'snmp_auth_protocol', '', true, 3);
$save['snmp_priv_passphrase'] = form_input_validate(get_nfilter_request_var('snmp_priv_passphrase'), 'snmp_priv_passphrase', '', true, 3);
$save['snmp_priv_protocol'] = form_input_validate(get_nfilter_request_var('snmp_priv_protocol'), 'snmp_priv_protocol', '', true, 3);
$save['snmp_context'] = form_input_validate(get_nfilter_request_var('snmp_context'), 'snmp_context', '', true, 3);
$save['snmp_engine_id'] = form_input_validate(get_nfilter_request_var('snmp_engine_id'), 'snmp_engine_id', '', true, 3);
$save['snmp_port'] = form_input_validate(get_nfilter_request_var('snmp_port'), 'snmp_port', '^[0-9]+$', false, 3);
$save['snmp_timeout'] = form_input_validate(get_nfilter_request_var('snmp_timeout'), 'snmp_timeout', '^[0-9]+$', false, 3);
$save['snmp_retries'] = form_input_validate(get_nfilter_request_var('snmp_retries'), 'snmp_retries', '^[0-9]+$', false, 3);
$save['max_oids'] = form_input_validate(get_nfilter_request_var('max_oids'), 'max_oids', '^[0-9]+$', false, 3);
$save = array();

$save['id'] = form_input_validate(get_nfilter_request_var('item_id'), '', '^[0-9]+$', false, 3);
$save['snmp_id'] = form_input_validate(get_nfilter_request_var('id'), 'snmp_id', '^[0-9]+$', false, 3);
$save['sequence'] = form_input_validate(get_nfilter_request_var('sequence'), 'sequence', '^[0-9]+$', false, 3);
$save['snmp_community'] = form_input_validate(get_nfilter_request_var('snmp_community'), 'snmp_community', '', false, 3);
$save['snmp_version'] = form_input_validate(get_nfilter_request_var('snmp_version'), 'snmp_version', '', false, 3);
$save['snmp_username'] = form_input_validate(get_nfilter_request_var('snmp_username'), 'snmp_username', '', true, 3);
$save['snmp_password'] = form_input_validate(get_nfilter_request_var('snmp_password'), 'snmp_password', '', true, 3);
$save['snmp_auth_protocol'] = form_input_validate(get_nfilter_request_var('snmp_auth_protocol'), 'snmp_auth_protocol', '', true, 3);
$save['snmp_priv_passphrase'] = form_input_validate(get_nfilter_request_var('snmp_priv_passphrase'), 'snmp_priv_passphrase', '', true, 3);
$save['snmp_priv_protocol'] = form_input_validate(get_nfilter_request_var('snmp_priv_protocol'), 'snmp_priv_protocol', '', true, 3);
$save['snmp_context'] = form_input_validate(get_nfilter_request_var('snmp_context'), 'snmp_context', '', true, 3);
$save['snmp_engine_id'] = form_input_validate(get_nfilter_request_var('snmp_engine_id'), 'snmp_engine_id', '', true, 3);
$save['snmp_port'] = form_input_validate(get_nfilter_request_var('snmp_port'), 'snmp_port', '^[0-9]+$', false, 3);
$save['snmp_timeout'] = form_input_validate(get_nfilter_request_var('snmp_timeout'), 'snmp_timeout', '^[0-9]+$', false, 3);
$save['snmp_retries'] = form_input_validate(get_nfilter_request_var('snmp_retries'), 'snmp_retries', '^[0-9]+$', false, 3);
$save['max_oids'] = form_input_validate(get_nfilter_request_var('max_oids'), 'max_oids', '^[0-9]+$', false, 3);
$save['bulk_walk_size'] = form_input_validate(get_nfilter_request_var('bulk_walk_size'), 'bulk_walk_size', '^[\-0-9]+$', false, 3);

if (!is_error_message()) {
$item_id = sql_save($save, 'automation_snmp_items');
Expand Down
19 changes: 12 additions & 7 deletions cli/audit_database.php
Expand Up @@ -427,9 +427,9 @@ function report_audit_results($output = true) {
$status = db_fetch_row('SHOW TABLE STATUS LIKE "' . $table_name . '"');

if ($status['Collation'] == 'utf8mb4_unicode_ci' || $status['Collation'] == 'utf8_general_ci') {
$text = 'mediumtext';
$collation = 'utf8';
} else {
$text = 'text';
$collation = 'latin';
}

if ($output) {
Expand Down Expand Up @@ -516,8 +516,8 @@ function report_audit_results($output = true) {
} else {
foreach ($cols as $dbcol => $col) {
if ($col == 'Type' && $dbc[$dbcol] == 'text') {
if ($text == 'mediumtext') {
$dbc[$dbcol] = $text;
if ($collation == 'latin') {
$dbc[$dbcol] = 'mediumtext';
}
}

Expand Down Expand Up @@ -741,9 +741,14 @@ function report_audit_results($output = true) {
function make_column_props(&$dbc) {
$alter_cmd = '';

$dbc['table_default'] = str_replace('current_timestamp()', 'CURRENT_TIMESTAMP', $dbc['table_default']);
$dbc['table_extra'] = str_replace('current_timestamp()', 'CURRENT_TIMESTAMP', $dbc['table_extra']);
$dbc['table_extra'] = trim(str_replace('DEFAULT_GENERATED', '', $dbc['table_extra']));
if (isset($dbc['table_default'])) {
$dbc['table_default'] = str_replace('current_timestamp()', 'CURRENT_TIMESTAMP', $dbc['table_default']);
}

if (isset($dbc['table_extra'])) {
$dbc['table_extra'] = str_replace('current_timestamp()', 'CURRENT_TIMESTAMP', $dbc['table_extra']);
$dbc['table_extra'] = trim(str_replace('DEFAULT_GENERATED', '', $dbc['table_extra']));
}

if ($dbc['table_null'] == 'YES') {
if ($dbc['table_default'] == 'NULL') {
Expand Down
22 changes: 13 additions & 9 deletions cmd.php
Expand Up @@ -198,6 +198,7 @@
$start = microtime(true);
$poller_interval = read_config_option('poller_interval');
$script_timeout = read_config_option('script_timeout');
$cron_interval = read_config_option('cron_interval');
$active_profiles = read_config_option('active_profiles');

// check arguments
Expand All @@ -208,7 +209,7 @@

$params1 = array($poller_id);
$params2 = array($poller_id, POLLER_ACTION_SCRIPT_PHP, POLLER_ACTION_SCRIPT_PHP_COUNT);
$params3 = array($poller_interval, $poller_interval, $poller_interval, $poller_id);
$params3 = array($poller_interval, $poller_interval, 0, $poller_interval, $poller_id);
} else {
$sql_where0 = 'WHERE poller_id > ?';
$sql_where1 = ' AND ((h.id >= ? AND h.id <= ?) OR h.id IS NULL)';
Expand All @@ -217,7 +218,12 @@

$params1 = array($poller_id, $first, $last);
$params2 = array($poller_id, POLLER_ACTION_SCRIPT_PHP, POLLER_ACTION_SCRIPT_PHP_COUNT, $first, $last);
$params3 = array($poller_interval, $poller_interval, $poller_interval, $poller_id, $first, $last);

if ($cron_interval == $poller_interval) {
$params3 = array($poller_interval, $poller_interval, 0, $poller_interval, $poller_id, $first, $last);
} else {
$params3 = array($poller_interval, $poller_interval, $poller_interval, $poller_interval, $poller_id, $first, $last);
}
}

if ($debug) {
Expand Down Expand Up @@ -276,13 +282,11 @@
);

// setup next polling interval
db_execute_prepared(
"UPDATE poller_item AS pi
SET rrd_next_step = IF(rrd_step = ?, 0, IF(rrd_next_step - ? < 0, rrd_step, rrd_next_step - ?))
WHERE poller_id = ?
$sql_where3",
$params3
);
db_execute_prepared("UPDATE poller_item AS pi
SET rrd_next_step = IF(rrd_step = ?, 0, IF(rrd_next_step - ? < 0, rrd_step - ?, rrd_next_step - ?))
WHERE poller_id = ?
$sql_where3",
$params3);
} else {
$poller_items = db_fetch_assoc_prepared('SELECT ' . SQL_NO_CACHE . " *
FROM poller_item AS pi
Expand Down
12 changes: 5 additions & 7 deletions host_templates.php
Expand Up @@ -837,20 +837,18 @@ function clearFilter() {
html_end_box();

/* form the 'where' clause for our main sql query */
$sql_where = '';

if (get_request_var('filter') != '') {
$sql_where = 'WHERE (host_template.name LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . ')';
} else {
$sql_where = '';
$sql_where .= 'WHERE (host_template.name LIKE ' . db_qstr('%' . get_request_var('filter') . '%') . ')';
}

if (get_request_var('class') != '-1') {
$sql_where = 'WHERE (host_template.class = ' . db_qstr(get_request_var('class')) . ')';
} else {
$sql_where = '';
$sql_where .= 'WHERE (host_template.class = ' . db_qstr(get_request_var('class')) . ')';
}

if (get_request_var('has_hosts') == 'true') {
$sql_having = 'HAVING hosts>0';
$sql_having = 'HAVING hosts > 0';
} else {
$sql_having = '';
}
Expand Down
14 changes: 7 additions & 7 deletions include/global_form.php
Expand Up @@ -1694,7 +1694,7 @@
'method' => 'file'
),
'data_header' => array(
'friendly_name' => __('Data Source Overrides', 'package'),
'friendly_name' => __('Data Source Overrides'),
'collapsible' => 'true',
'method' => 'spacer',
),
Expand All @@ -1708,7 +1708,7 @@
'default' => '1'
),
'graph_header' => array(
'friendly_name' => __('Graph/Data Template Overrides', 'package'),
'friendly_name' => __('Graph/Data Template Overrides'),
'collapsible' => 'true',
'method' => 'spacer',
),
Expand All @@ -1727,23 +1727,23 @@
'default' => ''
),
'image_format' => array(
'friendly_name' => __('Graph Template Image Format', 'package'),
'description' => __('The Image Format to be used when importing or updating Graph Templates.', 'package'),
'friendly_name' => __('Graph Template Image Format'),
'description' => __('The Image Format to be used when importing or updating Graph Templates.'),
'method' => 'drop_array',
'default' => read_config_option('default_image_format'),
'array' => $image_types,
),
'graph_height' => array(
'friendly_name' => __('Graph Template Height', 'pagkage'),
'description' => __('The Height to be used when importing or updating Graph Templates.', 'package'),
'description' => __('The Height to be used when importing or updating Graph Templates.'),
'method' => 'textbox',
'default' => read_config_option('default_graph_height'),
'size' => '5',
'max_length' => '5'
),
'graph_width' => array(
'friendly_name' => __('Graph Template Width', 'package'),
'description' => __('The Width to be used when importing or updating Graph Templates.', 'package'),
'friendly_name' => __('Graph Template Width'),
'description' => __('The Width to be used when importing or updating Graph Templates.'),
'method' => 'textbox',
'default' => read_config_option('default_graph_width'),
'size' => '5',
Expand Down
7 changes: 7 additions & 0 deletions include/global_session.php
Expand Up @@ -127,6 +127,13 @@
$refreshIsLogout = 'false';
}

/* basic auth times out when the auth provider times out */
if (read_config_option('auth_method') == 2) {
$myrefresh['seconds'] = 99999999;
$myrefresh['page'] = sanitize_uri($_SERVER['REQUEST_URI']);
$refreshIsLogout = 'false';
}

?>
<script type='text/javascript'>
var cactiVersion='<?php print $config['cacti_version'];?>';
Expand Down
23 changes: 15 additions & 8 deletions include/global_settings.php
Expand Up @@ -1192,40 +1192,40 @@
'method' => 'font',
'placeholder' => __('Enter Valid Font Config Value'),
'max_length' => '100'
),
),
'business_hours_header' => array(
'friendly_name' => __('Business Hours Settings'),
'collapsible' => 'true',
'method' => 'spacer',
),
),
'business_hours_start' => array(
'friendly_name' => __('Start of Business Day'),
'description' => __('The time your business hours start. Format: hh:mm'),
'method' => 'textbox',
'default' => '08:00',
'max_length' => '5',
'size' => '60'
),
),
'business_hours_end' => array(
'friendly_name' => __('End of Business Day'),
'description' => __('The time your business hours end. Format: hh:mm'),
'method' => 'textbox',
'default' => '18:00',
'max_length' => '6',
'size' => '60'
),
),
'business_hours_hideWeekends' => array(
'friendly_name' => __('Hide Weekends'),
'description' => __('Only show business hours during weekdays.'),
'method' => 'checkbox',
'default' => '',
),
),
'business_hours_enable' => array(
'friendly_name' => __('Show business hours'),
'description' => __('Display business hours on rrd graphs.'),
'method' => 'checkbox',
'default' => '',
),
),
'business_hours_color' => array(
'friendly_name' => __('Color to use for business hours'),
'description' => __('The color to be shown for business hours'),
Expand Down Expand Up @@ -1338,7 +1338,8 @@
'90' => '90',
'100' => '100',
'150' => '150',
'200' => '200')
'200' => '200'
)
),
'max_get_size' => array(
'friendly_name' => __('SNMP Get OID Limit'),
Expand All @@ -1348,6 +1349,12 @@
'max_length' => '10',
'size' => '5'
),
'poller_refresh_output_table' => array(
'friendly_name' => __('Refresh Poller Table Per Cycle'),
'description' => __('This setting is for a single poller systems only to rebuild the poller output table on each polling cycle to prevent the memory table from swapping on very large systems with large databases that could use swap.'),
'method' => 'checkbox',
'default' => '',
),
'disable_cache_replication' => array(
'friendly_name' => __('Disable Resource Cache Replication'),
'description' => __('By default, the main Cacti Data Collector will cache the entire web site and plugins into a Resource Cache. Then, periodically the Remote Data Collectors will update themselves with any updates from the main Cacti Data Collector. This Resource Cache essentially allows Remote Data Collectors to self upgrade. If you do not wish to use this option, you can disable it using this setting.'),
Expand Down Expand Up @@ -2957,7 +2964,7 @@
}

if (!$config['is_web'] || is_realm_allowed(8)) {
if (!(read_config_option('auth_cache_enabled') == 'on' && isset($_SESSION['cacti_remembers']) && $_SESSION['cacti_remembers'] == true)) {
if (read_config_option('auth_method') != 2 && !(read_config_option('auth_cache_enabled') == 'on' && isset($_SESSION['cacti_remembers']) && $_SESSION['cacti_remembers'] == true)) {
if (ini_get('session.gc_maxlifetime') > '2147483') {
$max_life = '2147483';
} else {
Expand Down
2 changes: 0 additions & 2 deletions include/layout.js
Expand Up @@ -4453,8 +4453,6 @@ function makeCallbacks() {
}, 200);
}
$(dcInput).select();
}).on('keyup', function() {
$(dcId).val($(dcInput).val());
}).on('mouseleave', function() {
var cn = $(dcId).attr('data-callback-id');

Expand Down

0 comments on commit ca7a352

Please sign in to comment.