3 # Save global miscellaneous options
5 require './bind8-lib.pl';
6 $access{'defaults'} || &error($text{'misc_ecannot'});
7 &error_setup($text{'controls_err'});
10 &lock_file(&make_chroot($config{'named_conf'}));
11 $conf = &get_config();
12 my $controls = &find("controls", $conf);
14 if ($in{'inet_def'} && $in{'unix_def'}) {
15 if (defined($controls)) {
16 &save_directive(&get_config_parent(), 'controls', [ ], 0);
19 if (!defined($controls)) {
20 $controls={ 'name' => 'controls', 'type' => 1 };
21 &save_directive(&get_config_parent(), 'controls', [ $controls ], 0);
23 if (!$in{'inet_def'}) {
24 my $addr=$in{'inetaddr'};
25 &check_ipaddress($addr) || &error(&text('controls_eip', $addr));
27 my $port=$in{'inetport'};
28 $port =~ /^\d+$/ || &error($text{'controls_eport'});
30 foreach $allow (split(/\s+/, $in{'inetallow'})) {
31 # Need to check acl is OK!
32 push(@allows, { 'name' => $allow });
35 my $inetdir = { 'name' => 'inet', 'type' => 1,
39 'members' => \@allows };
41 &save_directive($controls, "inet", [ $inetdir ], 1);
43 &save_directive($controls, "inet", [ ], 1);
46 if (!$in{'unix_def'}) {
47 my $file=$in{'unixfile'};
48 my $perms=$in{'unixperms'};
49 my $owner=$in{'unixowner'};
50 my $group=$in{'unixgroup'};
51 $file =~ /^\S+$/ || &error($text{'controls_efile'});
52 $perms =~ /^\d+$/ || &error($text{'controls_eperms'});
53 $owner =~ /^\d+$/ || &error($text{'controls_eowner'});
54 $group =~ /^\d+$/ || &error($text{'controls_egroup'});
56 my $unixdir = { 'name' => 'unix', 'type' => 0,
57 'values' => [ "\"$file\"",
62 &save_directive($controls, "unix", [ $unixdir ], 1);
64 &save_directive($controls, "unix", [ ], 1);
69 &unlock_file(&make_chroot($config{'named_conf'}));
70 &webmin_log("controls", undef, undef, \%in);