Code

Try to translate hostname to ip.
authorjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 13 Mar 2009 08:58:23 +0000 (08:58 +0000)
committerjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 13 Mar 2009 08:58:23 +0000 (08:58 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@13541 594d385d-05f5-0310-b6e9-bd551577e9d8

trunk/gosa-si/gosa-si-client

index 8142b35a0b753691e907d54913c9e1807f16d8ca..4d109684f37373877307f7613457f0acda37d2ac 100755 (executable)
@@ -329,6 +329,14 @@ sub get_local_mac_for_remote_ip {
        my $server_ip= shift;
        my $result= "00:00:00:00:00:00";
 
+       if($server_ip =~ /^[a-z][a-z0-9\.]$/i) {
+               my $ip_address = inet_ntoa(scalar gethostbyname($server_ip));
+               if(defined($ip_address) && $ip_address =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/ && $port =~ /^\d+$/) {
+                       # Write ip address to $server_ip variable
+                       $server_ip = $ip_address;
+               }
+       }
+
        if($server_ip =~ /^(\d\d?\d?\.){3}\d\d?\d?$/) {
                my $PROC_NET_ROUTE= ('/proc/net/route');