validator/httpd/cgi-bin check,1.350,1.351

Update of /sources/public/validator/httpd/cgi-bin
In directory hutz:/tmp/cvs-serv18321

Modified Files:
	check 
Log Message:
Don't bother checking the IP address if private addresses are allowed.

Index: check
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.350
retrieving revision 1.351
diff -u -d -r1.350 -r1.351
--- check	25 Oct 2004 21:26:10 -0000	1.350
+++ check	6 Nov 2004 11:46:44 -0000	1.351
@@ -1190,22 +1190,20 @@
     return $File;
   }
 
-  my $addr = my $iptype = undef;
-  if (my $host = gethostbyname($uri->host())) {
-    $addr = inet_ntoa($host->addr()) if $host->addr();
-    if ($addr && (my $ip = Net::IP->new($addr))) {
-      $iptype = $ip->iptype();
+  unless ($CFG->{'Allow Private IPs'}) {
+    my $addr = my $iptype = undef;
+    if (my $host = gethostbyname($uri->host())) {
+      $addr = inet_ntoa($host->addr()) if $host->addr();
+      if ($addr && (my $ip = Net::IP->new($addr))) {
+        $iptype = $ip->iptype();
+      }
+    }
+    if ($iptype && $iptype ne 'PUBLIC') {
+      $File->{'Error Flagged'} = TRUE;
+      $File->{'Error Message'} = &ip_rejected($uri->host(), $addr);
+      return $File;
     }
   }
-  $iptype = 'PUBLIC'
-    if ($iptype && $iptype eq 'PRIVATE' && $CFG->{'Allow Private IPs'});
-  if ($iptype && $iptype ne 'PUBLIC') {
-    $File->{'Error Flagged'} = TRUE;
-    $File->{'Error Message'} = &ip_rejected($uri->host(), $addr);
-    return $File;
-  }
-  undef $iptype;
-  undef $addr;
 
   my $req = new HTTP::Request(GET => $uri);
 

Received on Saturday, 6 November 2004 11:46:47 UTC