3 # Update all the acl directives
5 require './bind8-lib.pl';
6 $access{'defaults'} || &error($text{'acls_ecannot'});
7 &error_setup($text{'acls_err'});
10 # Convert inputs into ACL structures
12 &lock_file(&make_chroot($config{'named_conf'}));
13 $conf = &get_config();
14 for($i=0; defined($name = $in{"name_$i"}); $i++) {
16 $name =~ /^\S+$/ && $name !~ /;/ || &error(&text('acls_ename', $name));
17 $in{"values_$i"} =~ s/\r//g;
18 @vals = split(/\n+/, $in{"values_$i"});
20 if ($v =~ /^[0-9\.]+\s+\S/ && $v !~ /;/) {
21 &error(&text('acls_eline', $name));
24 push(@acls, { 'name' => 'acl',
25 'values' => [ $name ],
27 'members' => [ map { my ($n, @w)=split(/\s+/, $_);
29 'values' => \@w } } @vals ] });
31 # Record this ACL as a dependency of some ACL it refers to
33 my ($n, @w)=split(/\s+/, $_);
34 if ($n !~ /^[0-9\.]+$/) {
35 push(@{$depmap{$n}}, $name);
40 # Sort the list so that depended-on ACLs come first
41 @acls = sort { my $an = $a->{'values'}->[0];
42 my $bn = $b->{'values'}->[0];
43 &indexof($an, @{$depmap{$bn}}) >= 0 ? 1 :
44 &indexof($bn, @{$depmap{$an}}) >= 0 ? -1 : 0 } @acls;
46 &save_directive(&get_config_parent(), 'acl', \@acls, 0, 0, 1);
48 &unlock_file(&make_chroot($config{'named_conf'}));
49 &webmin_log("acls", undef, undef, \%in);