Fixed entities in query

This commit is contained in:
manuel.montes 2020-08-28 13:56:15 +02:00
parent 881a8e6a01
commit f477919433
7 changed files with 31 additions and 28 deletions

View File

@ -1115,7 +1115,7 @@ if ($update_agent) {
ui_print_success_message(__('Successfully updated'));
db_pandora_audit(
'Agent management',
'Updated agent '.$alias,
'Updated agent '.io_safe_output($alias),
false,
false,
$info
@ -1650,7 +1650,7 @@ if ($update_module) {
db_pandora_audit(
'Agent management',
"Fail to try update module '".$name."' for agent ".$agent['alias']
"Fail to try update module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias'])
);
} else {
if ($prediction_module == 3) {
@ -1674,7 +1674,7 @@ if ($update_module) {
db_pandora_audit(
'Agent management',
"Updated module '".$name."' for agent ".$agent['alias'],
"Updated module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias']),
false,
false,
io_json_mb_encode($values)
@ -1834,7 +1834,7 @@ if ($create_module) {
$moduletype = $id_module;
db_pandora_audit(
'Agent management',
"Fail to try added module '".$name."' for agent ".$agent['alias']
"Fail to try added module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias'])
);
} else {
if ($prediction_module == 3) {
@ -1859,7 +1859,7 @@ if ($create_module) {
$agent = db_get_row('tagente', 'id_agente', $id_agente);
db_pandora_audit(
'Agent management',
"Added module '".$name."' for agent ".$agent['alias'],
"Added module '".io_safe_output($name)."' for agent ".io_safe_output($agent['alias']),
false,
true,
io_json_mb_encode($values)
@ -1894,12 +1894,12 @@ if ($enable_module) {
if ($result === NOERR) {
db_pandora_audit(
'Module management',
'Enable #'.$enable_module.' | '.$module_name.' | '.$agent['alias']
'Enable #'.$enable_module.' | '.$module_name.' | '.io_safe_output($agent['alias'])
);
} else {
db_pandora_audit(
'Module management',
'Fail to enable #'.$enable_module.' | '.$module_name.' | '.$agent['alias']
'Fail to enable #'.$enable_module.' | '.$module_name.' | '.io_safe_output($agent['alias'])
);
}
}
@ -1929,12 +1929,12 @@ if ($disable_module) {
if ($result === NOERR) {
db_pandora_audit(
'Module management',
'Disable #'.$disable_module.' | '.$module_name.' | '.$agent['alias']
'Disable #'.$disable_module.' | '.$module_name.' | '.io_safe_output($agent['alias'])
);
} else {
db_pandora_audit(
'Module management',
'Fail to disable #'.$disable_module.' | '.$module_name.' | '.$agent['alias']
'Fail to disable #'.$disable_module.' | '.$module_name.' | '.io_safe_output($agent['alias'])
);
}
}
@ -2108,7 +2108,7 @@ if ($delete_module) {
$agent = db_get_row('tagente', 'id_agente', $id_agente);
db_pandora_audit(
'Agent management',
"Deleted module '".$module_data['nombre']."' for agent ".$agent['alias']
"Deleted module '".io_safe_output($module_data['nombre'])."' for agent ".io_safe_output($agent['alias'])
);
}
}
@ -2163,7 +2163,7 @@ if (!empty($duplicate_module)) {
if ($enable_module) {
$result = modules_change_disabled($enable_module, 0);
$modulo_nombre = db_get_row_sql('SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = '.$enable_module.'');
$modulo_nombre = $modulo_nombre['nombre'];
$modulo_nombre = io_safe_output($modulo_nombre['nombre']);
if ($result === NOERR) {
enterprise_hook('config_agents_enable_module_conf', [$id_agente, $enable_module]);
@ -2182,7 +2182,7 @@ if ($enable_module) {
if ($disable_module) {
$result = modules_change_disabled($disable_module, 1);
$modulo_nombre = db_get_row_sql('SELECT nombre FROM tagente_modulo WHERE id_agente_modulo = '.$disable_module.'');
$modulo_nombre = $modulo_nombre['nombre'];
$modulo_nombre = io_safe_output($modulo_nombre['nombre']);
if ($result === NOERR) {
enterprise_hook('config_agents_disable_module_conf', [$id_agente, $disable_module]);

View File

@ -115,7 +115,7 @@ if ($agent_to_delete) {
if ($enable_agent) {
$result = db_process_sql_update('tagente', ['disabled' => 0], ['id_agente' => $enable_agent]);
$alias = agents_get_alias($enable_agent);
$alias = io_safe_output(agents_get_alias($enable_agent));
if ($result) {
// Update the agent from the metaconsole cache.
@ -137,7 +137,7 @@ if ($enable_agent) {
if ($disable_agent) {
$result = db_process_sql_update('tagente', ['disabled' => 1], ['id_agente' => $disable_agent]);
$alias = agents_get_alias($disable_agent);
$alias = io_safe_output(agents_get_alias($disable_agent));
if ($result) {
// Update the agent from the metaconsole cache.

View File

@ -208,18 +208,21 @@ if ($delete_alert) {
$agent_alias = agents_get_alias(
db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $id_agent_module)
);
$unsafe_alert_template_name = io_safe_output($alert_template_name);
$unsafe_module_name = io_safe_output($module_name);
$unsafe_agent_alias = io_safe_output($agent_alias);
$result = alerts_delete_alert_agent_module($id_alert_agent_module);
if ($result) {
db_pandora_audit(
'Alert management',
"Deleted alert '$alert_template_name' for module '$module_name' in agent '$agent_alias'"
"Deleted alert '$unsafe_alert_template_name' for module '$unsafe_module_name' in agent '$unsafe_agent_alias'"
);
} else {
db_pandora_audit(
'Alert management',
"Fail to deleted alert '$alert_template_name' for module '$module_name' in agent '$agent_alias'"
"Fail to deleted alert '$unsafe_alert_template_name' for module '$unsafe_module_name' in agent '$unsafe_agent_alias'"
);
}

View File

@ -179,7 +179,7 @@ if ($id_profile || $new_profile) {
$id_audit = db_pandora_audit(
'User management',
'Edit profile '.$name
'Edit profile '.io_safe_output($name)
);
enterprise_include_once('include/functions_audit.php');

View File

@ -124,7 +124,7 @@ if (is_ajax()) {
db_pandora_audit(
'User management',
'Deleted profile for user '.io_safe_input($id2),
'Deleted profile for user '.io_safe_output($id2),
false,
false,
'The profile with id '.$id_perfil.' in the group '.$perfilUser['id_grupo']
@ -145,7 +145,7 @@ if (is_ajax()) {
if ($result) {
db_pandora_audit(
'User management',
__('Deleted user %s', io_safe_input($id_user))
__('Deleted user %s', io_safe_output($id_user))
);
}
@ -167,7 +167,7 @@ if (is_ajax()) {
if ($result) {
db_pandora_audit(
'User management',
__('Deleted user %s from metaconsole', io_safe_input($id_user))
__('Deleted user %s from metaconsole', io_safe_output($id_user))
);
}
@ -422,7 +422,7 @@ if ($create_user) {
db_pandora_audit(
'User management',
'Created user '.io_safe_input($id),
'Created user '.io_safe_output($id),
false,
false,
$info
@ -465,7 +465,7 @@ if ($create_user) {
db_pandora_audit(
'User management',
'Added profile for user '.io_safe_input($id2),
'Added profile for user '.io_safe_output($id2),
false,
false,
'Profile: '.$profile2.' Group: '.$group2.' Tags: '.$tags
@ -656,7 +656,7 @@ if ($update_user) {
db_pandora_audit(
'User management',
'Updated user '.io_safe_input($id),
'Updated user '.io_safe_output($id),
false,
false,
$info
@ -724,7 +724,7 @@ if ($add_profile && empty($json_profile)) {
db_pandora_audit(
'User management',
'Added profile for user '.io_safe_input($id2),
'Added profile for user '.io_safe_output($id2),
false,
false,
'Profile: '.$profile2.' Group: '.$group2.' Tags: '.$tags

View File

@ -81,7 +81,7 @@ if ($delete_profile) {
} else {
db_pandora_audit(
'Profile management',
'Delete profile '.$profile['name']
'Delete profile '.io_safe_output($profile['name'])
);
ui_print_success_message(__('Successfully deleted'));
}
@ -196,7 +196,7 @@ if ($update_profile) {
db_pandora_audit(
'User management',
'Update profile '.$name,
'Update profile '.io_safe_output($name),
false,
false,
$info
@ -247,7 +247,7 @@ if ($create_profile) {
db_pandora_audit(
'User management',
'Created profile '.$name,
'Created profile '.io_safe_output($name),
false,
false,
$info

View File

@ -162,7 +162,7 @@ if (isset($_GET['user_del'])) {
if ($result) {
db_pandora_audit(
'User management',
__('Deleted user %s', io_safe_input($id_user))
__('Deleted user %s', io_safe_output($id_user))
);
}