Changeset 356 for branches


Ignore:
Timestamp:
01/05/07 10:50:47 (18 years ago)
Author:
Kris Deugau
Message:

/branches/stable

Bump up the verbosity of deallocation notices
Required a new function (getBlockData) to extract the data
before deleting the block

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

Legend:

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

    r354 r356  
    2525        %allocated %free %routed %bigfree %IPDBacl
    2626        &initIPDBGlobals &connectDB &finish &checkDBSanity &allocateBlock &deleteBlock
    27         &mailNotify
     27        &getBlockData &mailNotify
    2828        );
    2929
     
    3333                @masterblocks %allocated %free %routed %bigfree %IPDBacl
    3434                &initIPDBGlobals &connectDB &finish &checkDBSanity &allocateBlock
    35                 &deleteBlock &mailNotify
     35                &deleteBlock &getBlockData &mailNotify
    3636                )]
    3737        );
     
    668668
    669669
     670## IPDB::getBlockData()
     671# Return custid, type, city, and description for a block
     672sub getBlockData {
     673  my $dbh = shift;
     674  my $block = shift;
     675
     676  my $sth = $dbh->prepare("select cidr,custid,type,city,description from searchme".
     677        " where cidr='$block'");
     678  $sth->execute();
     679  return $sth->fetchrow_array();
     680} # end getBlockData()
     681
     682
    670683## IPDB::mailNotify()
    671684# Sends notification mail to recipients regarding an IPDB operation
  • branches/stable/cgi-bin/main.cgi

    r338 r356  
    12981298  }
    12991299
     1300  # need to retrieve block data before deleting so we can notify on that
     1301  my ($cidr,$custid,$type,$city,$description) = getBlockData($ip_dbh, $webvar{block});
     1302
    13001303  my ($code,$msg) = deleteBlock($ip_dbh, $webvar{block}, $webvar{alloctype});
    13011304
    13021305  if ($code eq 'OK') {
    13031306    print "<div class=heading align=center>Success!  $webvar{block} deallocated.</div>\n";
    1304     syslog "notice", "$authuser deallocated '$webvar{alloctype}'-type netblock $webvar{block}";
     1307    syslog "notice", "$authuser deallocated '$webvar{alloctype}'-type netblock $webvar{block}".
     1308        " $custid, $city, desc='$description'";
    13051309    # Notify tech@ when a block/IP is deallocated
    13061310    mailNotify('tech@example.com',"REMOVED: $disp_alloctypes{$webvar{alloctype}} $webvar{block}",
    1307         "$disp_alloctypes{$webvar{alloctype}} $webvar{block} deallocated by $authuser\n");
     1311        "$disp_alloctypes{$webvar{alloctype}} $webvar{block} deallocated by $authuser\n".
     1312        "CustID: $custid\nCity: $city\nDescription: $description\n");
    13081313  } else {
    13091314    if ($webvar{alloctype} =~ /^.i$/) {
Note: See TracChangeset for help on using the changeset viewer.