Code

bugfix: change !=~ expression to not =~
[gosa.git] / gosa-si / gosa-si-server
index 2c4770cbc660b47ccc943b87ebe77c327ba41f8d..e0c98a709bc1ac622436b37aa2662d207deb066e 100755 (executable)
@@ -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(not $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'";
         }