changeset 1133:1a5d655cae9c draft

fixed another bug in whoisd
author epoch <epoch@hacking.allowed.org>
date Fri, 23 Aug 2013 18:43:12 +0000
parents 2fd95bea3988
children 97f5dc7e763c
files contrib/whoisd/whoisd.pl
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/whoisd/whoisd.pl	Fri Aug 23 18:22:48 2013 +0000
+++ b/contrib/whoisd/whoisd.pl	Fri Aug 23 18:43:12 2013 +0000
@@ -41,8 +41,12 @@
 if($QUERY =~ m/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/) {
  printf "%% IP section for %s\n", $QUERY;
  chdir("$RESDB/db/ip");
- foreach(split(/\./,$QUERY)) {
-  chdir(sprintf("%02x",$_));
+ @parts=split(/\./,$QUERY);
+ for($i=0;$i<scalar(@parts)-1;$i++) {
+  if(!chdir(sprintf("%02x",$parts[$i]))) {
+   printf "%-20s %s\n", "error" . ":", "IP not found.";
+   exit;
+  }
  }
  foreach(split(/\n/,`grep '' -r .`)) {
   $out = $_;