use strict; use warnings; no warnings 'redefine'; no warnings 'uninitialized'; require 'bind8-lib.pl'; # Globals from bind8-lib.pl our (%config, %text, %in); # acl_security_form(&options) # Output HTML for editing security options for the bind8 module sub acl_security_form { my $m = $_[0]->{'zones'} eq '*' ? 1 : $_[0]->{'zones'} =~ /^\!/ ? 2 : 0; print " $text{'acl_zones'}\n"; print "\n", $m == 2 ? 'checked' : '', $text{'acl_znsel'}; print "
\n"; printf " %s
\n", $m == 1 ? 'checked' : '', $text{'acl_zall'}; printf " %s
\n", $m == 0 ? 'checked' : '', $text{'acl_zsel'}; printf " %s
\n"; if (@views) { print " $text{'acl_inviews'}\n"; print "\n"; print &ui_radio("inviews_def", $_[0]->{'inviews'} eq "*" ? 1 : 0, [ [ 1, $text{'acl_vall'} ], [ 0, $text{'acl_vsel'} ] ]),"
\n"; print "\n"; } print " $text{'acl_types'} \n"; printf " %s\n", $_[0]->{'types'} ? "" : "checked", $text{'acl_types1'}; printf " %s\n", $_[0]->{'types'} ? "checked" : "", $text{'acl_types0'}; printf " \n", $_[0]->{'types'}; print " $text{'acl_dir'}\n"; printf " %s
\n", $_[0]->{'dir'}, &file_chooser_button("dir", 1); printf " %s \n", $_[0]->{'dironly'} ? "checked" : "", $text{'acl_dironly'}; print " $text{'acl_defaults'} \n"; printf " $text{'yes'}\n", $_[0]->{'defaults'} ? "checked" : ""; printf " $text{'no'} \n", $_[0]->{'defaults'} ? "" : "checked"; print " $text{'acl_ztypes'} \n"; foreach my $t ("master", "slave", "forward", "delegation") { printf " %s\n", $t, $_[0]->{$t} ? "checked" : "", $text{'acl_ztypes_'.$t}; } print " \n"; print " $text{'acl_reverse'} \n"; printf " $text{'yes'}\n", $_[0]->{'reverse'} ? "checked" : ""; printf " $text{'no'}\n", $_[0]->{'reverse'} ? "" : "checked"; print "$text{'acl_multiple'} \n"; printf " $text{'yes'}\n", $_[0]->{'multiple'} ? "checked" : ""; printf " $text{'no'} \n", $_[0]->{'multiple'} ? "" : "checked"; print " $text{'acl_ro'} \n"; printf " $text{'yes'}\n", $_[0]->{'ro'} ? "checked" : ""; printf " $text{'no'}\n", $_[0]->{'ro'} ? "" : "checked"; print "$text{'acl_apply'} \n"; print &ui_select("apply", $_[0]->{'apply'}, [ [ 1, $text{'yes'} ], [ 2, $text{'acl_applyonly'} ], [ 3, $text{'acl_applygonly'} ], [ 0, $text{'no'} ] ])," \n"; print " $text{'acl_file'} \n"; printf " $text{'yes'}\n", $_[0]->{'file'} ? "checked" : ""; printf " $text{'no'}\n", $_[0]->{'file'} ? "" : "checked"; print "$text{'acl_params'} \n"; printf " $text{'yes'}\n", $_[0]->{'params'} ? "checked" : ""; printf " $text{'no'} \n", $_[0]->{'params'} ? "" : "checked"; print " $text{'acl_opts'} \n"; printf " $text{'yes'}\n", $_[0]->{'opts'} ? "checked" : ""; printf " $text{'no'}\n", $_[0]->{'opts'} ? "" : "checked"; print "$text{'acl_delete'} \n"; printf " $text{'yes'}\n", $_[0]->{'delete'} ? "checked" : ""; printf " $text{'no'} \n", $_[0]->{'delete'} ? "" : "checked"; print " $text{'acl_gen'} \n"; printf " $text{'yes'}\n", $_[0]->{'gen'} ? "checked" : ""; printf " $text{'no'}\n", $_[0]->{'gen'} ? "" : "checked"; print "$text{'acl_whois'} \n"; printf " $text{'yes'}\n", $_[0]->{'whois'} ? "checked" : ""; printf " $text{'no'} \n", $_[0]->{'whois'} ? "" : "checked"; print " $text{'acl_findfree'} \n"; printf " $text{'yes'}\n", $_[0]->{'findfree'} ? "checked" : ""; printf " $text{'no'}\n", $_[0]->{'findfree'} ? "" : "checked"; print "$text{'acl_remote'} \n"; printf " $text{'yes'}\n", $_[0]->{'remote'} ? "checked" : ""; printf " $text{'no'} \n", $_[0]->{'remote'} ? "" : "checked"; print " $text{'acl_slaves'} \n"; printf " $text{'yes'}\n", $_[0]->{'slaves'} ? "checked" : ""; printf " $text{'no'}\n", $_[0]->{'slaves'} ? "" : "checked"; print "$text{'acl_dnssec'} \n"; printf " $text{'yes'}\n", $_[0]->{'dnssec'} ? "checked" : ""; printf " $text{'no'} \n", $_[0]->{'dnssec'} ? "" : "checked"; print "\n"; print " $text{'acl_views'} \n"; printf " $text{'yes'}\n", $_[0]->{'views'} == 1 ? "checked" : ""; printf " $text{'acl_edonly'}\n", $_[0]->{'views'} == 2 ? "checked" : ""; printf " $text{'no'} \n", $_[0]->{'views'} ? "" : "checked"; if (@views) { my $m = $_[0]->{'vlist'} eq '*' ? 1 : $_[0]->{'vlist'} =~ /^\!/ ? 2 : $_[0]->{'vlist'} eq '' ? 3 : 0; print " $text{'acl_vlist'}\n"; print "\n", $m == 3 ? 'checked' : '', $text{'acl_vnone'}; print "
\n"; printf " %s
\n", $m == 1 ? 'checked' : '', $text{'acl_vall'}; printf " %s
\n", $m == 0 ? 'checked' : '', $text{'acl_vsel'}; printf " %s
\n", $m == 2 ? 'checked' : '', $text{'acl_vnsel'}; printf " %s
\n"; } } # acl_security_save(&options) # Parse the form for security options for the bind8 module sub acl_security_save { if ($in{'zones_def'} == 1) { $_[0]->{'zones'} = "*"; } elsif ($in{'zones_def'} == 2) { $_[0]->{'zones'} = join(" ", "!", split(/\0/, $in{'zones'})); } else { $_[0]->{'zones'} = join(" ", split(/\0/, $in{'zones'})); } $_[0]->{'inviews'} = !defined($in{'inviews'}) || $in{'inviews_def'} ? "*" : join(" ", split(/\0/, $in{'inviews'})); $_[0]->{'types'} = $in{'types_def'} ? undef : $in{'types'}; $_[0]->{'master'} = $in{'master'} || 0; $_[0]->{'slave'} = $in{'slave'} || 0; $_[0]->{'forward'} = $in{'forward'} || 0; $_[0]->{'delegation'} = $in{'delegation'} || 0; $_[0]->{'defaults'} = $in{'defaults'}; $_[0]->{'reverse'} = $in{'reverse'}; $_[0]->{'multiple'} = $in{'multiple'}; $_[0]->{'ro'} = $in{'ro'}; $_[0]->{'apply'} = $in{'apply'}; $_[0]->{'dir'} = $in{'dir'}; $_[0]->{'dironly'} = $in{'dironly'}; $_[0]->{'file'} = $in{'file'}; $_[0]->{'params'} = $in{'params'}; $_[0]->{'opts'} = $in{'opts'}; $_[0]->{'delete'} = $in{'delete'}; $_[0]->{'findfree'} = $in{'findfree'}; $_[0]->{'slaves'} = $in{'slaves'}; $_[0]->{'views'} = $in{'views'}; $_[0]->{'remote'} = $in{'remote'}; $_[0]->{'dnssec'} = $in{'dnssec'}; $_[0]->{'gen'} = $in{'gen'}; $_[0]->{'whois'} = $in{'whois'}; $_[0]->{'vlist'} = $in{'vlist_def'} == 1 ? "*" : $in{'vlist_def'} == 3 ? "" : $in{'vlist_def'} == 2 ? join(" ", "!",split(/\0/, $in{'vlist'})) : join(" ", split(/\0/, $in{'vlist'})); }