From 89f015b68748fbd49129331830c4a3359f3f38b1 Mon Sep 17 00:00:00 2001 From: janw Date: Thu, 30 Apr 2009 13:29:26 +0000 Subject: [PATCH] Translate hostnames to ip addresses. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13597 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-si/gosa-si-client | 8 ++++++++ gosa-si/gosa-si-server | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gosa-si/gosa-si-client b/gosa-si/gosa-si-client index cf352ac42..cb2f70efa 100755 --- a/gosa-si/gosa-si-client +++ b/gosa-si/gosa-si-client @@ -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'); diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index fbb16fee5..7a7ea0870 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -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+$/) { -- 2.30.2