source: branches/htmlform/cgi-bin/main.cgi@ 503

Last change on this file since 503 was 503, checked in by Kris Deugau, 13 years ago

/branches/htmlform

Checkpoint, clearing out references to printError()
All ACL checks that generate error pages should now be converted
to use the new aclerror template. See #15.
Fix a minor bug in CustIDCK.pm - calls to custid_check are being
treated as an object call for some reason.

  • Property svn:executable set to *
  • Property svn:keywords set to Date Rev Author
File size: 39.7 KB
Line 
1#!/usr/bin/perl
2# ipdb/cgi-bin/main.cgi
3###
4# SVN revision info
5# $Date: 2011-09-26 22:05:01 +0000 (Mon, 26 Sep 2011) $
6# SVN revision $Rev: 503 $
7# Last update by $Author: kdeugau $
8###
9# Copyright (C) 2004-2010 - Kris Deugau
10
11use strict;
12use warnings;
13use CGI::Carp qw(fatalsToBrowser);
14use CGI::Simple;
15use HTML::Template;
16use DBI;
17use CommonWeb qw(:ALL);
18use CustIDCK;
19use POSIX qw(ceil);
20use NetAddr::IP;
21
22use Sys::Syslog;
23
24# don't remove! required for GNU/FHS-ish install from tarball
25##uselib##
26
27use MyIPDB;
28
29openlog "IPDB","pid","$IPDB::syslog_facility";
30
31## Environment. Collect some things, process some things, set some things...
32
33# Collect the username from HTTP auth. If undefined, we're in
34# a test environment, or called without a username.
35my $authuser;
36if (!defined($ENV{'REMOTE_USER'})) {
37 $authuser = '__temptest';
38} else {
39 $authuser = $ENV{'REMOTE_USER'};
40}
41
42# anyone got a better name? :P
43my $thingroot = $ENV{SCRIPT_FILENAME};
44$thingroot =~ s|cgi-bin/main.cgi||;
45
46syslog "debug", "$authuser active, $ENV{'REMOTE_ADDR'}";
47
48##fixme there *must* be a better order to do things in so this can go back where it was
49# CGI fiddling done here so we can declare %webvar so we can alter $webvar{action}
50# to show the right page on DB errors.
51# Set up the CGI object...
52my $q = new CGI::Simple;
53# ... and get query-string params as well as POST params if necessary
54$q->parse_query_string;
55
56# Convenience; saves changing all references to %webvar
57##fixme: tweak for handling <select multiple='y' size=3> (list with multiple selection)
58my %webvar = $q->Vars;
59
60# Why not a global DB handle? (And a global statement handle, as well...)
61# Use the connectDB function, otherwise we end up confusing ourselves
62my $ip_dbh;
63my $sth;
64my $errstr;
65($ip_dbh,$errstr) = connectDB_My;
66if (!$ip_dbh) {
67 $webvar{action} = "dberr";
68} else {
69 initIPDBGlobals($ip_dbh);
70}
71
72# Set up some globals
73$ENV{HTML_TEMPLATE_ROOT} = $thingroot."templates";
74
75my $header = HTML::Template->new(filename => "header.tmpl");
76my $footer = HTML::Template->new(filename => "footer.tmpl");
77
78$header->param(version => $IPDB::VERSION);
79$header->param(addperm => $IPDBacl{$authuser} =~ /a/);
80print "Content-type: text/html\n\n", $header->output;
81
82
83#main()
84my $aclerr;
85
86if(!defined($webvar{action})) {
87 $webvar{action} = "index"; #shuts up the warnings.
88}
89
90my $page;
91if (-e "$ENV{HTML_TEMPLATE_ROOT}/$webvar{action}.tmpl") {
92 $page = HTML::Template->new(filename => "$webvar{action}.tmpl");
93} else {
94 $page = HTML::Template->new(filename => "dunno.tmpl");
95}
96
97if($webvar{action} eq 'index') {
98 showSummary();
99} elsif ($webvar{action} eq 'addmaster') {
100 if ($IPDBacl{$authuser} !~ /a/) {
101 $aclerr = 'addmaster';
102 }
103} elsif ($webvar{action} eq 'newmaster') {
104
105 if ($IPDBacl{$authuser} !~ /a/) {
106 $aclerr = 'addmaster';
107 } else {
108 my $cidr = new NetAddr::IP $webvar{cidr};
109 $page->param(cidr => "$cidr");
110
111 my ($code,$msg) = addMaster($ip_dbh, $webvar{cidr});
112
113 if ($code eq 'FAIL') {
114 syslog "err", "Could not add master block '$webvar{cidr}' to database: '$msg'";
115 $page->param(err => $msg);
116 } else {
117 syslog "info", "$authuser added master block $webvar{cidr}";
118 }
119
120 } # ACL check
121
122} # end add new master
123
124elsif($webvar{action} eq 'showmaster') {
125 showMaster();
126}
127elsif($webvar{action} eq 'showrouted') {
128 showRBlock();
129}
130elsif($webvar{action} eq 'listpool') {
131 listPool();
132}
133
134# Not modified or added; just shuffled
135elsif($webvar{action} eq 'assign') {
136 assignBlock();
137}
138elsif($webvar{action} eq 'confirm') {
139 confirmAssign();
140}
141elsif($webvar{action} eq 'insert') {
142 insertAssign();
143}
144elsif($webvar{action} eq 'edit') {
145 edit();
146}
147elsif($webvar{action} eq 'update') {
148 update();
149}
150elsif($webvar{action} eq 'delete') {
151 remove();
152}
153elsif($webvar{action} eq 'finaldelete') {
154 finalDelete();
155}
156elsif ($webvar{action} eq 'nodesearch') {
157 $sth = $ip_dbh->prepare("SELECT node_id, node_name FROM nodes ORDER BY node_type,node_id");
158 $sth->execute() or $page->param(errmsg => $sth->errstr);
159 my @nodelist;
160 while (my ($nid,$nname) = $sth->fetchrow_array()) {
161 my %row = (nodeid => $nid, nodename => $nname);
162 push @nodelist, \%row;
163 }
164 $page->param(nodelist => \@nodelist);
165}
166
167# DB failure. Can't do much here, really.
168elsif ($webvar{action} eq 'dberr') {
169 $page->param(errmsg => $errstr);
170}
171
172# Default is an error. It shouldn't be possible to get here unless you're
173# randomly feeding in values for webvar{action}.
174else {
175 my $rnd = rand 500;
176 my $boing = sprintf("%.2f", rand 500);
177 my @excuses = (
178 "Aether cloudy. Ask again later about $webvar{action}.",
179 "The gods are unhappy with your sacrificial $webvar{action}.",
180 "Because one of $webvar{action}'s legs are both the same",
181 "<b>wibble</b><br>Can't $webvar{action}, the grue will get me!<br>Can't $webvar{action}, the grue will get me!",
182 "Hey, man, you've had your free $webvar{action}. Next one's gonna... <i>cost</i>....",
183 "I ain't done $webvar{action}",
184 "Oooo, look! A flying $webvar{action}!",
185 "$webvar{action} too evil, avoiding.",
186 "Rocks fall, $webvar{action} dies.",
187 "Bit bucket must be emptied before I can $webvar{action}..."
188 );
189 $page->param(dunno => $excuses[$rnd/50.0]);
190}
191## Finally! Done with that NASTY "case" emulation!
192
193
194# Switch to a different template if we've tripped on an ACL error.
195# Note that this should only be exercised in development, when
196# deeplinked, or when being attacked; normal ACL handling should
197# remove the links a user is not allowed to click on.
198if ($aclerr) {
199 $page = HTML::Template->new(filename => "aclerror.tmpl");
200 $page->param(ipdbfunc => $aclmsg{$aclerr});
201}
202
203
204# Clean up IPDB globals, DB handle, etc.
205finish($ip_dbh);
206
207## Do all our printing here so we can generate errors and stick them into the slots in the templates.
208
209# can't do this yet, too many blowups
210#print "Content-type: text/html\n\n", $header->output;
211
212print $page->output;
213
214# include the admin tools link in the output?
215$footer->param(adminlink => ($IPDBacl{$authuser} =~ /A/));
216
217print $footer->output;
218
219# Just in case something waaaayyy down isn't in place
220# properly... we exit explicitly.
221exit 0;
222
223
224# Initial display: Show master blocks with total allocated subnets, total free subnets
225sub showSummary {
226 my %allocated;
227 my %free;
228 my %routed;
229 my %bigfree;
230
231 # Count the allocations.
232 $sth = $ip_dbh->prepare("select count(*) from allocations where cidr <<= ?");
233 foreach my $master (@masterblocks) {
234 $sth->execute("$master");
235 $sth->bind_columns(\$allocated{"$master"});
236 $sth->fetch();
237 }
238
239 # Count routed blocks
240 $sth = $ip_dbh->prepare("select count(*) from routed where cidr <<= ?");
241 foreach my $master (@masterblocks) {
242 $sth->execute("$master");
243 $sth->bind_columns(\$routed{"$master"});
244 $sth->fetch();
245 }
246
247 # Count the free blocks.
248 $sth = $ip_dbh->prepare("select count(*) from freeblocks where cidr <<= ? and ".
249 "(routed='y' or routed='n')");
250 foreach my $master (@masterblocks) {
251 $sth->execute("$master");
252 $sth->bind_columns(\$free{"$master"});
253 $sth->fetch();
254 }
255
256 # Find the largest free block in each master
257 $sth = $ip_dbh->prepare("select maskbits from freeblocks where cidr <<= ? and ".
258 "(routed='y' or routed='n') order by maskbits limit 1");
259 foreach my $master (@masterblocks) {
260 $sth->execute("$master");
261 $sth->bind_columns(\$bigfree{"$master"});
262 $sth->fetch();
263 }
264
265 # Assemble the data to stuff into the template.
266 my @masterlist;
267 my $rowclass=0;
268 foreach my $master (@masterblocks) {
269 my %row = (
270 rowclass => $rowclass++ % 2,
271 master => "$master",
272 routed => $routed{"$master"},
273 allocated => $allocated{"$master"},
274 free => $free{"$master"},
275 bigfree => ( ($bigfree{"$master"} eq '') ? ("&lt;NONE&gt;") : ("/".$bigfree{"$master"}) )
276 );
277 push (@masterlist, \%row);
278 }
279 $page->param(masterlist => \@masterlist);
280
281 $page->param(addmaster => ($IPDBacl{$authuser} =~ /a/) );
282
283} # showSummary
284
285
286# Display detail on master
287# Alrighty then! We're showing routed blocks within a single master this time.
288# We should be able to steal code from showSummary(), and if I'm really smart
289# I'll figger a way to munge the two together. (Once I've done that, everything
290# else should follow. YMMV.)
291sub showMaster {
292
293 $page->param(master => $webvar{block});
294
295 my %allocated;
296 my %free;
297 my %cities;
298 my %bigfree;
299
300 my $master = new NetAddr::IP $webvar{block};
301 my @localmasters;
302
303 # Fetch only the blocks relevant to this master
304 $sth = $ip_dbh->prepare("select cidr,city from routed where cidr <<= '$master' order by cidr");
305 $sth->execute();
306
307 my $i=0;
308 while (my @data = $sth->fetchrow_array()) {
309 my $cidr = new NetAddr::IP $data[0];
310 $localmasters[$i++] = $cidr;
311 $free{"$cidr"} = 0;
312 $allocated{"$cidr"} = 0;
313 $bigfree{"$cidr"} = 128;
314 # Retain the routing destination
315 $cities{"$cidr"} = $data[1];
316 }
317
318 # Check if there were actually any blocks routed from this master
319 if ($i > 0) {
320
321 # Count the allocations
322 $sth = $ip_dbh->prepare("select count(*) from allocations where cidr <<= ?");
323 foreach my $master (@localmasters) {
324 $sth->execute("$master");
325 $sth->bind_columns(\$allocated{"$master"});
326 $sth->fetch();
327 }
328
329 # Count the free blocks.
330 $sth = $ip_dbh->prepare("select count(*) from freeblocks where cidr <<= ? and ".
331 "(routed='y' or routed='n')");
332 foreach my $master (@localmasters) {
333 $sth->execute("$master");
334 $sth->bind_columns(\$free{"$master"});
335 $sth->fetch();
336 }
337
338 # Get the size of the largest free block
339 $sth = $ip_dbh->prepare("select maskbits from freeblocks where cidr <<= ? and ".
340 "(routed='y' or routed='n') order by maskbits limit 1");
341 foreach my $master (@localmasters) {
342 $sth->execute("$master");
343 $sth->bind_columns(\$bigfree{"$master"});
344 $sth->fetch();
345 }
346
347 my @routed;
348 my $rowclass = 0;
349 foreach my $master (@localmasters) {
350 my %row = (
351 rowclass => $rowclass++ % 2,
352 block => "$master",
353 city => $cities{"$master"},
354 nsubs => $allocated{"$master"},
355 nfree => $free{"$master"},
356 lfree => ( ($bigfree{"$master"} eq 128) ? ("&lt;NONE&gt;") : ("/".$bigfree{"$master"}) )
357 );
358 push @routed, \%row;
359 }
360 $page->param(routedlist => \@routed);
361
362 } # end check for existence of routed blocks in master
363
364 $page->param(delmaster => ($IPDBacl{$authuser} =~ /d/));
365
366 # Snag the free blocks.
367 my $count = 0;
368 $sth = $ip_dbh->prepare("select cidr from freeblocks where cidr <<='$master' and ".
369 "routed='n' order by cidr");
370 $sth->execute();
371 my @unrouted;
372 my $rowclass = 0;
373 while (my @data = $sth->fetchrow_array()) {
374 my $cidr = new NetAddr::IP $data[0];
375 my %row = (
376 rowclass => $rowclass++ % 2,
377 fblock => "$cidr",
378 frange => $cidr->range
379 );
380 push @unrouted, \%row;
381 }
382 $page->param(unrouted => \@unrouted);
383
384} # showMaster
385
386
387# Display details of a routed block
388# Alrighty then! We're showing allocations within a routed block this time.
389# We should be able to steal code from showSummary() and showMaster(), and if
390# I'm really smart I'll figger a way to munge all three together. (Once I've
391# done that, everything else should follow. YMMV.
392# This time, we check the database before spewing, because we may
393# not have anything useful to spew.
394sub showRBlock {
395
396 my $master = new NetAddr::IP $webvar{block};
397
398 $sth = $ip_dbh->prepare("select city from routed where cidr='$master'");
399 $sth->execute;
400 my ($rcity) = $sth->fetchrow_array;
401
402 $page->param(master => "$master");
403 $page->param(rcity => $rcity);
404
405 # Snag the allocations for this block
406 $sth = $ip_dbh->prepare("select cidr,city,type,custid,swip,description".
407 " from allocations where cidr <<= '$master' order by cidr");
408 $sth->execute();
409
410 # hack hack hack
411 # set up to flag swip=y records if they don't actually have supporting data in the customers table
412 my $custsth = $ip_dbh->prepare("select count(*) from customers where custid=?");
413
414 my $rowclass = 0;
415 my @blocklist;
416 while (my ($cidr,$city,$type,$custid,$swip,$desc) = $sth->fetchrow_array()) {
417 $custsth->execute($custid);
418 my ($ncust) = $custsth->fetchrow_array();
419
420 my %row = (
421 rowclass => $rowclass++ % 2,
422 block => $cidr,
423 city => $city,
424 type => $disp_alloctypes{$type},
425 custid => $custid,
426 swip => ($swip eq 'y' ? ($ncust == 0 ? 'Yes<small>*</small>' : 'Yes') : 'No'),
427 desc => $desc
428 );
429 $row{subblock} = ($type =~ /^.r$/); # hmf. wonder why these won't work in the hash declaration...
430 $row{listpool} = ($type =~ /^.[pd]$/);
431 push (@blocklist, \%row);
432 }
433 $page->param(blocklist => \@blocklist);
434
435 $page->param(delrouted => $IPDBacl{$authuser} =~ /d/);
436
437 # Snag the free blocks. We don't really *need* to be pedantic about avoiding
438 # unrouted free blocks, but it's better to let the database do the work if we can.
439 $rowclass = 0;
440 my @unassigned;
441 $sth = $ip_dbh->prepare("select cidr,routed from freeblocks where cidr <<= '$master'".
442 " order by cidr");
443 $sth->execute();
444 while (my ($cidr_db,$routed) = $sth->fetchrow_array()) {
445 my $cidr = new NetAddr::IP $cidr_db;
446
447 my %row = (
448 rowclass => $rowclass++ % 2,
449 subblock => ($routed ne 'y' && $routed ne 'n'),
450 fblock => $cidr_db,
451 fbtype => $routed,
452 frange => $cidr->range,
453 );
454 push @unassigned, \%row;
455 }
456 $page->param(unassigned => \@unassigned);
457
458} # showRBlock
459
460
461# List the IPs used in a pool
462sub listPool {
463
464 my $cidr = new NetAddr::IP $webvar{pool};
465
466 $page->param(block => $webvar{pool});
467 $page->param(netip => $cidr->addr);
468 $cidr++;
469 $page->param(gate => $cidr->addr);
470 $cidr--; $cidr--;
471 $page->param(bcast => $cidr->addr);
472 $page->param(mask => $cidr->mask);
473
474 # Snag pool info for heading
475 $sth = $ip_dbh->prepare("select type,city from allocations where cidr=?");
476 $sth->execute($webvar{pool});
477 my ($pooltype, $poolcity) = $sth->fetchrow_array;
478
479 $page->param(disptype => $disp_alloctypes{$pooltype});
480 $page->param(city => $poolcity);
481
482 # Only display net/gw/bcast if it's a "real" netblock and not a PPP(oE) lunacy
483 $page->param(realblock => $pooltype =~ /^.d$/);
484
485# probably have to add an "edit IP allocation" link here somewhere.
486
487 $sth = $ip_dbh->prepare("select ip,custid,available,description,type".
488 " from poolips where pool='$webvar{pool}' order by ip");
489 $sth->execute;
490 my @poolips;
491 my $rowclass = 0;
492 while (my ($ip,$custid,$available,$desc,$type) = $sth->fetchrow_array) {
493 my %row = (
494 rowclass => $rowclass++ % 2,
495 ip => $ip,
496 custid => $custid,
497 available => $available,
498 desc => $desc,
499 maydel => $IPDBacl{$authuser} =~ /d/,
500 delme => $available eq 'n'
501 );
502 push @poolips, \%row;
503 }
504 $page->param(poolips => \@poolips);
505
506} # end listPool
507
508
509# Show "Add new allocation" page. Note that the actual page may
510# be one of two templates, and the lists come from the database.
511sub assignBlock {
512
513 if ($IPDBacl{$authuser} !~ /a/) {
514 $aclerr = 'addblock';
515 return;
516 }
517
518 # hack pthbttt eww
519 $webvar{block} = '' if !$webvar{block};
520
521# hmm. TMPL_IF block and TMPL_ELSE block on these instead?
522 $page->param(rowa => 'row'.($webvar{block} eq '' ? 1 : 0));
523 $page->param(rowb => 'row'.($webvar{block} eq '' ? 0 : 1));
524 $page->param(block => $webvar{block}); # fb-assign flag, if block is set, we're in fb-assign
525 $page->param(iscontained => ($webvar{fbtype} && $webvar{fbtype} ne 'y'));
526
527 # New special case- block to assign is specified
528 if ($webvar{block} ne '') {
529 my $block = new NetAddr::IP $webvar{block};
530
531 # Handle contained freeblock allocation.
532 # This is a little dangerous, as it's *theoretically* possible to
533 # get fbtype='n' (aka a non-routed freeblock). However, should
534 # someone manage to get there, they get what they deserve.
535 if ($webvar{fbtype} ne 'y') {
536 # Snag the type of the container block from the database.
537 $sth = $ip_dbh->prepare("select type from allocations where cidr >>='$block'");
538 $sth->execute;
539 my @data = $sth->fetchrow_array;
540 $data[0] =~ s/c$/r/; # Munge the type into the correct form
541 $page->param(fbdisptype => $list_alloctypes{$data[0]});
542 $page->param(type => $data[0]);
543 } else {
544 $sth = $ip_dbh->prepare("select type,listname from alloctypes where listorder < 500 ".
545 "and type not like '_i' and type not like '_r' order by listorder");
546 $sth->execute;
547 my @typelist;
548 my $selflag = 0;
549 while (my @data = $sth->fetchrow_array) {
550 my %row = (tval => $data[0],
551 type => $data[1],
552 sel => ($selflag == 0 ? ' selected' : '')
553 );
554 push (@typelist, \%row);
555 $selflag++;
556 }
557 $page->param(typelist => \@typelist);
558 }
559 } else {
560 my @masterlist;
561 foreach my $master (@masterblocks) {
562 my %row = (master => "$master");
563 push (@masterlist, \%row);
564 }
565 $page->param(masterlist => \@masterlist);
566
567 my @pops;
568 foreach my $pop (@poplist) {
569 my %row = (pop => $pop);
570 push (@pops, \%row);
571 }
572 $page->param(pops => \@pops);
573
574 # could arguably include routing (500) in the list, but ATM it doesn't
575 # make sense, and in any case that shouldn't be structurally possible here.
576 $sth = $ip_dbh->prepare("select type,listname from alloctypes where listorder <= 500 order by listorder");
577 $sth->execute;
578 my @typelist;
579 my $selflag = 0;
580 while (my @data = $sth->fetchrow_array) {
581 my %row = (tval => $data[0],
582 type => $data[1],
583 sel => ($selflag == 0 ? ' selected' : '')
584 );
585 push (@typelist, \%row);
586 $selflag++;
587 }
588 $page->param(typelist => \@typelist);
589 }
590
591 my @cities;
592 foreach my $city (@citylist) {
593 my %row = (city => $city);
594 push (@cities, \%row);
595 }
596 $page->param(citylist => \@cities);
597
598## node hack
599 $sth = $ip_dbh->prepare("SELECT node_id, node_name FROM nodes ORDER BY node_type,node_id");
600 $sth->execute() or print "DEBUG: failed retrieval from nodes: ".$sth->errstr,"<br>\n";
601 my @nodes;
602 while (my ($nid,$nname) = $sth->fetchrow_array()) {
603 my %row = (nid => $nid, nname => $nname);
604 push (@nodes, \%row);
605 }
606 $page->param(nodelist => \@nodes);
607## end node hack
608
609 $page->param(privdata => $IPDBacl{$authuser} =~ /s/);
610
611} # assignBlock
612
613
614# Take info on requested IP assignment and see what we can provide.
615sub confirmAssign {
616 if ($IPDBacl{$authuser} !~ /a/) {
617 $aclerr = 'addblock';
618 return;
619 }
620
621 my $cidr;
622 my $alloc_from;
623
624 # Going to manually validate some items.
625 # custid and city are automagic.
626 return if !validateInput();
627
628# Several different cases here.
629# Static IP vs netblock
630# + Different flavours of static IP
631# + Different flavours of netblock
632
633 if ($webvar{alloctype} =~ /^.i$/) {
634 my ($base,undef) = split //, $webvar{alloctype}; # split into individual chars
635
636# Ewww. But it works.
637 $sth = $ip_dbh->prepare("SELECT (SELECT city FROM allocations WHERE cidr=poolips.pool), ".
638 "poolips.pool, COUNT(*) FROM poolips,allocations WHERE poolips.available='y' AND ".
639 "poolips.pool=allocations.cidr AND allocations.city='$webvar{pop}' AND poolips.type LIKE '".$base."_' ".
640 "GROUP BY pool");
641 $sth->execute;
642 my $optionlist;
643
644 my @poollist;
645 while (my ($poolcit,$poolblock,$poolfree) = $sth->fetchrow_array) {
646 # city,pool cidr,free IP count
647 if ($poolfree > 0) {
648 my %row = (poolcit => $poolcit, poolblock => $poolblock, poolfree => $poolfree);
649 push (@poollist, \%row);
650 }
651 }
652 $page->param(staticip => 1);
653 $page->param(poollist => \@poollist);
654 $cidr = "Single static IP";
655##fixme: need to handle "no available pools"
656
657 } else { # end show pool options
658
659 if ($webvar{fbassign} eq 'y') {
660 $cidr = new NetAddr::IP $webvar{block};
661 $webvar{maskbits} = $cidr->masklen;
662 } else { # done with direct freeblocks assignment
663
664 if (!$webvar{maskbits}) {
665 $page->param(err => "Please specify a CIDR mask length.");
666 return;
667 }
668 my $sql;
669 my $city;
670 my $failmsg;
671 my $extracond = '';
672 if ($webvar{allocfrom} eq '-') {
673 $extracond = ($webvar{allowpriv} eq 'on' ? '' :
674 " and not (cidr <<= '192.168.0.0/16'".
675 " or cidr <<= '10.0.0.0/8'".
676 " or cidr <<= '172.16.0.0/12')");
677 }
678 my $sortorder;
679 if ($webvar{alloctype} eq 'rm') {
680 if ($webvar{allocfrom} ne '-') {
681 $sql = "select * from freeblocks where maskbits<=$webvar{maskbits} and routed='n'".
682 " and cidr <<= '$webvar{allocfrom}'";
683 $sortorder = "maskbits desc";
684 } else {
685 $sql = "select * from freeblocks where maskbits<=$webvar{maskbits} and routed='n'";
686 $sortorder = "maskbits desc";
687 }
688 $failmsg = "No suitable free block found.<br>\nWe do not have a free".
689 " routeable block of that size.<br>\nYou will have to either route".
690 " a set of smaller netblocks or a single smaller netblock.";
691 } else {
692##fixme
693# This section needs serious Pondering.
694 # Pools of most types get assigned to the POP they're "routed from"
695 # This includes WAN blocks and other netblock "containers"
696 # This does NOT include cable pools.
697 if ($webvar{alloctype} =~ /^.[pc]$/) {
698 $city = $webvar{city};
699 $failmsg = "No suitable free block found.<br>\nYou will have to route another".
700 " superblock from one of the<br>\nmaster blocks or chose a smaller".
701 " block size for the pool.";
702 } else {
703 $city = $webvar{pop};
704 $failmsg = "No suitable free block found.<br>\nYou will have to route another".
705 " superblock to $webvar{pop}<br>\nfrom one of the master blocks or".
706 " chose a smaller blocksize.";
707 }
708 if (defined $webvar{allocfrom} && $webvar{allocfrom} ne '-') {
709 $sql = "select cidr from freeblocks where city='$city' and maskbits<=$webvar{maskbits}".
710 " and cidr <<= '$webvar{allocfrom}' and routed='".
711 (($webvar{alloctype} =~ /^(.)r$/) ? "$1" : 'y')."'";
712 $sortorder = "maskbits desc,cidr";
713 } else {
714 $sql = "select cidr from freeblocks where city='$city' and maskbits<=$webvar{maskbits}".
715 " and routed='".(($webvar{alloctype} =~ /^(.)r$/) ? "$1" : 'y')."'";
716 $sortorder = "maskbits desc,cidr";
717 }
718 }
719 $sql = $sql.$extracond." order by ".$sortorder;
720 $sth = $ip_dbh->prepare($sql);
721 $sth->execute;
722 my @data = $sth->fetchrow_array();
723 if ($data[0] eq "") {
724 $page->param(err => $failmsg);
725 return;
726 }
727 $cidr = new NetAddr::IP $data[0];
728 } # check for freeblocks assignment or IPDB-controlled assignment
729
730 $alloc_from = "$cidr";
731
732 # If the block to be allocated is smaller than the one we found,
733 # figure out the "real" block to be allocated.
734 if ($cidr->masklen() ne $webvar{maskbits}) {
735 my $maskbits = $cidr->masklen();
736 my @subblocks;
737 while ($maskbits++ < $webvar{maskbits}) {
738 @subblocks = $cidr->split($maskbits);
739 }
740 $cidr = $subblocks[0];
741 }
742 } # if ($webvar{alloctype} =~ /^.i$/)
743
744## node hack
745 if ($webvar{node} && $webvar{node} ne '-') {
746 $sth = $ip_dbh->prepare("SELECT node_name FROM nodes WHERE node_id=?");
747 $sth->execute($webvar{node});
748 my ($nodename) = $sth->fetchrow_array();
749 $page->param(nodename => $nodename);
750 $page->param(nodeid => $webvar{node});
751 }
752## end node hack
753
754 # Stick in the allocation data
755 $page->param(alloc_type => $webvar{alloctype});
756 $page->param(typefull => $q->escapeHTML($disp_alloctypes{$webvar{alloctype}}));
757 $page->param(alloc_from => $alloc_from);
758 $page->param(cidr => $cidr);
759 $page->param(city => $q->escapeHTML($webvar{city}));
760 $page->param(custid => $webvar{custid});
761 $page->param(circid => $q->escapeHTML($webvar{circid}));
762 $page->param(desc => $q->escapeHTML($webvar{desc}));
763
764##fixme: find a way to have the displayed copy have <br> substitutions
765# for newlines, and the <input> value have either encoded or bare newlines.
766# Also applies to privdata.
767 $page->param(notes => $q->escapeHTML($webvar{notes},'y'));
768
769 # Check to see if user is allowed to do anything with sensitive data
770 my $privdata = '';
771 $page->param(privdata => $q->escapeHTML($webvar{privdata},'y'))
772 if $IPDBacl{$authuser} =~ /s/;
773
774 # Yay! This now has it's very own little home.
775 $page->param(billinguser => $webvar{userid})
776 if $webvar{userid};
777
778##fixme: this is only needed iff confirm.tmpl and
779# confirmRemove.tmpl are merged (quite possible, just
780# a little tedious)
781 $page->param(action => "insert");
782
783} # end confirmAssign
784
785
786# Do the work of actually inserting a block in the database.
787sub insertAssign {
788 if ($IPDBacl{$authuser} !~ /a/) {
789 $aclerr = 'addblock';
790 return;
791 }
792 # Some things are done more than once.
793 return if !validateInput();
794
795 if (!defined($webvar{privdata})) {
796 $webvar{privdata} = '';
797 }
798 # $code is "success" vs "failure", $msg contains OK for a
799 # successful netblock allocation, the IP allocated for static
800 # IP, or the error message if an error occurred.
801
802 my ($code,$msg) = allocateBlock($ip_dbh, $webvar{fullcidr}, $webvar{alloc_from},
803 $webvar{custid}, $webvar{alloctype}, $webvar{city}, $webvar{desc}, $webvar{notes},
804 $webvar{circid}, $webvar{privdata}, $webvar{node});
805
806 if ($code eq 'OK') {
807 if ($webvar{alloctype} =~ /^.i$/) {
808 $msg =~ s|/32||;
809 $page->param(staticip => $msg);
810 $page->param(custid => $webvar{custid});
811 $page->param(billinguser => $webvar{billinguser});
812 mailNotify($ip_dbh, "a$webvar{alloctype}", "ADDED: $disp_alloctypes{$webvar{alloctype}} allocation",
813 "$disp_alloctypes{$webvar{alloctype}} $msg allocated to customer $webvar{custid}\n".
814 "Description: $webvar{desc}\n\nAllocated by: $authuser\n");
815 } else {
816 my $netblock = new NetAddr::IP $webvar{fullcidr};
817 $page->param(fullcidr => $webvar{fullcidr});
818 $page->param(alloctype => $disp_alloctypes{$webvar{alloctype}});
819 $page->param(custid => $webvar{custid});
820 if ($webvar{alloctype} eq 'pr' && $webvar{billinguser}) {
821 $page->param(billinguser => $webvar{billinguser});
822 $page->param(custid => $webvar{custid});
823 $page->param(netaddr => $netblock->addr);
824 $page->param(masklen => $netblock->masklen);
825 }
826 mailNotify($ip_dbh, "a$webvar{alloctype}", "ADDED: $disp_alloctypes{$webvar{alloctype}} allocation",
827 "$disp_alloctypes{$webvar{alloctype}} $webvar{fullcidr} allocated to customer $webvar{custid}\n".
828 "Description: $webvar{desc}\n\nAllocated by: $authuser\n");
829 }
830 syslog "notice", "$authuser allocated '$webvar{fullcidr}' to '$webvar{custid}' as ".
831 "'$webvar{alloctype}' ($msg)";
832 } else {
833 syslog "err", "Allocation of '$webvar{fullcidr}' to '$webvar{custid}' as ".
834 "'$webvar{alloctype}' by $authuser failed: '$msg'";
835 $page->param(err => "Allocation of $webvar{fullcidr} as '$disp_alloctypes{$webvar{alloctype}}'".
836 " failed:<br>\n$msg\n");
837 }
838
839} # end insertAssign()
840
841
842# Does some basic checks on common input data to make sure nothing
843# *really* weird gets in to the database through this script.
844# Does NOT do complete input validation!!!
845sub validateInput {
846 if ($webvar{city} eq '-') {
847 printError("Please choose a city.");
848 return;
849 }
850
851 # Alloctype check.
852 chomp $webvar{alloctype};
853 if (!grep /$webvar{alloctype}/, keys %disp_alloctypes) {
854 # Danger! Danger! alloctype should ALWAYS be set by a dropdown. Anyone
855 # managing to call things in such a way as to cause this deserves a cryptic error.
856 printError("Invalid alloctype");
857 return;
858 }
859
860 # CustID check
861 # We have different handling for customer allocations and "internal" or "our" allocations
862 if ($def_custids{$webvar{alloctype}} eq '') {
863 if (!$webvar{custid}) {
864 printError("Please enter a customer ID.");
865 return;
866 }
867 if ($webvar{custid} !~ /^(?:\d{10}|\d{7}|STAFF)(?:-\d\d?)?$/) {
868 # Force uppercase for now...
869 $webvar{custid} =~ tr/a-z/A-Z/;
870 # Crosscheck with billing.
871 my $status = CustIDCK->custid_exist($webvar{custid});
872 if ($CustIDCK::Error) {
873 printError("Error verifying customer ID: ".$CustIDCK::ErrMsg);
874 return;
875 }
876 if (!$status) {
877 printError("Customer ID not valid. Make sure the Customer ID ".
878 "is correct.<br>\nUse STAFF for staff static IPs, and $IPDB::defcustid for any other ".
879 "non-customer assignments.");
880 return;
881 }
882 }
883# print "<!-- [ In validateInput(). Insert customer ID cross-check here. ] -->\n";
884 } else {
885 # New! Improved! And now Loaded From The Database!!
886 if ((!$webvar{custid}) || ($webvar{custid} ne 'STAFF')) {
887 $webvar{custid} = $def_custids{$webvar{alloctype}};
888 }
889 }
890
891 # Check POP location
892 my $flag;
893 if ($webvar{alloctype} eq 'rm') {
894 $flag = 'for a routed netblock';
895 foreach (@poplist) {
896 if (/^$webvar{city}$/) {
897 $flag = 'n';
898 last;
899 }
900 }
901 } else {
902 $flag = 'n';
903##fixme: hook to force-set POP or city on certain alloctypes
904# if ($webvar{alloctype =~ /foo,bar,bz/ { $webvar{pop} = 'blah'; }
905 if ($webvar{pop} =~ /^-$/) {
906 $flag = 'to route the block from/through';
907 }
908 }
909 if ($flag ne 'n') {
910 printError("Please choose a valid POP location $flag. Valid ".
911 "POP locations are currently:<br>\n".join (" - ", @poplist));
912 return;
913 }
914
915 return 'OK';
916} # end validateInput
917
918
919# Displays details of a specific allocation in a form
920# Allows update/delete
921# action=edit
922sub edit {
923
924 my $sql;
925
926 # Two cases: block is a netblock, or block is a static IP from a pool
927 # because I'm lazy, we'll try to make the SELECT's bring out identical)ish) data
928##fixme: allow "SWIP" (publication to rWHOIS) of static IP data
929 if ($webvar{block} =~ /\/32$/) {
930 $sql = "select ip,custid,type,city,circuitid,description,notes,modifystamp,privdata from poolips where ip='$webvar{block}'";
931 } else {
932 $sql = "select cidr,custid,type,city,circuitid,description,notes,modifystamp,privdata,swip from allocations where cidr='$webvar{block}'"
933 }
934
935 # gotta snag block info from db
936 $sth = $ip_dbh->prepare($sql);
937 $sth->execute;
938 my @data = $sth->fetchrow_array;
939
940 # Clean up extra whitespace on alloc type
941 $data[2] =~ s/\s//;
942
943 # We can't let the city be changed here; this block is a part of
944 # a larger routed allocation and therefore by definition can't be moved.
945 # block and city are static.
946##fixme
947# Needs thinking. Have to allow changes to city to correct errors, no?
948# Also have areas where a routed block at a POP serves "many" cities/towns/named crossroads
949
950# @data: cidr,custid,type,city,circuitid,description,notes,modifystamp,privdata,swip
951
952 $page->param(block => $webvar{block});
953
954 $page->param(custid => $data[1]);
955 $page->param(city => $data[3]);
956 $page->param(circid => $data[4]);
957 $page->param(desc => $data[5]);
958 $page->param(notes => $data[6]);
959
960##fixme The check here should be built from the database
961# Need to expand to support pool types too
962 if ($data[2] =~ /^.[ne]$/ && $IPDBacl{$authuser} =~ /c/) {
963 $page->param(changetype => 1);
964 $page->param(alloctype => [
965 { selme => ($data[2] eq 'me'), type => "me", disptype => "Dialup netblock" },
966 { selme => ($data[2] eq 'de'), type => "de", disptype => "Dynamic DSL netblock" },
967 { selme => ($data[2] eq 'ce'), type => "ce", disptype => "Dynamic cable netblock" },
968 { selme => ($data[2] eq 'we'), type => "we", disptype => "Dynamic wireless netblock" },
969 { selme => ($data[2] eq 'cn'), type => "cn", disptype => "Customer netblock" },
970 { selme => ($data[2] eq 'en'), type => "en", disptype => "End-use netblock" },
971 { selme => ($data[2] eq 'in'), type => "in", disptype => "Internal netblock" },
972 ]
973 );
974 } else {
975 $page->param(disptype => $disp_alloctypes{$data[2]});
976 $page->param(type => $data[2]);
977 }
978
979## node hack
980 $sth = $ip_dbh->prepare("SELECT nodes.node_id,node_name FROM nodes INNER JOIN noderef".
981 " ON nodes.node_id=noderef.node_id WHERE noderef.block='$webvar{block}'");
982 $sth->execute;
983 my ($nodeid,$nodename) = $sth->fetchrow_array();
984 $page->param(havenodeid => $nodeid);
985
986 if ($data[2] eq 'fr' || $data[2] eq 'bi') {
987 $page->param(typesupportsnodes => 1);
988 $page->param(nodename => $nodename);
989
990##fixme: this whole hack needs cleanup and generalization for all alloctypes
991##fixme: arguably a bug that presence of a nodeid implies it can be changed..
992# but except for manual database changes, only the two types fr and bi can
993# (currently) have a nodeid set in the first place.
994 if ($IPDBacl{$authuser} =~ /c/) {
995 $sth = $ip_dbh->prepare("SELECT node_id, node_name FROM nodes ORDER BY node_type,node_id");
996 $sth->execute;
997 my @nodelist;
998 while (my ($nid,$nname) = $sth->fetchrow_array()) {
999 my %row = (
1000 selme => ($nodeid == $nid),
1001 nodeid => $nid,
1002 nodename => $nname,
1003 );
1004 push (@nodelist, \%row);
1005 }
1006 $page->param(nodelist => \@nodelist);
1007 }
1008 }
1009## end node hack
1010
1011 my ($lastmod,undef) = split /\s+/, $data[7];
1012 $page->param(lastmod => $lastmod);
1013
1014 # not happy with the upside-down logic, but...
1015 $page->param(swipable => $data[2] !~ /.i/);
1016 $page->param(swip => $data[10] ne 'n');
1017
1018 # Check to see if we can display sensitive data
1019 $page->param(nocling => $IPDBacl{$authuser} =~ /s/);
1020 $page->param(privdata => $data[8]);
1021
1022 # ACL trickery - these two template booleans control the presence of all form/input tags
1023 $page->param(maychange => $IPDBacl{$authuser} =~ /c/);
1024 $page->param(maydel => $IPDBacl{$authuser} =~ /d/);
1025
1026} # edit()
1027
1028
1029# Stuff new info about a block into the db
1030# action=update
1031sub update {
1032 if ($IPDBacl{$authuser} !~ /c/) {
1033 $aclerr = 'updateblock';
1034 return;
1035 }
1036
1037 # Check to see if we can update restricted data
1038 my $privdata = '';
1039 if ($IPDBacl{$authuser} =~ /s/) {
1040 $privdata = ",privdata='$webvar{privdata}'";
1041 }
1042
1043 # Make sure incoming data is in correct format - custID among other things.
1044 return if !validateInput;
1045
1046 # SQL transaction wrapper
1047 eval {
1048 # Relatively simple SQL transaction here.
1049 my $sql;
1050 if (my $pooltype = ($webvar{alloctype} =~ /^(.)i$/) ) {
1051 $sql = "UPDATE poolips SET custid='$webvar{custid}',".
1052 "city=?,description=?,notes=?,".
1053 "circuitid='$webvar{circid}',".
1054 "$privdata where ip='$webvar{block}'";
1055 } else {
1056 $sql = "UPDATE allocations SET custid='$webvar{custid}',".
1057 "city=?,description=?,notes=?,".
1058 "circuitid='$webvar{circid}'$privdata,".
1059 "type='$webvar{alloctype}',".
1060 "swip='".($webvar{swip} eq 'on' ? 'y' : 'n')."' ".
1061 "where cidr='$webvar{block}'";
1062 }
1063 # Log the details of the change.
1064 syslog "debug", $sql;
1065 $sth = $ip_dbh->prepare($sql);
1066 $sth->execute($webvar{city}, $webvar{desc}, $webvar{notes});
1067## node hack
1068 if ($webvar{node}) {
1069 # done with delete/insert so we don't have to worry about funkyness updating a node ref that isn't there
1070 $ip_dbh->do("DELETE FROM noderef WHERE block='$webvar{block}'");
1071 $sth = $ip_dbh->prepare("INSERT INTO noderef (block,node_id) VALUES (?,?)");
1072 $sth->execute($webvar{block},$webvar{node});
1073 }
1074## end node hack
1075 $ip_dbh->commit;
1076 };
1077 if ($@) {
1078 my $msg = $@;
1079 carp "Transaction aborted because $msg";
1080 eval { $ip_dbh->rollback; };
1081 syslog "err", "$authuser could not update block/IP '$webvar{block}': '$msg'";
1082 printError("Could not update block/IP $webvar{block}: $msg");
1083 return;
1084 }
1085
1086 # If we get here, the operation succeeded.
1087 syslog "notice", "$authuser updated $webvar{block}";
1088##fixme: need to wedge something in to allow "update:field" notifications
1089## hmm. how to tell what changed? O_o
1090mailNotify($ip_dbh, 's:swi', "SWIPed: $disp_alloctypes{$webvar{alloctype}} $webvar{block}",
1091 "$webvar{block} had SWIP status changed to \"Yes\" by $authuser") if $webvar{swip} eq 'on';
1092
1093## node hack
1094 if ($webvar{node} && $webvar{node} ne '-') {
1095 $sth = $ip_dbh->prepare("SELECT node_name FROM nodes WHERE node_id=?");
1096 $sth->execute($webvar{node});
1097 my ($nodename) = $sth->fetchrow_array();
1098 $page->param(nodename => $nodename);
1099 }
1100## end node hack
1101
1102 # Link back to browse-routed or list-pool page on "Update complete" page.
1103 my $cblock; # to contain the CIDR of the container block we're retrieving.
1104 my $sql;
1105 if (my $pooltype = ($webvar{alloctype} =~ /^(.)i$/) ) {
1106 $page->param(backpool => 1);
1107 $sql = "select pool from poolips where ip='$webvar{block}'";
1108 } else {
1109 $sql = "select cidr from routed where cidr >>= '$webvar{block}'";
1110 }
1111 # I define there to be no errors on this operation... so we don't need to check for them.
1112 $sth = $ip_dbh->prepare($sql);
1113 $sth->execute;
1114 $sth->bind_columns(\$cblock);
1115 $sth->fetch();
1116 $sth->finish;
1117 $page->param(backblock => $cblock);
1118
1119 $page->param(cidr => $webvar{block});
1120 $page->param(city => $webvar{city});
1121 $page->param(disptype => $disp_alloctypes{$webvar{alloctype}});
1122 $page->param(custid => $webvar{custid});
1123 $page->param(swip => $webvar{swip} eq 'on' ? 'Yes' : 'No');
1124 $page->param(circid => $q->escapeHTML($webvar{circid}));
1125 $page->param(desc => $q->escapeHTML($webvar{desc}));
1126 $page->param(notes => $q->escapeHTML($webvar{notes}));
1127 $webvar{privdata} = ($webvar{privdata} ? $q->escapeHTML($webvar{privdata}) : "&nbsp;");
1128 $page->param(privdata => $webvar{privdata})
1129 if $IPDBacl{$authuser} =~ /s/;
1130
1131} # update()
1132
1133
1134# Delete an allocation.
1135sub remove {
1136 if ($IPDBacl{$authuser} !~ /d/) {
1137 $aclerr = 'delblock';
1138 return;
1139 }
1140
1141 # Serves'em right for getting here...
1142 if (!defined($webvar{block})) {
1143 printError("Error 332");
1144 return;
1145 }
1146
1147 my ($cidr, $custid, $type, $city, $circid, $desc, $notes, $alloctype, $privdata);
1148
1149 if ($webvar{alloctype} eq 'rm') {
1150 $sth = $ip_dbh->prepare("select cidr,city from routed where cidr='$webvar{block}'");
1151 $sth->execute();
1152
1153# This feels... extreme.
1154 croak $sth->errstr() if($sth->errstr());
1155
1156 $sth->bind_columns(\$cidr,\$city);
1157 $sth->execute();
1158 $sth->fetch || croak $sth->errstr();
1159 $custid = "N/A";
1160 $alloctype = $webvar{alloctype};
1161 $circid = "N/A";
1162 $desc = "N/A";
1163 $notes = "N/A";
1164 $privdata = "N/A";
1165
1166 } elsif ($webvar{alloctype} eq 'mm') {
1167
1168 $cidr = $webvar{block};
1169 $city = "N/A";
1170 $custid = "N/A";
1171 $alloctype = $webvar{alloctype};
1172 $circid = "N/A";
1173 $desc = "N/A";
1174 $notes = "N/A";
1175 $privdata = "N/A";
1176
1177 } elsif ($webvar{alloctype} =~ /^.i$/) { # done with alloctype=[rm]m
1178
1179 # Unassigning a static IP
1180 my $sth = $ip_dbh->prepare("select ip,custid,city,type,notes,circuitid,privdata".
1181 " from poolips where ip='$webvar{block}'");
1182 $sth->execute();
1183# croak $sth->errstr() if($sth->errstr());
1184
1185 $sth->bind_columns(\$cidr, \$custid, \$city, \$alloctype, \$notes, \$circid,
1186 \$privdata);
1187 $sth->fetch() || croak $sth->errstr;
1188
1189 } else { # done with alloctype=~ /^.i$/
1190
1191 my $sth = $ip_dbh->prepare("select cidr,custid,type,city,circuitid,description,notes,privdata".
1192 " from allocations where cidr='$webvar{block}'");
1193 $sth->execute();
1194# croak $sth->errstr() if($sth->errstr());
1195
1196 $sth->bind_columns(\$cidr, \$custid, \$alloctype, \$city, \$circid, \$desc,
1197 \$notes, \$privdata);
1198 $sth->fetch() || carp $sth->errstr;
1199 } # end cases for different alloctypes
1200
1201 $page->param(block => $cidr);
1202 $page->param(disptype => $disp_alloctypes{$alloctype});
1203 $page->param(type => $alloctype);
1204 $page->param(city => $city);
1205 $page->param(custid => $custid);
1206 $page->param(circid => $circid);
1207 $page->param(desc => $desc);
1208 $page->param(notes => $notes);
1209 $privdata = '&nbsp;' if $privdata eq '';
1210 $page->param(privdata => $privdata) if $IPDBacl{$authuser} =~ /s/;
1211 $page->param(delpool => $alloctype =~ /^.[pd]$/);
1212
1213} # end remove()
1214
1215
1216# Delete an allocation. Return it to the freeblocks table; munge
1217# data as necessary to keep as few records as possible in freeblocks
1218# to prevent weirdness when allocating blocks later.
1219# Remove IPs from pool listing if necessary
1220sub finalDelete {
1221 if ($IPDBacl{$authuser} !~ /d/) {
1222 $aclerr = 'delblock';
1223 return;
1224 }
1225
1226 # need to retrieve block data before deleting so we can notify on that
1227 my ($cidr,$custid,$type,$city,$description) = getBlockData($ip_dbh, $webvar{block});
1228
1229 my ($code,$msg) = deleteBlock($ip_dbh, $webvar{block}, $webvar{alloctype});
1230
1231 $page->param(block => $webvar{block});
1232 if ($code eq 'OK') {
1233 syslog "notice", "$authuser deallocated '$webvar{alloctype}'-type netblock $webvar{block}".
1234 " $custid, $city, desc='$description'";
1235 mailNotify($ip_dbh, 'da', "REMOVED: $disp_alloctypes{$webvar{alloctype}} $webvar{block}",
1236 "$disp_alloctypes{$webvar{alloctype}} $webvar{block} deallocated by $authuser\n".
1237 "CustID: $custid\nCity: $city\nDescription: $description\n");
1238 } else {
1239 $page->param(failmsg => $msg);
1240 if ($webvar{alloctype} =~ /^.i$/) {
1241 syslog "err", "$authuser could not deallocate static IP '$webvar{block}': '$msg'";
1242 } else {
1243 syslog "err", "$authuser could not deallocate netblock '$webvar{block}': '$msg'";
1244 $page->param(netblock => 1);
1245 }
1246 }
1247
1248} # finalDelete
Note: See TracBrowser for help on using the repository browser.