2010-05-12 Ramon Novoa <rnovoa@artica.es>

* lib/PandoraFMS/ReconServer.pm: Make sure the agent exists
          when searching by IP address. Fixes bug #2957130.

        * util/pandora_db.pl: Fixed bug #2957130.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2711 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Ramon Novoa 2010-05-12 15:33:19 +00:00
parent 600900a3ae
commit 9a2d5edbbb
3 changed files with 19 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2010-05-12 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/ReconServer.pm: Make sure the agent exists
when searching by IP address. Fixes bug #2957130.
* util/pandora_db.pl: Fixed bug #2957130.
2010-05-12 Sergio Martin <sergio.martin@artica.es>
* man/man1/tentacle.1.gz: Deleted old man page

View File

@ -305,7 +305,10 @@ sub get_agent_from_addr ($$) {
return 0 if (! defined ($ip_address) || $ip_address eq '');
my $agent_id = get_db_value ($dbh, 'SELECT id_agent FROM taddress, taddress_agent WHERE taddress_agent.id_a = taddress.id_a AND ip = ?', $ip_address);
my $agent_id = get_db_value ($dbh, 'SELECT id_agent FROM taddress, taddress_agent, tagente
WHERE tagente.id_agente = taddress_agent.id_agent
AND taddress_agent.id_a = taddress.id_a
AND ip = ?', $ip_address);
return (defined ($agent_id)) ? $agent_id : -1;
}

View File

@ -393,14 +393,19 @@ sub pandora_checkdb_integrity {
print "[INTEGRITY] Deleting orphan modules \n";
# Delete orphan modules in tagente_modulo
db_do ($dbh, 'DELETE FROM tagente_modulo WHERE id_agente NOT IN (select id_agente FROM tagente)');
db_do ($dbh, 'DELETE FROM tagente_modulo WHERE id_agente NOT IN (SELECT id_agente FROM tagente)');
# Delete orphan modules in tagente_estado
db_do ($dbh, 'DELETE FROM tagente_estado WHERE id_agente NOT IN (select id_agente FROM tagente)');
db_do ($dbh, 'DELETE FROM tagente_estado WHERE id_agente NOT IN (SELECT id_agente FROM tagente)');
# Delete orphan data_inc reference records
db_do ($dbh, 'DELETE FROM tagente_datos_inc WHERE id_agente_modulo NOT IN (SELECT id_agente_modulo FROM tagente_modulo)');
# Delete all non-used IP addresses from taddress
db_do ($dbh, 'DELETE FROM taddress WHERE id_a NOT IN (SELECT id_a FROM taddress_agent)');
# Check enterprise tables
enterprise_hook ('pandora_checkdb_integrity_enterprise', [$dbh]);
}
###############################################################################