Subject: [69] minor bugs in util/xferstats

From: Ric Anderson <[email-masked]>
Date: Wed, 29 Jun 1994 07:31:39 -0700

The perl script xferstats incorrectly identifies internet addresses
whose host name begins with "inf" or which are only 2 components
wide (e.g., "bix.com") as unresolved.

This is because of two problems
1. perl's int($x) returns "Infinity" for any $x that begins with "inf",
   and that evaluates as "> 0", resulting in hosts named "info" being
   dumped into the "unresolved" bin thinking they are numeric IP
   addresses.
2. The test for number of components in the address is off by 1, as
   it checks the largest subscript in the address array rather than
   the number of elements in that array.  This causes two element
   addresses like "bix.com" to be dumped in the "unresolved" bin.

Patch attached,
Ric (<[email-masked]> "Ric Anderson", speaking for himself)
--begin patch--
*** /usr/local/src/wu-ftpd/util/xferstats	Fri Apr  1 12:03:58 1994
--- ./xferstats	Wed Jun 29 07:20:11 1994
***************
*** 92,98 ****
     $domain = $address[$#address];
     if ($domain eq "$mydom2" && $address[$#address-1] eq "$mydom1")
        { $domain = $mydom1 . "." . $mydom2; }
!    if ( int($address[0]) > 0 || $#address < 2 )
        { $domain = "unresolved"; }
  
     $count = 1;
--- 92,99 ----
     $domain = $address[$#address];
     if ($domain eq "$mydom2" && $address[$#address-1] eq "$mydom1")
        { $domain = $mydom1 . "." . $mydom2; }
!    if ( @address < 2 ||
!     (substr($address[0],0,1) ge "0" && substr($address[0],0,1) le "9"))
        { $domain = "unresolved"; }
  
     $count = 1;
--end patch--