mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 14:13:29 +00:00
ui-lib and strict conversion
This commit is contained in:
384
squid/acl.cgi
384
squid/acl.cgi
@@ -2,17 +2,26 @@
|
||||
# acl.cgi
|
||||
# Display a form for editing or creating a new ACL
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
our (%text, %in, %access, $squid_version, %config, %acl_types,
|
||||
@caseless_acl_types);
|
||||
require './squid-lib.pl';
|
||||
$access{'actrl'} || &error($text{'eacl_ecannot'});
|
||||
&ReadParse();
|
||||
$conf = &get_config();
|
||||
my $conf = &get_config();
|
||||
|
||||
my $type;
|
||||
my (@acl, @deny, @vals, $file);
|
||||
if ($in{'type'}) {
|
||||
&ui_print_header(undef, $text{'acl_header1'}, "", undef, 0, 0, 0, &restart_button());
|
||||
&ui_print_header(undef, $text{'acl_header1'}, "", undef, 0, 0, 0,
|
||||
&restart_button());
|
||||
$type = $in{'type'};
|
||||
@vals = ( );
|
||||
}
|
||||
else {
|
||||
&ui_print_header(undef, $text{'acl_header2'}, "", undef, 0, 0, 0, &restart_button());
|
||||
&ui_print_header(undef, $text{'acl_header2'}, "", undef, 0, 0, 0,
|
||||
&restart_button());
|
||||
@acl = @{$conf->[$in{'index'}]->{'values'}};
|
||||
$type = $acl[1];
|
||||
if (($type eq "external" ||
|
||||
@@ -31,9 +40,7 @@ else {
|
||||
@vals = @acl[2..$#acl];
|
||||
}
|
||||
if ($file) {
|
||||
open(FILE, $file);
|
||||
chop(@newvals = <FILE>);
|
||||
close(FILE);
|
||||
my @newvals = split(/\r?\n/, &read_file_contents($file));
|
||||
push(@vals, @newvals);
|
||||
}
|
||||
if ($type =~ /^(src|dst|srcdomain|dstdomain|user|myip)$/) {
|
||||
@@ -46,27 +53,27 @@ else {
|
||||
&find_config("deny_info", $conf);
|
||||
}
|
||||
|
||||
print "<form action=acl_save.cgi method=post enctype=multipart/form-data>\n";
|
||||
print &ui_form_start("acl_save.cgi", "form-data");
|
||||
if (@acl) {
|
||||
print "<input type=hidden name=index value=$in{'index'}>\n";
|
||||
print &ui_hidden("index", $in{'index'});
|
||||
}
|
||||
if (@deny) {
|
||||
print "<input type=hidden name=dindex value=$deny[0]->{'index'}>\n";
|
||||
print &ui_hidden("dindex", $deny[0]->{'index'});
|
||||
}
|
||||
print "<input type=hidden name=type value=$type>\n";
|
||||
print "<table border>\n";
|
||||
print "<tr $tb> <td><b>$acl_types{$type} ACL</b></td> </tr>\n";
|
||||
print "<tr $cb> <td><table>\n";
|
||||
print &ui_hidden("type", $type);
|
||||
print &ui_table_start("$acl_types{$type} ACL", undef, 2);
|
||||
|
||||
print "<tr> <td nowrap><b>$text{'acl_name'}</b></td>\n";
|
||||
print "<td><input name=name size=20 value=\"$acl[0]\"></td>\n";
|
||||
# ACL name
|
||||
print &ui_table_row($text{'acl_name'},
|
||||
&ui_textbox("name", $acl[0], 30));
|
||||
|
||||
if ($type eq "src" || $type eq "dst") {
|
||||
print "<tr> <td colspan=2><table>\n";
|
||||
print "<tr> <td><b>$text{'acl_fromip'}</b></td> ",
|
||||
"<td><b>$text{'acl_toip'}</b></td>\n";
|
||||
print " <td><b>$text{'acl_nmask'}</b></td> </tr>\n";
|
||||
for($i=0; $i<=@vals; $i++) {
|
||||
# By source or dest address/network
|
||||
my $table = &ui_columns_start([ $text{'acl_fromip'},
|
||||
$text{'acl_toip'},
|
||||
$text{'acl_nmask'} ]);
|
||||
for(my $i=0; $i<=@vals; $i++) {
|
||||
my ($from, $to, $mask) = @_;
|
||||
if ($vals[$i] =~ /^([a-z0-9\.\:]+)-([a-z0-9\.\:]+)\/([\d\.]+)$/) {
|
||||
$from = $1; $to = $2; $mask = $3;
|
||||
}
|
||||
@@ -80,276 +87,247 @@ if ($type eq "src" || $type eq "dst") {
|
||||
$from = $1; $to = ""; $mask = "";
|
||||
}
|
||||
else { $from = $to = $mask = ""; }
|
||||
print "<tr>\n";
|
||||
print "<td><input name=from_$i size=15 value=\"$from\"></td>\n";
|
||||
print "<td><input name=to_$i size=15 value=\"$to\"></td>\n";
|
||||
print "<td><input name=mask_$i size=15 value=\"$mask\"></td>\n";
|
||||
print "</tr>\n";
|
||||
$table .= &ui_columns_row([
|
||||
&ui_textbox("from_$i", $from, 20),
|
||||
&ui_textbox("to_$i", $to, 20),
|
||||
&ui_textbox("mask_$i", $mask, 20),
|
||||
]);
|
||||
}
|
||||
print "</table></td> </tr>\n";
|
||||
$table .= &ui_columns_end();
|
||||
print &ui_table_row(undef, $table, 2);
|
||||
}
|
||||
elsif ($type eq "myip") {
|
||||
print "<tr> <td colspan=2><table>\n";
|
||||
print "<tr> <td><b>$text{'acl_ipaddr'}</b></td> ",
|
||||
"<td><b>$text{'acl_nmask'}</b></td> </tr>\n";
|
||||
for($i=0; $i<=@vals; $i++) {
|
||||
# By local IP address
|
||||
my $table = &ui_columns_start([ $text{'acl_ipaddr'},
|
||||
$text{'acl_nmask'} ]);
|
||||
for(my $i=0; $i<=@vals; $i++) {
|
||||
my ($ip, $mask);
|
||||
if ($vals[$i] =~ /^([a-z0-9\.\:]+)\/([\d\.]+)$/) {
|
||||
$ip = $1; $mask = $2;
|
||||
}
|
||||
else { $ip = $mask = ""; }
|
||||
print "<tr>\n";
|
||||
print "<td><input name=ip_$i size=15 value=\"$ip\"></td>\n";
|
||||
print "<td><input name=mask_$i size=15 value=\"$mask\"></td>\n";
|
||||
print "</tr>\n";
|
||||
$table .= &ui_columns_row([
|
||||
&ui_textbox("ip_$i", $ip, 20),
|
||||
&ui_textbox("mask_$i", $mask, 20),
|
||||
]);
|
||||
}
|
||||
print "</table></td> </tr>\n";
|
||||
$table .= &ui_columns_end();
|
||||
print &ui_table_row(undef, $table, 2);
|
||||
}
|
||||
elsif ($type eq "srcdomain") {
|
||||
print "<tr> <td valign=top><b>$text{'acl_domains'}</b></td>\n";
|
||||
print "<td><textarea name=vals rows=6 cols=40>",join("\n", @vals),
|
||||
"</textarea></td> </tr>\n";
|
||||
}
|
||||
elsif ($type eq "dstdomain") {
|
||||
print "<tr> <td valign=top><b>$text{'acl_domains'}</b></td>\n";
|
||||
print "<td><textarea name=vals rows=6 cols=40>",join("\n", @vals),
|
||||
"</textarea></td> </tr>\n";
|
||||
elsif ($type eq "srcdomain" || $type eq "dstdomain") {
|
||||
# Source or destination domain
|
||||
print &ui_table_row($text{'acl_domains'},
|
||||
&ui_textarea("vals", join("\n", @vals), 6, 60));
|
||||
}
|
||||
elsif ($type eq "time") {
|
||||
local $vals = join(' ', @vals);
|
||||
# Day or week and time of day
|
||||
my $vals = join(' ', @vals);
|
||||
my %day;
|
||||
if ($vals =~ /[A-Z]+/) {
|
||||
foreach $d (split(//, $vals)) {
|
||||
foreach my $d (split(//, $vals)) {
|
||||
$day{$d}++;
|
||||
}
|
||||
}
|
||||
my ($h1, $h2, $m1, $m2, $hour);
|
||||
if ($vals =~ /(\d+):(\d+)-(\d+):(\d+)/) {
|
||||
$h1 = $1; $m1 = $2;
|
||||
$h2 = $3; $m2 = $4;
|
||||
$hour++;
|
||||
}
|
||||
print "<tr> <td valign=top><b>$text{'acl_dofw'}</b></td> <td>\n";
|
||||
printf "<input type=radio name=day_def value=1 %s> $text{'acl_all'}\n",
|
||||
%day ? "" : "checked";
|
||||
printf "<input type=radio name=day_def value=0 %s> $text{'acl_sel'}<br>\n",
|
||||
%day ? "checked" : "";
|
||||
%day_name = ( 'S', $text{'acl_dsun'},
|
||||
'M', $text{'acl_dmon'},
|
||||
'T', $text{'acl_dtue'},
|
||||
'W', $text{'acl_dwed'},
|
||||
'H', $text{'acl_dthu'},
|
||||
'F', $text{'acl_dfri'},
|
||||
'A', $text{'acl_dsat'} );
|
||||
print "<select name=day multiple size=7>\n";
|
||||
foreach $d ('S', 'M', 'T', 'W', 'H', 'F', 'A') {
|
||||
printf "<option value=$d %s>$day_name{$d}</option>\n",
|
||||
$day{$d} ? "selected" : "";
|
||||
}
|
||||
print "</select></td> </tr>\n";
|
||||
my @day_name = ( [ 'S', $text{'acl_dsun'} ],
|
||||
[ 'M', $text{'acl_dmon'} ],
|
||||
[ 'T', $text{'acl_dtue'} ],
|
||||
[ 'W', $text{'acl_dwed'} ],
|
||||
[ 'H', $text{'acl_dthu'} ],
|
||||
[ 'F', $text{'acl_dfri'} ],
|
||||
[ 'A', $text{'acl_dsat'} ] );
|
||||
print &ui_table_row($text{'acl_dofw'},
|
||||
&ui_radio("day_def", %day ? 0 : 1,
|
||||
[ [ 1, $text{'acl_all'} ],
|
||||
[ 0, $text{'acl_sel'} ] ])."<br>\n".
|
||||
&ui_select("day", [ keys %day ], \@day_name,
|
||||
7, 1));
|
||||
|
||||
print "<tr> <td valign=top><b>$text{'acl_hofd'}</b></td> <td>\n";
|
||||
printf "<input type=radio name=hour_def value=1 %s> $text{'acl_all'}\n",
|
||||
$hour ? "" : "checked";
|
||||
printf " <input type=radio name=hour_def value=0 %s>\n",
|
||||
$hour ? "checked" : "";
|
||||
print "<input name=h1 size=2 value=\"$h1\">:";
|
||||
print "<input name=m1 size=2 value=\"$m1\"> $text{'acl_to'} ";
|
||||
print "<input name=h2 size=2 value=\"$h2\">:";
|
||||
print "<input name=m2 size=2 value=\"$m2\"></td> </tr>\n";
|
||||
print &ui_table_row($text{'acl_hofd'},
|
||||
&ui_radio("hour_def", $hour ? 0 : 1,
|
||||
[ [ 1, $text{'acl_all'} ],
|
||||
[ 0, &ui_textbox("h1", $h1, 2).":".
|
||||
&ui_textbox("m1", $m1, 2)." $text{'acl_to'} ".
|
||||
&ui_textbox("h2", $h2, 2).":".
|
||||
&ui_textbox("m2", $m2, 2) ] ]));
|
||||
}
|
||||
elsif ($type eq "url_regex") {
|
||||
print "<tr> <td valign=top><b>$text{'acl_regexp'}</b></td>\n";
|
||||
local $caseless;
|
||||
elsif ($type eq "url_regex" || $type eq "urlpath_regex") {
|
||||
# URL regular expression
|
||||
my $caseless;
|
||||
if ($vals[0] eq '-i') {
|
||||
$caseless++;
|
||||
shift(@vals);
|
||||
}
|
||||
printf "<td><input type=checkbox name=caseless value=1 %s> %s<br>\n",
|
||||
$caseless ? 'checked' : '', $text{'acl_case'};
|
||||
print "<textarea name=vals rows=6 cols=40>",join("\n", @vals),
|
||||
"</textarea></td> </tr>\n";
|
||||
}
|
||||
elsif ($type eq "urlpath_regex") {
|
||||
print "<tr> <td valign=top><b>$text{'acl_regexp'}</b></td>\n";
|
||||
local $caseless;
|
||||
if ($vals[0] eq '-i') {
|
||||
$caseless++;
|
||||
shift(@vals);
|
||||
}
|
||||
printf "<td><input type=checkbox name=caseless value=1 %s> %s<br>\n",
|
||||
$caseless ? 'checked' : '', $text{'acl_case'};
|
||||
print "<textarea name=vals rows=6 cols=40>",join("\n", @vals),
|
||||
"</textarea></td> </tr>\n";
|
||||
print &ui_table_row($text{'acl_regexp'},
|
||||
&ui_checkbox("caseless", 1, $text{'acl_case'}, $caseless).
|
||||
"<br>\n".
|
||||
&ui_textarea("vals", join("\n", @vals), 6, 60));
|
||||
}
|
||||
elsif ($type eq "port") {
|
||||
print "<tr> <td valign=top><b>$text{'acl_tcpports'}</b></td>\n";
|
||||
printf "<td><input name=vals size=30 value=\"%s\"></td> </tr>\n",
|
||||
join(" ", @vals);
|
||||
# Request port number
|
||||
print &ui_table_row($text{'acl_tcpports'},
|
||||
&ui_textbox("vals", join(" ", @vals), 60));
|
||||
}
|
||||
elsif ($type eq "proto") {
|
||||
print "<tr> <td valign=top><b>$text{'acl_urlproto'}</b></td> <td>\n";
|
||||
foreach $p (@vals) { $proto{$p}++; }
|
||||
foreach $p ('http', 'ftp', 'gopher', 'wais', 'cache_object') {
|
||||
printf "<input type=checkbox name=vals value=$p %s> $p\n",
|
||||
$proto{$p} ? "checked" : "";
|
||||
}
|
||||
print "</td> </tr>\n";
|
||||
# Request protocol
|
||||
my %proto = map { $_, 1 } @vals;
|
||||
print &ui_table_row($text{'acl_urlproto'},
|
||||
join(" ", map { &ui_checkbox("vals", $_, $_, $proto{$_}) }
|
||||
('http', 'ftp', 'gopher', 'wais', 'cache_object')));
|
||||
}
|
||||
elsif ($type eq "method") {
|
||||
print "<tr> <td valign=top><b>$text{'acl_reqmethods'}</b></td> <td>\n";
|
||||
foreach $m (@vals) { $meth{$m}++; }
|
||||
foreach $m ('GET', 'POST', 'HEAD', 'CONNECT', 'PUT', 'DELETE') {
|
||||
printf "<input type=checkbox name=vals value=$m %s> $m\n",
|
||||
$meth{$m} ? "checked" : "";
|
||||
}
|
||||
print "</td> </tr>\n";
|
||||
# HTTP method
|
||||
my %meth = map { $_, 1 } @vals;
|
||||
print &ui_table_row($text{'acl_reqmethods'},
|
||||
join(" ", map { &ui_checkbox("vals", $_, $_, $meth{$_}) }
|
||||
('GET', 'POST', 'HEAD', 'CONNECT', 'PUT', 'DELETE')));
|
||||
}
|
||||
elsif ($type eq "browser") {
|
||||
print "<tr> <td valign=top><b>$text{'acl_bregexp'}</b></td>\n";
|
||||
printf "<td><input name=vals size=30 value=\"%s\"></td> </tr>\n",
|
||||
join(' ', @vals);
|
||||
# Browser user agent
|
||||
print &ui_table_row($text{'acl_bregexp'},
|
||||
&ui_textbox("vals", join(" ", @vals), 60));
|
||||
}
|
||||
elsif ($type eq "user") {
|
||||
print "<tr> <td valign=top><b>$text{'acl_pusers'}</b></td>\n";
|
||||
print "<td><textarea name=vals rows=6 cols=40 wrap>",
|
||||
join("\n", @vals),"</textarea></td> </tr>\n";
|
||||
# Proxy usernames
|
||||
print &ui_table_row($text{'acl_pusers'},
|
||||
&ui_textarea("vals", join("\n", @vals), 6, 60));
|
||||
}
|
||||
elsif ($type eq "src_as" || $type eq "dst_as") {
|
||||
print "<tr> <td valign=top><b>$text{'acl_asnum'}</b></td>\n";
|
||||
printf "<td><input name=vals size=20 value=\"%s\"></td> </tr>\n",
|
||||
join(' ', @vals);
|
||||
# Source or destination AS number
|
||||
print &ui_table_row($text{'acl_asnum'},
|
||||
&ui_textbox("vals", join(" ", @vals), 20));
|
||||
}
|
||||
elsif ($type eq "proxy_auth" && $squid_version < 2.3) {
|
||||
print "<tr> <td valign=top><b>$text{'acl_rtime'}</b></td>\n";
|
||||
print "<td><input name=vals size=8 value=\"$vals[0]\"></td> </tr>\n";
|
||||
# Refresh time
|
||||
print &ui_table_row($text{'acl_rtime'},
|
||||
&ui_textbox("vals", $vals[0], 8));
|
||||
}
|
||||
elsif ($type eq "proxy_auth" && $squid_version >= 2.3) {
|
||||
print "<tr> <td valign=top><b>$text{'acl_eusers'}</b></td>\n";
|
||||
printf "<td><input type=radio name=authall value=1 %s> %s\n",
|
||||
$vals[0] eq 'REQUIRED' || $in{'type'} ? "checked" : "",
|
||||
$text{'acl_eusersall'};
|
||||
printf "<input type=radio name=authall value=0 %s> %s<br>\n",
|
||||
$vals[0] eq 'REQUIRED' || $in{'type'} ? "" : "checked",
|
||||
$text{'acl_euserssel'};
|
||||
print "<textarea name=vals rows=6 cols=40 wrap>",
|
||||
$vals[0] eq 'REQUIRED' || $in{'type'} ? "" : join("\n", @vals),
|
||||
"</textarea></td> </tr>\n";
|
||||
# Proxy username
|
||||
print &ui_table_row($text{'acl_eusers'},
|
||||
&ui_radio("authall",
|
||||
$vals[0] eq 'REQUIRED' || $in{'type'} ? 1 : 0,
|
||||
[ [ 1, $text{'acl_eusersall'} ],
|
||||
[ 0, $text{'acl_euserssel'} ] ])."<br>\n".
|
||||
&ui_textarea("vals", $vals[0] eq 'REQUIRED' || $in{'type'} ?
|
||||
"" : join("\n", @vals), 6, 60));
|
||||
}
|
||||
elsif ($type eq "proxy_auth_regex") {
|
||||
print "<tr> <td valign=top><b>$text{'acl_eusers'}</b></td>\n";
|
||||
local $caseless;
|
||||
# Username regexp
|
||||
my $caseless;
|
||||
if ($vals[0] eq '-i') {
|
||||
$caseless++;
|
||||
shift(@vals);
|
||||
}
|
||||
printf "<td><input type=checkbox name=caseless value=1 %s> %s<br>\n",
|
||||
$caseless ? 'checked' : '', $text{'acl_case'};
|
||||
print "<textarea name=vals rows=6 cols=40 wrap>",
|
||||
join("\n", @vals),"</textarea></td> </tr>\n";
|
||||
print &ui_table_row($text{'acl_eusers'},
|
||||
&ui_checkbox("caseless", 1, $text{'acl_case'}, $caseless).
|
||||
"<br>\n".
|
||||
&ui_textarea("vals", join("\n", @vals), 6, 60));
|
||||
}
|
||||
elsif ($type eq "srcdom_regex" || $type eq "dstdom_regex") {
|
||||
print "<tr> <td valign=top><b>$text{'acl_regexp'}</b></td>\n";
|
||||
local $caseless;
|
||||
# Source or destination domain regexp
|
||||
my $caseless;
|
||||
if ($vals[0] eq '-i') {
|
||||
$caseless++;
|
||||
shift(@vals);
|
||||
}
|
||||
printf "<td><input type=checkbox name=caseless value=1 %s> %s<br>\n",
|
||||
$caseless ? 'checked' : '', $text{'acl_case'};
|
||||
print "<textarea name=vals rows=6 cols=40>",join("\n", @vals),
|
||||
"</textarea></td> </tr>\n";
|
||||
print &ui_table_row($text{'acl_regexp'},
|
||||
&ui_checkbox("caseless", 1, $text{'acl_case'}, $caseless).
|
||||
"<br>\n".
|
||||
&ui_textarea("vals", join("\n", @vals), 6, 60));
|
||||
}
|
||||
elsif ($type eq "ident") {
|
||||
print "<tr> <td valign=top><b>$text{'acl_rfcusers'}</b></td>\n";
|
||||
print "<td><textarea name=vals rows=6 cols=40 wrap>",
|
||||
join(' ', @vals),"</textarea></td> </tr>\n";
|
||||
# IDENT protocol user
|
||||
print &ui_table_row($text{'acl_rfcusers'},
|
||||
&ui_textarea("vals", join("\n", @vals), 6, 60));
|
||||
}
|
||||
elsif ($type eq "ident_regex") {
|
||||
print "<tr> <td valign=top><b>$text{'acl_rfcusersr'}</b></td>\n";
|
||||
local $caseless;
|
||||
# IDENT protocol username regexp
|
||||
my $caseless;
|
||||
if ($vals[0] eq '-i') {
|
||||
$caseless++;
|
||||
shift(@vals);
|
||||
}
|
||||
printf "<td><input type=checkbox name=caseless value=1 %s> %s<br>\n",
|
||||
$caseless ? 'checked' : '', $text{'acl_case'};
|
||||
print "<textarea name=vals rows=6 cols=40 wrap>",
|
||||
join("\n", @vals),"</textarea></td> </tr>\n";
|
||||
print &ui_table_row($text{'acl_rfcusersr'},
|
||||
&ui_checkbox("caseless", 1, $text{'acl_case'}, $caseless).
|
||||
"<br>\n".
|
||||
&ui_textarea("vals", join("\n", @vals), 6, 60));
|
||||
}
|
||||
elsif ($type eq "maxconn") {
|
||||
print "<tr> <td valign=top><b>$text{'acl_mcr'}</b></td>\n";
|
||||
print "<td><input name=vals size=8 value=\"$vals[0]\"></td> </tr>\n";
|
||||
# Max concurrent connections
|
||||
print &ui_table_row($text{'acl_mcr'},
|
||||
&ui_textbox("vals", $vals[0], 8));
|
||||
}
|
||||
elsif ($type eq "max_user_ip") {
|
||||
local $mipstrict;
|
||||
# Max connections per IP
|
||||
my $mipstrict;
|
||||
if ($vals[0] eq '-s') {
|
||||
$mipstrict++;
|
||||
shift(@vals);
|
||||
}
|
||||
print &ui_table_row($text{'acl_mai'},
|
||||
&ui_textbox("vals", $vals[0], 8));
|
||||
print &ui_table_row($text{'acl_extargs'},
|
||||
&ui_checkbox("strict", 1, $text{'acl_maistrict'}, $mipstrict).
|
||||
"<br>\n".
|
||||
&ui_textbox("args", join(" ", @vals[1..$#vals]), 60).
|
||||
"<br>\n".$text{'acl_mairemind'});
|
||||
}
|
||||
print "<tr><td><b>$text{'acl_mai'}</b></td><td><input name=vals size=8 value=\"$vals[0]\"></td> </tr>\n";
|
||||
# print "<tr> <td valign=top><b>$text{'acl_extargs'}</b></td>\n";
|
||||
print "<tr><td>$text{'acl_maistrict'}</td>";
|
||||
printf "<td><input type=checkbox name=strict value=1 %s></td></tr>\n",
|
||||
$mipstrict ? 'checked' : '';
|
||||
print "<tr><td colspan=2>$text{'acl_mairemind'}</td></tr>";
|
||||
|
||||
# printf "<td><input name=args size=25 value=\"%s\"></td> </tr>\n",
|
||||
# join(" ", @vals[0]);
|
||||
}
|
||||
|
||||
elsif ($type eq "myport") {
|
||||
print "<tr> <td valign=top><b>$text{'acl_psp'}</b></td>\n";
|
||||
print "<td><input name=vals size=8 value=\"$vals[0]\"></td> </tr>\n";
|
||||
# Local port number
|
||||
print &ui_table_row($text{'acl_psp'},
|
||||
&ui_textbox("vals", $vals[0], 8));
|
||||
}
|
||||
elsif ($type eq "snmp_community") {
|
||||
print "<tr> <td valign=top><b>$text{'acl_scs'}</b></td>\n";
|
||||
print "<td><input name=vals size=15 value=\"$vals[0]\"></td> </tr>\n";
|
||||
# SNMP community
|
||||
print &ui_table_row($text{'acl_scs'},
|
||||
&ui_textbox("vals", $vals[0], 15));
|
||||
}
|
||||
elsif ($type eq "req_mime_type") {
|
||||
print "<tr> <td valign=top><b>$text{'acl_rmt'}</b></td>\n";
|
||||
print "<td><input name=vals size=15 value=\"$vals[0]\"></td> </tr>\n";
|
||||
# Request MIME type
|
||||
print &ui_table_row($text{'acl_rmt'},
|
||||
&ui_textbox("vals", $vals[0], 15));
|
||||
}
|
||||
elsif ($type eq "rep_mime_type") {
|
||||
print "<tr> <td valign=top><b>$text{'acl_rpmt'}</b></td>\n";
|
||||
print "<td><input name=vals size=15 value=\"$vals[0]\"></td> </tr>\n";
|
||||
# Reply MIME type
|
||||
print &ui_table_row($text{'acl_rpmt'},
|
||||
&ui_textbox("vals", $vals[0], 15));
|
||||
}
|
||||
elsif ($type eq "arp") {
|
||||
print "<tr> <td valign=top><b>$text{'acl_arp'}</b></td>\n";
|
||||
print "<td><textarea name=vals rows=6 cols=40>",join("\n", @vals),
|
||||
"</textarea></td> </tr>\n";
|
||||
# Client MAC address
|
||||
print &ui_table_row($text{'acl_arp'},
|
||||
&ui_textarea("vals", join("\n", @vals), 6, 60));
|
||||
}
|
||||
elsif ($type eq "external") {
|
||||
print "<tr> <td valign=top><b>$text{'acl_extclass'}</b></td>\n";
|
||||
print "<td><select name=class>\n";
|
||||
foreach $c (&find_config("external_acl_type", $conf)) {
|
||||
printf "<option %s>%s</option>\n",
|
||||
$c->{'values'}->[0] eq $vals[0] ? "selected" : "",
|
||||
$c->{'values'}->[0];
|
||||
}
|
||||
print "</select></td> </tr>\n";
|
||||
print "<tr> <td valign=top><b>$text{'acl_extargs'}</b></td>\n";
|
||||
printf "<td><input name=args size=25 value=\"%s\"></td> </tr>\n",
|
||||
join(" ", @vals[1..$#vals]);
|
||||
# External program
|
||||
print &ui_table_row($text{'acl_extclass'},
|
||||
&ui_select("class", $vals[0],
|
||||
[ map { $_->{'values'}->[0] }
|
||||
&find_config("external_acl_type", $conf) ]));
|
||||
print &ui_table_row($text{'acl_extargs'},
|
||||
&ui_textbox("args", join(" ", @vals[1..$#vals]), 60));
|
||||
}
|
||||
|
||||
# Show URL to redirect on failure
|
||||
print "<tr> <td><b>$text{'acl_failurl'}</b></td>\n";
|
||||
printf "<td><input name=deny size=35 value=\"%s\"></td> </tr>\n",
|
||||
@deny ? $deny[0]->{'values'}->[0] : "";
|
||||
print &ui_table_row($text{'acl_failurl'},
|
||||
&ui_textbox("deny", @deny ? $deny[0]->{'values'}->[0] : "", 40));
|
||||
|
||||
# Show file in which ACL is stored
|
||||
print "<tr> <td><b>$text{'acl_file'}</b></td>\n";
|
||||
print "<td>",&ui_opt_textbox("file", $file, 40, $text{'acl_nofile'},
|
||||
$text{'acl_infile'})," ",
|
||||
&file_chooser_button("file"),"</td> </tr>\n";
|
||||
print &ui_table_row($text{'acl_file'},
|
||||
&ui_opt_textbox("file", $file, 40, $text{'acl_nofile'},
|
||||
$text{'acl_infile'})." ".
|
||||
&file_chooser_button("file")."<br>\n".
|
||||
($in{'type'} ? &ui_checkbox("keep", 1, $text{'acl_keep'}, 0) : ""));
|
||||
|
||||
if ($in{'type'}) {
|
||||
print "<tr> <td></td>\n";
|
||||
print "<td>",&ui_checkbox("keep", 1, $text{'acl_keep'}, 0),"</td> </tr>\n";
|
||||
}
|
||||
|
||||
print "</table></td></tr></table>\n";
|
||||
print "<input type=submit value=$text{'acl_buttsave'}>\n";
|
||||
if (!$in{'type'}) { print "<input type=submit value=$text{'acl_buttdel'} name=delete>\n"; }
|
||||
print "</form>\n";
|
||||
print &ui_table_end();
|
||||
print &ui_form_end([ [ undef, $text{'acl_buttsave'} ],
|
||||
$in{'type'} ? ( ) : ( [ 'delete', $text{'acl_buttdel'} ] ),
|
||||
]);
|
||||
|
||||
&ui_print_footer("edit_acl.cgi?mode=acls", $text{'acl_return'},
|
||||
"", $text{'index_return'});
|
||||
|
||||
Reference in New Issue
Block a user