Preserve multi-word entries in ACLs

This commit is contained in:
Jamie Cameron
2008-03-15 17:35:31 +00:00
parent 0e8d5c73cf
commit 60c8bca1d5
5 changed files with 24 additions and 14 deletions

View File

@@ -67,3 +67,5 @@ When adding a remote slave zone, the IPs of all other slaves and the master are
---- Changes since 1.390 ----
BIND on Windows can now be configured using this module.
Mass record creation can now add records for the domain name (by entering @ as the name), as records that already exist.
---- Changes since 1.400 ----
Keys in ACL sections are no long mangled by Webmin. This means that each IP or key must be entered on a separate line in the Access Control Lists page.

View File

@@ -9,20 +9,18 @@ $access{'defaults'} || &error($text{'acls_ecannot'});
$conf = &get_config();
@acls = ( &find("acl", $conf), { } );
print "<form action=save_acls.cgi>\n";
print "<table border>\n";
print "<tr $tb> <td><b>$text{'acls_name'}</b></td> ",
"<td><b>$text{'acls_values'}</b></td> </tr>\n";
print &ui_form_start("save_acls.cgi", "post");
print &ui_columns_start([ $text{'acls_name'}, $text{'acls_values'} ]);
for($i=0; $i<@acls; $i++) {
print "<tr $cb>\n";
printf "<td valign=top><input name=name_$i size=15 value='%s'></td>\n",
$acls[$i]->{'value'};
@vals = map { $_->{'name'} } @{$acls[$i]->{'members'}};
print "<td><textarea rows=2 cols=60 name=values_$i wrap=auto>",
join(" ", @vals),"</textarea></td> </tr>\n";
@cols = ( );
push(@cols, &ui_textbox("name_$i", $acls[$i]->{'value'}, 15));
@vals = map { join(" ", $_->{'name'}, @{$_->{'values'}}) }
@{$acls[$i]->{'members'}};
push(@cols, &ui_textarea("values_$i", join("\n", @vals), 5, 60, "off"));
print &ui_columns_row(\@cols, [ "valign=top" ]);
}
print "</table>\n";
print "<input type=submit value=\"$text{'save'}\"></form>\n";
print &ui_columns_end();
print &ui_form_end([ [ undef, $text{'save'} ] ]);
&ui_print_footer("", $text{'index_return'});

View File

@@ -522,6 +522,7 @@ acls_name=ACL Name
acls_values=Matching addresses, networks and ACLs
acls_err=Failed to save access control lists
acls_ename='$1' is not a valid ACL name
acls_eline=Each IP address must be entered on a separate line for ACL '$1'
files_title=Files and Directories
files_ecannot=You are not allowed to configure files

View File

@@ -28,3 +28,4 @@ desc_zh_CN.UTF-8=BIND 8 DNS 服务器
desc_ja_JP.UTF-8=BIND DNS ãµãƒ¼ãƒ<C3A3>
desc_ko_KR.UTF-8=BIND DNS 서버
desc_cz=DNS BIND Server
desc_nl=BIND DNS-server

View File

@@ -12,11 +12,19 @@ $conf = &get_config();
for($i=0; defined($name = $in{"name_$i"}); $i++) {
next if (!$name);
$name =~ /^\S+$/ || &error(&text('acls_ename', $name));
@vals = split(/\s+/, $in{"values_$i"});
$in{"values_$i"} =~ s/\r//g;
@vals = split(/\n+/, $in{"values_$i"});
foreach $v (@vals) {
if ($v =~ /^[0-9\.]+\s+\S/) {
&error(&text('acls_eline', $name));
}
}
push(@acls, { 'name' => 'acl',
'values' => [ $name ],
'type' => 1,
'members' => [ map { { 'name' => $_ } } @vals ] });
'members' => [ map { my ($n, @w)=split(/\s+/, $_);
{ 'name' => $n,
'values' => \@w } } @vals ] });
}
&save_directive(&get_config_parent(), 'acl', \@acls, 0, 0, 1);