Changeset 168 for branches/stable


Ignore:
Timestamp:
02/22/05 14:30:36 (20 years ago)
Author:
Kris Deugau
Message:

/branches/stable

Port forward enhanced "default CustID" feature from /trunk r167

Location:
branches/stable/cgi-bin
Files:
3 edited

Legend:

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

    r159 r168  
    2222@ISA            = qw(Exporter);
    2323@EXPORT_OK    = qw(
    24         %disp_alloctypes %list_alloctypes @citylist @poplist @masterblocks
     24        %disp_alloctypes %list_alloctypes %def_custids @citylist @poplist @masterblocks
    2525        %allocated %free %routed %bigfree
    2626        &initIPDBGlobals &connectDB &finish &checkDBSanity &allocateBlock &deleteBlock
     
    3030@EXPORT         = (); # Export nothing by default.
    3131%EXPORT_TAGS    = ( ALL => [qw(
    32                 %disp_alloctypes %list_alloctypes @citylist @poplist @masterblocks
    33                 %allocated %free %routed %bigfree
     32                %disp_alloctypes %list_alloctypes %def_custids @citylist @poplist
     33                @masterblocks %allocated %free %routed %bigfree
    3434                &initIPDBGlobals &connectDB &finish &checkDBSanity &allocateBlock
    3535                &deleteBlock &mailNotify
     
    4242our %disp_alloctypes;
    4343our %list_alloctypes;
     44our %def_custids;
    4445our @citylist;
    4546our @poplist;
     
    5859
    5960  # Initialize alloctypes hashes
    60   $sth = $dbh->prepare("select type,listname,dispname,listorder from alloctypes order by listorder");
     61  $sth = $dbh->prepare("select type,listname,dispname,listorder,def_custid from alloctypes order by listorder");
    6162  $sth->execute;
    6263  while (my @data = $sth->fetchrow_array) {
    6364    $disp_alloctypes{$data[0]} = $data[2];
     65    $def_custids{$data[0]} = $data[4];
    6466    if ($data[3] < 900) {
    6567      $list_alloctypes{$data[0]} = $data[1];
  • branches/stable/cgi-bin/consistency-check.pl

    r158 r168  
    1414
    1515($dbh,$errstr) = connectDB_My;
    16 
    17 # Schlep up the masters
    18 $sth = $dbh->prepare("select * from masterblocks order by cidr");
    19 $sth->execute;
    20 for ($i=0; @data = $sth->fetchrow_array; $i++) {
    21   $masterblocks[$i] = new NetAddr::IP $data[0];
    22 }
     16# May as well.  We need a number of globals.
     17initIPDBGlobals($dbh);
    2318
    2419print "First check:  All blocks must be within one of the master blocks\n";
     
    5449# Next:  free blocks
    5550print "Checking freeblocks: ";
    56 $sth = $dbh->prepare("select cidr from freeblocks");
     51$sth = $dbh->prepare("select cidr from freeblocks order by cidr");
    5752$sth->execute;
    5853FREEBLOCK: while (@data = $sth->fetchrow_array) {
     
    138133  print "done $master.\n";
    139134}
     135
     136print "Done checking block alignment.\n\nChecking for correctness on 'defined' CustIDs:\n";
     137# New check:  Make sure "defined" CustIDs are correct.
     138$sth = $dbh->prepare("select cidr,type,custid from allocations where not type='cn' order by cidr");
     139$sth->execute;
     140while (@data = $sth->fetchrow_array) {
     141  print "$data[0] ($disp_alloctypes{$data[1]}) has incorrect CustID $data[2]\n"
     142        if $data[2] ne $def_custids{$data[1]};
     143}
     144
     145print "Done CustID correctness check.\n";
  • branches/stable/cgi-bin/main.cgi

    r165 r168  
    10131013#    print "<!-- [ In validateInput().  Insert customer ID cross-check here. ] -->\n";
    10141014  } else {
    1015     # All non-customer allocations MUST be entered with "our" customer ID.
    1016     # I have Defined this as 6750400 for consistency.
    1017     # STAFF is also acceptable.
     1015    # New!  Improved!  And now Loaded From The Database!!
    10181016    if ((!$webvar{custid}) || ($webvar{custid} ne 'STAFF')) {
    1019       $webvar{custid} = "6750400";
     1017      $webvar{custid} = $def_custids{$webvar{alloctype}};
    10201018    }
    10211019  }
Note: See TracChangeset for help on using the changeset viewer.