2010-02-10 Pablo de la Concepción <pablo.concepcion@artica.es>

* lib/PandoraFMS/DataServer.pm: Validation of positiona parameters, check
    if the parameters are defined and if they have valid values.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2350 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
Pablo de la Concepción Sanz 2010-02-10 20:17:08 +00:00
parent 3a9e008228
commit cae911bd51
2 changed files with 14 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2010-02-10 Pablo de la Concepción <pablo.concepcion@artica.es>
* lib/PandoraFMS/DataServer.pm: Validation of positiona parameters, check
if the parameters are defined and if they have valid values.
2010-02-10 Sancho Lerena <slerena@artica.es>
* bin/pandora_server: Better error management, avoiding to show Enterprise

View File

@ -158,7 +158,7 @@ sub process_xml_data ($$$$$) {
$data->{'interval'}, $data->{'os_version'}, $data->{'timezone_offset'});
# Timezone offset must be an integer beween -12 and +12
if ($timezone_offset !~ /[-+]?[0-9,11,12]/) {
if (!defined($timezone_offset) || $timezone_offset !~ /[-+]?[0-9,11,12]/) {
$timezone_offset = 0; # Default value
}
@ -167,15 +167,20 @@ sub process_xml_data ($$$$$) {
# Get GIS information
my ($longitude, $latitude, $altitude) = (
$data->{'longitude'}, $data->{'latitude'}, $data->{'altitude'});
# TODO: validate that the positional parameters and timezone are defined.
if ($pa_config->{'activate_gis'}) {
# Validate the GIS informtation
if (!defined($altitude) || $altitude !~ /[-+]?[0-9,11,12]/) {
$altitude = 0; # Default value
}
# If position data are not valid should be ignored
if ($longitude !~ /[-+]?[0-9]*\.?[0-9]+/ || $latitude !~ /[-+]?[0-9]*\.?[0-9]+/ || $altitude !~ /[-+]?[0-9]*\.?[0-9]+/) {
# If position data (at least longitude and latitde) are not valid should be ignored
if ($longitude !~ /[-+]?[0-9]*\.?[0-9]+/ || $latitude !~ /[-+]?[0-9]*\.?[0-9]+/ || !defined($longitude) || !defined($latitude)) {
$valid_position_data = 0;
$longitude = '';
$latitude = '';
$altitude='';
}
logger($pa_config, "Getting GIS Data=timezone_offset=$timezone_offset longitude=$longitude latitude=$latitude altitude=$altitude", 10);