From 81105a2e92675502207fec3e9080cd210d070610 Mon Sep 17 00:00:00 2001 From: janw Date: Thu, 2 Oct 2008 15:41:50 +0000 Subject: [PATCH] Allow hostnames as source - just rewrite them to their resolved ip_address git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12594 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-si/gosa-si-server | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gosa-si/gosa-si-server b/gosa-si/gosa-si-server index 2c4770cbc..4f15e34c8 100755 --- a/gosa-si/gosa-si-server +++ b/gosa-si/gosa-si-server @@ -601,8 +601,18 @@ sub check_outgoing_xml_validity { if( 0 == length $source) { die 'source has length 0'; } + + # Check if source contains hostname instead of ip address + if($source !=~ /^[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+$/) { + # Write ip address to $source variable + $source = "$ip_address:$port"; + } + } unless( $source =~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d+$/ || - $source =~ /^GOSA$/i ) { + $source =~ /^GOSA$/i) { die "source '$source' is neither a complete ip-address with port nor 'GOSA'"; } -- 2.30.2