#!/usr/bin/perl
# ipdb/cgi-bin/admin.cgi
# Hack interface to make specific changes to IPDB that (for one reason
# or another) can't be made through the main interface.
###
# SVN revision info
# $Date: 2004-12-01 20:42:57 +0000 (Wed, 01 Dec 2004) $
# SVN revision $Rev: 94 $
# Last update by $Author: kdeugau $
###
use strict;
use warnings;
use CGI::Carp qw(fatalsToBrowser);
use DBI;
use CommonWeb qw(:ALL);
use IPDB qw(:ALL);
#use POSIX qw(ceil);
use NetAddr::IP;
use Sys::Syslog;
openlog "IPDB-admin","pid","local2";
# Collect the username from HTTP auth. If undefined, we're in a test environment.
my $authuser;
if (!defined($ENV{'REMOTE_USER'})) {
$authuser = '__temptest';
} else {
$authuser = $ENV{'REMOTE_USER'};
}
if ($authuser !~ /^(kdeugau|jodyh|__temptest)$/) {
print "Content-Type: text/html\n\n".
"
Access denied\n".
'Access to this tool is restricted. Contact Kris '.
"for more information.\n";
exit;
}
syslog "debug", "$authuser active";
my %webvar = parse_post();
cleanInput(\%webvar);
my %full_alloc_types = (
"ci","Cable pool IP",
"di","DSL pool IP",
"si","Server pool IP",
"mi","Static dialup IP",
"wi","Static wireless IP",
"cp","Cable pool",
"dp","DSL pool",
"sp","Server pool",
"mp","Static dialup pool",
"wp","Static wireless pool",
"dn","Dialup netblock",
"dy","Dynamic DSL netblock",
"dc","Dynamic cable netblock",
"cn","Customer netblock",
"ee","End-use netblock",
"rr","Routed netblock",
"ii","Internal netblock",
"mm","Master block"
);
my $ip_dbh = connectDB;
my $sth;
print "Content-type: text/html\n\n".
"\n\n\tTEST [IPDB admin tools] TEST\n\n\n".
"IPDB - Administrative Tools
\n
\n";
if(!defined($webvar{action})) {
$webvar{action} = ""; #shuts up the warnings.
print qq(WARNING: There are FAR fewer controls on what you can do here. Use the
main interface if at all possible.