From: janw Date: Fri, 30 Oct 2009 12:45:25 +0000 (+0000) Subject: Don't bail out if getting a hostname, convert it to an ip instead. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=7ae7997eb3e2f3dd13ca89e56dde013d8060e922;p=gosa.git Don't bail out if getting a hostname, convert it to an ip instead. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14716 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/modules/GosaSupportDaemon.pm b/gosa-si/modules/GosaSupportDaemon.pm index d6420a142..3cc769ba8 100644 --- a/gosa-si/modules/GosaSupportDaemon.pm +++ b/gosa-si/modules/GosaSupportDaemon.pm @@ -684,6 +684,15 @@ sub get_ip { sub get_interface_for_ip { my $result; my $ip= shift; + + if($ip =~ /^[a-z]/i) { + my $ip_address = inet_ntoa(scalar gethostbyname($ip)); + if(defined($ip_address) && $ip_address =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/) { + # Write ip address to $source variable + $ip = $ip_address; + } + } + if ($ip && length($ip) > 0) { my @ifs= &get_interfaces(); if($ip eq "0.0.0.0") {