📄 save_zonedef.cgi
字号:
#! /usr/bin/perl## B9DDNS - BIND 9 dynamic DNS webmin module.# Copyright (C) 2003 John Horne. <john.horne@plymouth.ac.uk>## This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2 of the License, or# (at your option) any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.### Save the zone defaults.#use strict;no strict 'vars';require './b9ddns-lib.pl';my $i = my $j = 0;my $refresh = my $retry = my $expiry = my $ncache = my $defttl = 0;my $config_opt = '';my $time = my $refunit = my $retunit = my $expunit = my $ncacheunit = '';my $defttlunit = '';my %zonedef = ();%access = &get_module_acl();unless ($access{'defaults'}) { &terror('zonedef_ecannot');}&ReadParse();&error_setup($text{'zonedef_err'});&lock_file($config{'chroot'} . $config{'named_conf'});&lock_file("$module_config_directory/zonedef");&trim($in{'refresh'});$time = $in{'refresh'} . $in{'refunit'};($refresh, $refunit) = &get_time(1, $time); # Save the times in seconds.unless ($refresh) { &terror('master_erefresh', $in{'refresh'} ? $in{'refresh'} : 0);}&trim($in{'retry'});$time = $in{'retry'} . $in{'retunit'};($retry, $retunit) = &get_time(1, $time);unless ($retry) { &terror('master_eretry', $in{'retry'} ? $in{'retry'} : 0);}&trim($in{'expiry'});$time = $in{'expiry'} . $in{'expunit'};($expiry, $expunit) = &get_time(1, $time);unless ($expiry) { &terror('master_eexpiry', $in{'expiry'} ? $in{'expiry'} : 0);}&trim($in{'ncache'});$time = $in{'ncache'} . $in{'ncacheunit'};($ncache, $ncacheunit) = &get_time(1, $time);unless ($ncache) { &terror('master_encache', $in{'ncache'} ? $in{'ncache'} : 0);}&trim($in{'defttl'});$time = $in{'defttl'} . $in{'defttlunit'};($defttl, $defttlunit) = &get_time(1, $time);unless ($defttl) { &terror('master_edefttl', $in{'defttl'} ? $in{'defttl'} : 0);}if ($expiry < $refresh || $expiry < $retry) { &terror('master_eexpiry_toolow');}%zonedef = ( 'refresh', $refresh, 'retry', $retry, 'expiry', $expiry, 'ncache', $ncache, 'defttl', $defttl, 'refunit', $refunit, 'retunit', $retunit, 'expunit', $expunit, 'ncacheunit', $ncacheunit, 'defttlunit', $defttlunit );&lock_file("$module_config_directory/config");foreach $config_opt (keys(%config)) { if ($config_opt =~ /^tmpl_/io) { delete($config{$config_opt}); }}$j = 0;for ($i = 0; defined($in{"name_$i"}); $i++) { next unless ($in{"name_$i"}); unless ($in{"type_$i"} eq 'A' || ! $in{"def_$i"}) { &terror('master_eiptmpl'); } $config{"tmpl_$j"} = join(' ', $in{"name_$i"}, $in{"type_$i"}, $in{"def_$i"} ? () : ( $in{"value_$i"} )); $j++;}&trim($in{'email'});$config{'soa_email'} = $in{'email'};unless ($config{'soa_email'}) { &terror('zonedef_email_missing');}elsif (! &valemail($config{'soa_email'})) { &terror('master_eemail', $config{'soa_email'});}$config{'tmpl_include'} = $in{'include'};&write_file("$module_config_directory/config", \%config);&unlock_file("$module_config_directory/config");&write_file("$module_config_directory/zonedef", \%zonedef);&flush_file_lines();&unlock_file("$module_config_directory/zonedef");&unlock_file($config{'chroot'} . $config{'named_conf'});&webmin_log('zonedef', undef, undef, \%in);&redirect('');exit;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -