Code

Translate hostnames to ip addresses.
authorjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 30 Apr 2009 13:29:26 +0000 (13:29 +0000)
committerjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 30 Apr 2009 13:29:26 +0000 (13:29 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13597 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/gosa-si-client
gosa-si/gosa-si-server

index cf352ac42c86df9398af9bbd960aa18c2cfed2e2..cb2f70efa88c5b91de3a145b052c985b061e6415 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}/) {
+                       # 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');
 
index fbb16fee507b9389f978d0bf958c9f2bf2cba107..7a7ea0870eb9dbcb973d2c4b8cc592fe9235fcd6 100755 (executable)
@@ -615,7 +615,7 @@ sub check_outgoing_xml_validity {
         }
 
                                # Check if source contains hostname instead of ip address
-                               if(not $source =~ /^[a-z0-9\.]+:\d+$/i) {
+                               if($source =~ /^[a-z][a-z0-9\.]+:\d+$/i) {
                                                my ($hostname,$port) = split(/:/, $source);
                                                my $ip_address = inet_ntoa(scalar gethostbyname($hostname));
                                                if(defined($ip_address) && $ip_address =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/ && $port =~ /^\d+$/) {