Code

Don't bail out if getting a hostname, convert it to an ip instead.
authorjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 30 Oct 2009 12:45:25 +0000 (12:45 +0000)
committerjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 30 Oct 2009 12:45:25 +0000 (12:45 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14716 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/modules/GosaSupportDaemon.pm

index d6420a1424ac75ff010c9b204ab848f209786087..3cc769ba846e6dbe2ff53a7390588c5be7051516 100644 (file)
@@ -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") {