From 3d656eb704d392a73f1a5a89cf2d9a0732a70820 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Fri, 10 May 2013 11:19:02 +0000 Subject: [PATCH] 2013-05-10 Ramon Novoa * lib/PandoraFMS/Tools.pm: Check that inet_aton does not return undef. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8118 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 4 ++++ pandora_server/lib/PandoraFMS/Tools.pm | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 4563866630..ee9eba1e3b 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,7 @@ +2013-05-10 Ramon Novoa + + * lib/PandoraFMS/Tools.pm: Check that inet_aton does not return undef. + 2013-05-07 Ramon Novoa * lib/PandoraFMS/Tools.pm: Added a function to resolve hostnames. diff --git a/pandora_server/lib/PandoraFMS/Tools.pm b/pandora_server/lib/PandoraFMS/Tools.pm index ca5ac38a64..cd9c24895b 100644 --- a/pandora_server/lib/PandoraFMS/Tools.pm +++ b/pandora_server/lib/PandoraFMS/Tools.pm @@ -1171,7 +1171,10 @@ sub cron_get_closest_in_range ($$) { sub resolve_hostname ($) { my ($hostname) = @_; - return inet_ntoa(inet_aton($hostname)); + $resolved_hostname = inet_aton($hostname); + return $hostname if (! defined ($resolved_hostname)); + + return inet_ntoa($resolved_hostname); } # End of function declaration