source: trunk/cgi-bin/admin.cgi@ 546

Last change on this file since 546 was 546, checked in by Kris Deugau, 12 years ago

/trunk

Tweak custid check in both main.cgi and admin.cgi; move the
general hardcoded checks into CustIDCK.pm.

  • Property svn:executable set to *
  • Property svn:keywords set to Date Rev Author
File size: 18.9 KB
Line 
1#!/usr/bin/perl
2# ipdb/cgi-bin/admin.cgi
3# Hack interface to make specific changes to IPDB that (for one reason
4# or another) can't be made through the main interface.
5#
6###
7# SVN revision info
8# $Date: 2012-11-07 22:45:28 +0000 (Wed, 07 Nov 2012) $
9# SVN revision $Rev: 546 $
10# Last update by $Author: kdeugau $
11###
12# Copyright (C) 2004-2010 - Kris Deugau
13
14use strict;
15use warnings;
16use CGI::Carp qw(fatalsToBrowser);
17use CGI::Simple;
18use HTML::Template;
19use DBI;
20#use POSIX qw(ceil);
21use NetAddr::IP;
22
23use Sys::Syslog;
24
25# don't remove! required for GNU/FHS-ish install from tarball
26##uselib##
27
28use CustIDCK;
29use MyIPDB;
30
31openlog "IPDB-admin","pid","$IPDB::syslog_facility";
32
33# Collect the username from HTTP auth. If undefined, we're in a test environment.
34my $authuser;
35if (!defined($ENV{'REMOTE_USER'})) {
36 $authuser = '__temptest';
37} else {
38 $authuser = $ENV{'REMOTE_USER'};
39}
40
41syslog "debug", "$authuser active";
42
43# Set up the CGI object...
44my $q = new CGI::Simple;
45# ... and get query-string params as well as POST params if necessary
46$q->parse_query_string;
47
48# Convenience; saves changing all references to %webvar
49##fixme: tweak for handling <select multiple='y' size=3> (list with multiple selection)
50my %webvar = $q->Vars;
51
52# anyone got a better name? :P
53my $thingroot = $ENV{SCRIPT_FILENAME};
54$thingroot =~ s|cgi-bin/admin.cgi||;
55
56# Set up some globals
57$ENV{HTML_TEMPLATE_ROOT} = $thingroot."templates";
58
59# Why not a global DB handle? (And a global statement handle, as well...)
60# Use the connectDB function, otherwise we end up confusing ourselves
61my $ip_dbh;
62my $sth;
63my $errstr;
64($ip_dbh,$errstr) = connectDB_My;
65if (!$ip_dbh) {
66 $webvar{action} = "dberr";
67} else {
68 initIPDBGlobals($ip_dbh);
69}
70
71# handle DB error output
72if ($webvar{action} eq 'dberr') {
73 my $page = HTML::Template->new(filename => "admin/dberr.tmpl");
74 $page->param(errmsg => $errstr);
75 print "Content-Type: text/html\n\n".$page->output;
76 exit;
77}
78
79if ($IPDBacl{$authuser} !~ /A/) {
80 my $page = HTML::Template->new(filename => "admin/aclerr.tmpl");
81##fixme: need params for IPDB admin email and name
82 $page->param(ipdbadmin_email => 'ipdbadmin@example.com');
83 $page->param(ipdbadmin_name => 'the IPDB administrator');
84 print "Content-Type: text/html\n\n".$page->output;
85 exit;
86}
87
88my $header = HTML::Template->new(filename => "admin/header.tmpl");
89
90if(!defined($webvar{action})) {
91 $webvar{action} = "main"; #shuts up the warnings.
92}
93
94my $page;
95if (-e "$ENV{HTML_TEMPLATE_ROOT}/admin/$webvar{action}.tmpl") {
96 $page = HTML::Template->new(filename => "admin/$webvar{action}.tmpl");
97} else {
98 $page = HTML::Template->new(filename => "admin/dunno.tmpl");
99}
100
101# handle index page
102if ($webvar{action} eq 'main') {
103 $header->param(mainpage => 1);
104
105 my $tlist = getTypeList($ip_dbh, 'a');
106 $tlist->[0]->{sel} = 1;
107 $page->param(typelist => $tlist);
108
109 my $mlist = getMasterList($ip_dbh, 'm');
110 $page->param(masterlist => $mlist);
111}
112
113## Non-default actions.
114
115elsif ($webvar{action} eq 'alloc') {
116
117 my $cidr = new NetAddr::IP $webvar{cidr};
118 if (!$cidr || "$cidr" =~ /^0/) {
119 $page->param(errmsg => "Can't allocate something that's not a netblock/ip");
120 goto ERRJUMP;
121 }
122
123 my $custid = $def_custids{$webvar{alloctype}};
124 if ($custid eq '') {
125 # Crosscheck with billing.
126 my $status = CustIDCK->custid_exist($webvar{custid});
127 if ($CustIDCK::Error) {
128 $page->param(errmsg => "Error verifying customer ID: ".$CustIDCK::ErrMsg);
129 goto ERRJUMP;
130 }
131 if (!$status) {
132 $page->param(errmsg => "Customer ID not valid. Make sure the Customer ID ".
133 "is correct.<br>\nUse STAFF for staff static IPs, and $IPDB::defcustid for any other ".
134 "non-customer assignments.");
135 goto ERRJUMP;
136 }
137 # Type that doesn't have a default custid
138 $custid = $webvar{custid};
139 }
140
141 my $maskbits = $cidr->masklen;
142 my $fbtmp = findAllocateFrom($ip_dbh, $maskbits, $webvar{alloctype}, '','',
143 (gimme => "$cidr", allowpriv => 1));
144
145 if ($webvar{alloctype} eq 'rm') {
146 if (!$fbtmp) {
147 $page->param(errmsg => "Can't allocate from outside a free block!!");
148 goto ERRJUMP;
149 }
150 } elsif ($webvar{alloctype} =~ /^(.)i$/) {
151 my $iptype = $1;
152 my $ptmp = ipParent($ip_dbh, "$cidr");
153 if ($ptmp->{type} =~ /^(.)[dp]$/) {
154 my $newiptype = "$1i";
155 $fbtmp = $ptmp->{cidr};
156 if ($ptmp->{type} !~ /^$iptype./) {
157 $page->param(warnmsg => "Warning: Allocating IP as '".$disp_alloctypes{$newiptype}."' instead of '".
158 $disp_alloctypes{$webvar{alloctype}}."' to match pool $fbtmp\n");
159 $webvar{alloctype} = $newiptype;
160 }
161 }
162 if (!$fbtmp) {
163 $page->param(errmsg => "Can't allocate static IP from outside a pool!!");
164 goto ERRJUMP;
165 }
166 } else {
167 if (!$fbtmp) {
168 $page->param(errmsg => "Can't allocate from outside a routed block!!");
169 goto ERRJUMP;
170 }
171 }
172
173 my $alloc_from = new NetAddr::IP $fbtmp;
174
175 my @cities;
176 foreach my $city (@citylist) {
177 my %row = (city => $city);
178 push @cities, \%row;
179 }
180 $page->param(
181 cidr => $cidr,
182 disptype => $disp_alloctypes{$webvar{alloctype}},
183 type => $webvar{alloctype},
184 alloc_from => $alloc_from,
185 custid => $custid,
186 citylist => \@cities
187 );
188
189} elsif ($webvar{action} eq 'confirm') {
190
191 $page->param(
192 cidr => $webvar{cidr},
193 custid => $webvar{custid},
194 desc => $webvar{desc},
195 disptype => $disp_alloctypes{$webvar{alloctype}}
196 );
197 # Only need to check city here.
198 if ($webvar{city} eq '-') {
199 $page->param(locerr => "Invalid customer location! Go back and select customer's location.");
200 goto ERRJUMP;
201 }
202
203 my ($retcode,$msg) = allocateBlock($ip_dbh, $webvar{cidr}, $webvar{alloc_from},
204 $webvar{custid}, $webvar{alloctype}, $webvar{city}, $webvar{desc}, $webvar{notes},
205 $webvar{circid});
206 if ($retcode eq 'OK') {
207 syslog "notice", "$authuser allocated '$webvar{cidr}' to '$webvar{custid}' as ".
208 "'$webvar{alloctype}'";
209 if ($webvar{alloctype} =~ /^.i$/) {
210 mailNotify($ip_dbh, "a$webvar{alloctype}", "ADDED: $disp_alloctypes{$webvar{alloctype}} allocation",
211 "$disp_alloctypes{$webvar{alloctype}} $webvar{cidr} allocated to customer $webvar{custid}\n".
212 "Description: $webvar{desc}\n\nAllocated by: $authuser\n");
213 }
214 } else {
215 $page->param(errmsg => $msg);
216 syslog "err", "($authuser) Allocation of '$webvar{cidr}' to '$webvar{custid}' as ".
217 "'$webvar{alloctype}' failed: '$msg'";
218 }
219
220} elsif ($webvar{action} eq 'alloctweak') {
221
222 fix_allocfrom();
223 showAllocs($webvar{allocfrom});
224
225} elsif ($webvar{action} eq 'update') {
226
227 update();
228
229} elsif ($webvar{action} eq 'touch') {
230
231 $page->param(master => $webvar{whichmaster});
232 $sth = $ip_dbh->prepare("update masterblocks set mtime=now() where cidr='$webvar{whichmaster}'");
233 $sth->execute;
234 if ($sth->err) {
235 $page->param(errmsg => $sth->errstr);
236 }
237
238} elsif ($webvar{action} eq 'listcust') {
239
240 $sth = $ip_dbh->prepare("select custid,name,tech_handle from customers order by custid");
241 $sth->execute;
242 my @custlist;
243 while (my @data = $sth->fetchrow_array) {
244 my %row = (
245 custid => $data[0],
246 custname => $data[1],
247 tech => $data[2]
248 );
249 push @custlist, \%row;
250 }
251 $page->param(custlist => \@custlist);
252
253} elsif ($webvar{action} eq 'edcust') {
254
255 if ($webvar{newcust}) {
256 $sth = $ip_dbh->prepare("INSERT INTO customers (custid) VALUES (?)");
257 $sth->execute($webvar{custid});
258 }
259 $sth = $ip_dbh->prepare("select custid,name,street,city,province,".
260 "country,pocode,phone,tech_handle,abuse_handle,admin_handle,special ".
261 "from customers where custid='$webvar{custid}'");
262 $sth->execute;
263 my ($custid, $name, $street, $city, $prov, $country, $pocode, $phone, $tech, $abuse, $admin, $special) =
264 $sth->fetchrow_array;
265
266 $page->param(
267 custid => $custid,
268 name => $name,
269 street => $street,
270 city => $city,
271 prov => $prov,
272 country => $country,
273 pocode => $pocode,
274 phone => $phone,
275 tech => $tech,
276 abuse => $abuse,
277 admin => $admin,
278 special => $special
279 );
280
281} elsif ($webvar{action} eq 'updcust') {
282
283 $sth = $ip_dbh->prepare("UPDATE customers SET".
284 " name=?, street=?, city=?, province=?, country=?, pocode=?,".
285 " phone=?, tech_handle=?, abuse_handle=?, admin_handle=?, special=?".
286 " WHERE custid=?");
287 $sth->execute($webvar{name}, $webvar{street}, $webvar{city}, $webvar{province},
288 $webvar{country}, $webvar{pocode}, $webvar{phone}, $webvar{tech_handle},
289 $webvar{abuse_handle}, $webvar{admin_handle}, $webvar{special}, $webvar{custid});
290 $page->param(
291 custid => $webvar{custid},
292 name => $webvar{name},
293 street => $webvar{street},
294 city => $webvar{city},
295 prov => $webvar{province},
296 country => $webvar{country},
297 pocode => $webvar{pocode},
298 phone => $webvar{phone},
299 tech => $webvar{tech_handle},
300 abuse => $webvar{abuse_handle},
301 admin => $webvar{admin_handle},
302 special => $webvar{special}
303 );
304
305} elsif ($webvar{action} eq 'showpools') {
306
307 $sth = $ip_dbh->prepare("select pool, count(*) from poolips where available='y' group by pool order by pool");
308 $sth->execute;
309 my @poollist;
310 while (my ($pool,$free) = $sth->fetchrow_array) {
311 my %row = (
312 pool => $pool,
313 free => $free
314 );
315 push @poollist, \%row;
316 }
317 $page->param(poollist => \@poollist);
318
319} elsif ($webvar{action} eq 'tweakpool') {
320
321 showPool($webvar{pool});
322
323} elsif ($webvar{action} eq 'updatepool') {
324
325 $sth = $ip_dbh->prepare("update poolips set custid='$webvar{custid}', ".
326 "city=?, type='$webvar{type}', available='".
327 (($webvar{available} eq 'y') ? 'y' : 'n').
328 "', notes=?, description=? ".
329 "where ip='$webvar{ip}'");
330 $sth->execute($webvar{city},$webvar{notes},$webvar{desc});
331 $page->param(ip => $webvar{ip});
332 if ($sth->err) {
333 $page->param(errmsg => $sth->errstr);
334 syslog "err", "$authuser could not update pool IP $webvar{ip}: ".$sth->errstr;
335 } else {
336 syslog "notice", "$authuser updated pool IP $webvar{ip}";
337 }
338 $sth = $ip_dbh->prepare("select pool from poolips where ip='$webvar{ip}'");
339 $sth->execute;
340 my @data = $sth->fetchrow_array;
341 $page->param(pool => $data[0]);
342
343} elsif ($webvar{action} eq 'showusers') {
344
345 $sth = $ip_dbh->prepare("select username,acl from users order by username");
346 $sth->execute;
347 my @userlist;
348 while (my ($username,$acl) = $sth->fetchrow_array) {
349##fixme: funky things happening with HTML::Template here; shouldn't need the "logic ? iftrue : iffalse" structure
350 my %row = (
351 username => $username,
352 can_add => ($acl =~ /a/ ? 1 : 0),
353 can_change => ($acl =~ /c/ ? 1 : 0),
354 can_del => ($acl =~ /d/ ? 1 : 0),
355 sysnet => ($acl =~ /s/ ? 1 : 0),
356 is_admin => ($acl =~ /A/ ? 1 : 0),
357 acl => $acl
358 );
359 push @userlist, \%row;
360 }
361 $page->param(userlist => \@userlist);
362
363} elsif ($webvar{action} eq 'updacl') {
364
365 $page->param(username => $webvar{username});
366 my $acl = 'b';
367 if ($webvar{admin} eq 'on') {
368 $acl .= "acdsA";
369 } else {
370 $acl .= ($webvar{add} eq 'on' ? 'a' : '').
371 ($webvar{change} eq 'on' ? 'c' : '').
372 ($webvar{del} eq 'on' ? 'd' : '').
373 ($webvar{sysnet} eq 'on' ? 's' : '');
374 }
375 $page->param(acl => $acl);
376
377 $sth = $ip_dbh->prepare("update users set acl='$acl' where username='$webvar{username}'");
378 $sth->execute;
379 $page->param(errmsg => $sth->errstr) if $sth->err;
380
381} elsif ($webvar{action} eq 'newuser') {
382
383 $page->param(username => $webvar{username});
384 my $cr_pass = ($webvar{preenc} ? $webvar{password} :
385 crypt $webvar{password}, join('',('.','/',0..9,'A'..'Z','a'..'z')[rand 64, rand 64]));
386 $sth = $ip_dbh->prepare("insert into users (username,password,acl) values ".
387 "('$webvar{username}','$cr_pass','b')");
388 $sth->execute;
389 $page->param(errmsg => $sth->errstr) if $sth->err;
390
391} elsif ($webvar{action} eq 'deluser') {
392
393 $page->param(username => $webvar{username});
394 $sth = $ip_dbh->prepare("delete from users where username='$webvar{username}'");
395 $sth->execute;
396 $page->param(errmsg => $sth->errstr) if $sth->err;
397
398} elsif ($webvar{action} eq 'emailnotice') {
399
400 $sth = $ip_dbh->prepare("SELECT action,reciplist FROM notify");
401 $sth->execute;
402 my @spamlist;
403 while (my ($notice_code,$reciplist) = $sth->fetchrow_array() ) {
404##fixme: hairy mess, only a few things call mailNotify() anyway, so many possible notices won't work.
405 my $action_out = dispNoticeCode($notice_code);
406 my %row = (
407 action => $action_out,
408 code => $notice_code,
409 recips => $reciplist
410 );
411 push @spamlist, \%row;
412 }
413 $page->param(spamlist => \@spamlist);
414
415 $sth = $ip_dbh->prepare("SELECT type,dispname FROM alloctypes WHERE listorder < 500 ".
416 "ORDER BY listorder");
417 $sth->execute;
418 my $i=0;
419 my @typelist;
420 while (my ($type,$disp) = $sth->fetchrow_array) {
421 my %row = (
422 type => $type,
423 disptype => $disp,
424# ahh, off-by-one counts, how we do love thee... NOT!
425 newrow => ($i+2 > $sth->rows ? 1 : (++$i % 4)),
426 );
427 push @typelist, \%row;
428 }
429 $page->param(typelist => \@typelist);
430
431} elsif ($webvar{action} eq 'addnotice') {
432
433 $webvar{alloctype} = $webvar{special} if $webvar{msgaction} eq 's:';
434 if ($webvar{msgaction} && $webvar{alloctype} && $webvar{reciplist}) {
435 $page->param(cantry => 1);
436 $webvar{reciplist} =~ s/[\r\n]+/,/g;
437 $webvar{msgaction} = "f:$webvar{msgaction}" if $webvar{onfail};
438 $page->param(reciplist => $webvar{reciplist});
439 $page->param(dispnotice => dispNoticeCode($webvar{msgaction}.$webvar{alloctype}));
440 $sth = $ip_dbh->prepare("INSERT INTO notify (action, reciplist) VALUES (?,?)");
441##fixme: automagically merge reciplists iff action already exists
442 $sth->execute($webvar{msgaction}.$webvar{alloctype}, $webvar{reciplist});
443 $page->param(addfailed => $sth->errstr) if $sth->err;
444 }
445
446} elsif ($webvar{action} eq 'delnotice') {
447
448 $page->param(dispnotice => dispNoticeCode($webvar{code}.$webvar{alloctype}));
449 $sth = $ip_dbh->prepare("DELETE FROM notify WHERE action=?");
450 $sth->execute($webvar{code});
451 $page->param(delfailed => $sth->errstr) if $sth->err;
452
453} elsif ($webvar{action} eq 'ednotice') {
454
455 $page->param(dispnotice => dispNoticeCode($webvar{code}));
456 $page->param(code => $webvar{code});
457 $sth = $ip_dbh->prepare("SELECT reciplist FROM notify WHERE action=?");
458 $sth->execute($webvar{code});
459 my ($reciplist) = $sth->fetchrow_array;
460 $reciplist =~ s/,/\n/g;
461 $page->param(reciplist => $reciplist);
462
463} elsif ($webvar{action} eq 'updnotice') {
464
465 $page->param(dispnotice => dispNoticeCode($webvar{code}));
466 $sth = $ip_dbh->prepare("UPDATE notify SET reciplist=? WHERE action=?");
467 $webvar{reciplist} =~ s/[\r\n]+/,/g;
468 $sth->execute($webvar{reciplist}, $webvar{code});
469 $page->param(updfailed => $sth->errstr) if $sth->err;
470
471} elsif ($webvar{action} ne '<NULL>') {
472 $page->param(dunno => $webvar{action});
473}
474
475ERRJUMP: print "Content-type: text/html\n\n".$header->output;
476print $page->output;
477
478##fixme: make me a footer param!
479print qq(<hr><div><a href="$IPDB::webpath/">Back</a> to main interface</div>\n);
480
481# We print the footer here, so we don't have to do it elsewhere.
482my $footer = HTML::Template->new(filename => "footer.tmpl");
483# we're already in the admin tools, no need to provide a bottom link. maybe.
484#$footer->param(adminlink => ($IPDBacl{$authuser} =~ /A/));
485
486print $footer->output;
487
488$ip_dbh->disconnect;
489
490exit;
491
492
493# Hokay. This is a little different. We have a few specific functions here:
494# -> Assign arbitrary subnet from arbitrary free space
495# -> Tweak individual DB fields
496#
497
498
499# Tweak allocfrom into shape.
500sub fix_allocfrom {
501 if ($webvar{allocfrom} =~ /^(\d+\.){2}\d+$/) {
502 # 3-octet class C specified
503 $webvar{allocfrom} .= ".0/24";
504 } elsif ($webvar{allocfrom} =~ /^(\d+\.){3}\d+$/) {
505 # 4-octet IP specified;
506 $webvar{allocfrom} .= "/24";
507 }
508}
509
510
511# Show allocations to allow editing.
512sub showAllocs {
513
514 my $within = new NetAddr::IP $_[0];
515 $page->param(within => $within);
516
517 $sth = $ip_dbh->prepare("select cidr,custid,type,city,description from allocations where cidr <<= '$within' order by cidr");
518 $sth->execute;
519 my @blocklist;
520 while (my ($cidr,$custid,$type,$city,$desc) = $sth->fetchrow_array) {
521 my %row = (
522 cidr => $cidr,
523 custid => $custid,
524 city => $city,
525 desc => $desc,
526 );
527
528##fixme: don't wanna retrieve the whole type list *every time around the outer loop*
529 my $sth2 = $ip_dbh->prepare("select type,listname from alloctypes".
530 " where listorder < 500 and not (type like '_i') order by listorder");
531 $sth2->execute;
532 my @typelist;
533 while (my ($listtype,$dispname) = $sth2->fetchrow_array) {
534 my %subrow = (
535 type => $listtype,
536 dispname => $dispname,
537 selected => ($listtype eq $type)
538 );
539 push @typelist, \%subrow;
540 }
541 $row{typelist} = \@typelist;
542 push @blocklist, \%row;
543 }
544 $page->param(blocklist => \@blocklist);
545} # end showAllocs()
546
547
548# Stuff updates into DB
549sub update {
550 # Relatively simple SQL transaction here. Note that we're deliberately NOT
551 # updating notes/desc here as it's available through the main interface.
552 $sth = $ip_dbh->prepare("update allocations set custid='$webvar{custid}',".
553 "city=?,type='$webvar{alloctype}' where cidr='$webvar{block}'");
554 $sth->execute($webvar{city});
555
556 $page->param(block => $webvar{block});
557 if ($sth->err) {
558 $page->param(updfailed => $sth->errstr);
559 syslog "err", "$authuser could not update block '$webvar{block}': '".$sth->errstr."'";
560 } else {
561 syslog "notice", "$authuser updated $webvar{block}";
562 }
563 # need to get /24 that block is part of
564 my @bits = split /\./, $webvar{block};
565 $bits[3] = "0/24";
566 showAllocs((join ".", @bits));
567} # end update()
568
569
570# showPool()
571# List all IPs in a pool, and allow arbitrary admin changes to each
572# Allow changes to ALL fields
573sub showPool($) {
574 my $pool = new NetAddr::IP $_[0];
575
576 $sth = $ip_dbh->prepare("select type,listname from alloctypes where type like '_i' order by listorder");
577 $sth->execute;
578 my @typelist;
579 while (my ($type,$dispname) = $sth->fetchrow_array) {
580 my %row = (
581 type => $type,
582 dispname => $dispname
583 );
584 push @typelist, \%row;
585 }
586 $page->param(typelist => \@typelist);
587
588 $sth = $ip_dbh->prepare("select ip,custid,city,type,available,description,notes from poolips where pool='$pool' order by ip");
589 $sth->execute;
590 my @iplist;
591 while (my ($ip,$custid,$city,$type,$avail,$desc,$notes) = $sth->fetchrow_array) {
592 my %row = (
593 ip => $ip,
594 custid => $custid,
595 city => $city,
596 type => $type,
597 avail => $avail,
598 desc => $desc,
599 notes => $notes
600 );
601 push @iplist, \%row;
602 }
603 $page->param(iplist => \@iplist);
604} # end showPool()
605
606
607# interpret the notify codes
608sub dispNoticeCode {
609 my $code = shift;
610 my $action_out = '';
611
612 if ($code =~ /^s:/) {
613 $code =~ s/^s:/Special: /;
614 return $code;
615 }
616 if ($code =~ /^f:(.+)$/) {
617 $code =~ s/^f://;
618 $action_out = "Failure on ";
619 }
620 if (my $target = $code =~ /^n(.+)/) {
621 $action_out .= "New ";
622 if ($1 eq 'ci') { $action_out .= "city"; }
623 elsif ($1 eq 'no') { $action_out .= "node"; }
624 else { $action_out .= '&lt;unknown&gt;'; }
625 } else {
626 my ($action,$target) = ($code =~ /^(.)(.+)$/);
627 if ($action eq 'a') { $action_out .= 'Add '; }
628 elsif ($action eq 'u') { $action_out .= 'Update '; }
629 elsif ($action eq 'd') { $action_out .= 'Delete '; }
630##fixme: what if we get something funky?
631# What about the eleventy-billion odd combinations possible?
632# this should give an idea of the structure tho
633 if ($target eq 'a') { $action_out .= "all"; }
634 elsif ($target eq '.i') {
635 $action_out .= "all static IPs";
636 }
637 else { $action_out .= $disp_alloctypes{$target}; }
638 }
639 return $action_out;
640}
Note: See TracBrowser for help on using the repository browser.