2013-07-18 Sergio Martin <sergio.martin@artica.es>

* include/functions_agents.php: Add check to avoid SQL
	errors when retrieve alerts and the user profiles
	are not properly configurated for bug #2349



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8545 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2013-07-18 13:12:42 +00:00
parent bf97f65fea
commit ac60cce2a2
2 changed files with 13 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2013-07-18 Sergio Martin <sergio.martin@artica.es>
* include/functions_agents.php: Add check to avoid SQL
errors when retrieve alerts and the user profiles
are not properly configurated for bug #2349
2013-07-18 Sergio Martin <sergio.martin@artica.es>
* operation/reporting/reporting_viewer.php

View File

@ -156,7 +156,6 @@ function agents_get_alerts_simple ($id_agent = false, $filter = '', $options = f
if (($id_agent !== false) && ($idGroup !== false)) {
$where_tags = tags_get_acl_tags($config['id_user'], $idGroup, 'AR', 'module_condition', 'AND', 'tagente_modulo');
if ($idGroup != 0) { //All group
$subQuery = 'SELECT id_agente_modulo
FROM tagente_modulo
@ -167,7 +166,13 @@ function agents_get_alerts_simple ($id_agent = false, $filter = '', $options = f
FROM tagente_modulo WHERE delete_pending = 0';
}
$subQuery .= $where_tags;
// If there are any errors add imposible condition
if(in_array($where_tags, array(ERR_WRONG_PARAMETERS, ERR_ACL)) || TRUE) {
$subQuery .= ' AND 1 = 0';
}
else {
$subQuery .= $where_tags;
}
}
else if ($id_agent === false) {
if ($allModules)
@ -214,7 +219,6 @@ function agents_get_alerts_simple ($id_agent = false, $filter = '', $options = f
ON talert_template_modules.id_alert_template = t4.id
WHERE id_agent_module in (%s) %s %s %s",
$selectText, $subQuery, $where, $filter, $orderbyText);
$alerts = db_get_all_rows_sql ($sql);
if ($alerts === false)