Ignore:
Timestamp:
06/17/05 16:42:45 (19 years ago)
Author:
Kris Deugau
Message:

/branches/dns

Update branch base with trunk changes from r216:261

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/dns/cgi-bin/IPDB.pm

    r189 r262  
    2323@EXPORT_OK    = qw(
    2424        %disp_alloctypes %list_alloctypes %def_custids @citylist @poplist @masterblocks
    25         %allocated %free %routed %bigfree
     25        %allocated %free %routed %bigfree %IPDBacl
    2626        &initIPDBGlobals &connectDB &finish &checkDBSanity &allocateBlock &deleteBlock
    2727        &mailNotify
     
    3131%EXPORT_TAGS    = ( ALL => [qw(
    3232                %disp_alloctypes %list_alloctypes %def_custids @citylist @poplist
    33                 @masterblocks %allocated %free %routed %bigfree
     33                @masterblocks %allocated %free %routed %bigfree %IPDBacl
    3434                &initIPDBGlobals &connectDB &finish &checkDBSanity &allocateBlock
    3535                &deleteBlock &mailNotify
     
    5050our %routed;
    5151our %bigfree;
     52our %IPDBacl;
    5253
    5354# Let's initialize the globals.
     
    8384  $sth = $dbh->prepare("select cidr from masterblocks order by cidr");
    8485  $sth->execute;
     86  return (undef,$sth->errstr) if $sth->err;
    8587  for (my $i=0; my @data = $sth->fetchrow_array(); $i++) {
    8688    $masterblocks[$i] = new NetAddr::IP $data[0];
     
    9193    $routed{"$masterblocks[$i]"} = 0;
    9294  }
     95
     96  # Load ACL data.  Specific username checks are done at a different level.
     97  $sth = $dbh->prepare("select username,acl from users");
     98  $sth->execute;
    9399  return (undef,$sth->errstr) if $sth->err;
     100  while (my @data = $sth->fetchrow_array) {
     101    $IPDBacl{$data[0]} = $data[1];
     102  }
    94103
    95104  return (1,"OK");
     
    375384      }; # end eval
    376385      if ($@) {
     386        $msg .= ": ".$@;
    377387        eval { $dbh->rollback; };
    378388        return ('FAIL',$msg);
     
    416426    my @poolip_list = $pool->hostenum;
    417427    if ($class eq 'all') { # (DSL-ish block - *all* IPs available
    418       $sth->execute($pool->addr);
     428      if ($pool->addr !~ /\.0$/) {      # .0 causes weirdness.
     429        $sth->execute($pool->addr);
     430      }
    419431      for (my $i=0; $i<=$#poolip_list; $i++) {
    420432        $sth->execute($poolip_list[$i]->addr);
    421433      }
    422434      $pool--;
    423       $sth->execute($pool->addr);
     435      if ($pool->addr !~ /\.255$/) {    # .255 can cause weirdness.
     436        $sth->execute($pool->addr);
     437      }
    424438    } else { # (real netblock)
    425439      for (my $i=1; $i<=$#poolip_list; $i++) {
Note: See TracChangeset for help on using the changeset viewer.