Changeset 417 for trunk/cgi-bin/IPDB.pm


Ignore:
Timestamp:
06/30/10 17:48:03 (14 years ago)
Author:
Kris Deugau
Message:

/trunk

Rearrangements and tweaks toward releaseability:

  • Add Makefile to install halfway-sanely
  • Add .spec file
  • Shuffle "use IPDB;" and "use MyIPDB;" lines so that we can automagically insert a suitable "use lib..." line during 'make install'
  • Check copyright statements
  • Clear up some defaults, and place a number of "constants" in IPDB/MyIPDB rather than having them hardcoded all over the place (Still need to think of a sane way to do this for ipdb.psql's alloctype preseeding)
  • Tweak $VERSION identifier in IPDB.pm so it can be defined in the Makefile
  • Clean up some dangling bits from repository history conversion, remove unneeded "use ..." statements
  • Tweak rWHOIS export script to use more globals and "constants" from (My)IPDB.pm, and more Perl internals than system()-equivalents. Add a few fixme comments for longer-term flexibility improvements.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/IPDB.pm

    r416 r417  
    77# Last update by $Author$
    88###
    9 # Copyright (C) 2004-2006 - Kris Deugau
     9# Copyright (C) 2004-2010 - Kris Deugau
    1010
    1111package IPDB;
     
    2020use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
    2121
    22 $VERSION        = 2.6;
     22$VERSION        = 2; ##VERSION##
    2323@ISA            = qw(Exporter);
    2424@EXPORT_OK    = qw(
     
    5353our %IPDBacl;
    5454
    55 our $orgname = 'Example Corp';
     55our $org_name = 'Example Corp';
    5656our $smtphost = 'smtp.example.com';
    5757our $domain = 'example.com';
     58our $defcustid = '5554242';
     59# mostly for rwhois
     60##fixme:  leave these blank by default?
     61our $org_street = '123 4th Street';
     62our $org_city = 'Anytown';
     63our $org_prov_state = 'ON';
     64our $org_pocode = 'H0H 0H0';
     65our $org_country = 'CA';
     66our $org_phone = '000-555-1234';
     67our $org_techhandle = 'ISP-ARIN-HANDLE';
     68
     69our $syslog_facility = 'local2';
    5870
    5971# Let's initialize the globals.
     
    561573    # have to insert all pool IPs into poolips table as "unallocated".
    562574    $sth = $dbh->prepare("insert into poolips (pool,ip,custid,city,type)".
    563         " values ('$pool', ?, '6750400', '$city', '$type')");
     575        " values ('$pool', ?, '$defcustid', '$city', '$type')");
    564576    my @poolip_list = $pool->hostenum;
    565577    if ($class eq 'all') { # (DSL-ish block - *all* IPs available
     
    618630    eval {
    619631      $msg = "Unable to deallocate $disp_alloctypes{$type} $cidr";
    620       $sth = $dbh->prepare("update poolips set custid='6750400',available='y',".
     632      $sth = $dbh->prepare("update poolips set custid='$defcustid',available='y',".
    621633        "city=(select city from allocations where cidr >>= '$cidr'".
    622634        " order by masklen(cidr) desc limit 1),".
     
    716728##TEMP
    717729  # We've already deleted the block, now we have to stuff its IPs into the pool.
    718   my $sth2 = $dbh->prepare("insert into poolips values ('209.91.185.0/24',?,'6750400','Sudbury','di','y','','','')");
     730  my $sth2 = $dbh->prepare("insert into poolips values ('209.91.185.0/24',?,'$defcustid','Sudbury','di','y','','','')");
    719731  $sth2->execute($cidr->addr);
    720732  foreach my $ip ($cidr->hostenum) {
     
    849861        "Subject: {IPDB} $subj\n",
    850862        "X-Mailer: IPDB Notify v".sprintf("%.1d",$IPDB::VERSION)."\n",
    851         "Organization: $orgname\n",
     863        "Organization: $org_name\n",
    852864        "\n$message\n");
    853865  }
Note: See TracChangeset for help on using the changeset viewer.