⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 save_misc.cgi

📁 BIND 9 dynamic DNS webmin module. This module supports both static and dynamic zones, and IPv4 and I
💻 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 global miscellaneous options.#use strict;no strict 'vars';require './b9ddns-lib.pl';my $ttl = 0;my $conf = my $options = my $time = '';%access = &get_module_acl();unless ($access{'defaults'}) {	&terror('misc_ecannot');}&error_setup($text{'misc_err'});&ReadParse();&lock_file($config{'chroot'} . $config{'named_conf'});$conf = &get_config();$options = &find('options', $conf);$options = &create_entry('options', $conf) unless (defined($options));&save_choice('recursion', $options, 1);&save_choice('minimal-responses', $options, 1);&save_addr_match('allow-recursion', $options, 1);&save_addr_match('allow-query', $options, 1);&save_addr_match('blackhole', $options, 1);&save_opt('version', \&string_check, $options, 1);&save_opt('random-device', \&file_check, $options, 1);&save_choice('zone-statistics', $options, 1);if ($in{'max_cache_def'}) {	&save_directive($options, 'max-cache-ttl', [ ], 1);}else {	&save_time(1, 'max-cache-ttl', $in{'max_cache_ttl'},		   $in{'max_cache_unit'});}if ($in{'max_ncache_def'}) {	&save_directive($options, 'max-ncache-ttl', [ ], 1);}else {	&save_time(1, 'max-ncache-ttl', $in{'max_ncache_ttl'},		   $in{'max_ncache_unit'});}if ($in{'clean_def'} == 1) {	&save_directive($options, 'cleaning-interval', [ ], 1);}elsif ($in{'clean_def'} == -1) {	&save_directive($options, 'cleaning-interval',		[ { 'name' => 'cleaning-interval', 'values' => [ 0 ] } ], 1);}else {	&save_time(0, 'cleaning-interval', $in{'clean_mins'},		   $in{'clean_unit'});}if ($in{'iface_def'} == 1) {	&save_directive($options, 'interface-interval', [ ], 1);}elsif ($in{'iface_def'} == -1) {	&save_directive($options, 'interface-interval',		[ { 'name' => 'interface-interval', 'values' => [ 0 ] } ], 1);}else {	&save_time(0, 'interface-interval', $in{'iface_mins'},		   $in{'iface_unit'});}if ($in{'stats_def'} == 1) {	&save_directive($options, 'statistics-interval', [ ], 1);}elsif ($in{'stats_def'} == -1) {	&save_directive($options, 'statistics-interval',		[ { 'name' => 'statistics-interval', 'values' => [ 0 ] } ], 1);}else {	&save_time(0, 'statistics-interval', $in{'stats_mins'},		   $in{'stats_unit'});}if ($in{'heart_def'} == 1) {	&save_directive($options, 'heartbeat-interval', [ ], 1);}elsif ($in{'heart_def'} == -1) {	&save_directive($options, 'heartbeat-interval',		[ { 'name' => 'heartbeat-interval', 'values' => [ 0 ] } ], 1);}else {	&save_time(0, 'heartbeat-interval', $in{'heart_mins'},		   $in{'heart_unit'});}if ($in{'core_def'} == 1) {	&save_directive($options, 'coresize', [ ], 1);}elsif ($in{'core_def'} == -1) {	&save_directive($options, 'coresize',		[ { 'name' => 'coresize', 'values' => [ 'unlimited' ] } ], 1);}else {	&save_size('coresize', $in{'core_size'}, $in{'core_unit'});}if ($in{'data_def'} == 1) {	&save_directive($options, 'datasize', [ ], 1);}elsif ($in{'data_def'} == -1) {	&save_directive($options, 'datasize',		[ { 'name' => 'datasize', 'values' => [ 'unlimited' ] } ], 1);}else {	&save_size('datasize', $in{'data_size'}, $in{'data_unit'});}if ($in{'stack_def'} == 1) {	&save_directive($options, 'stacksize', [ ], 1);}elsif ($in{'stack_def'} == -1) {	&save_directive($options, 'stacksize',		[ { 'name' => 'stacksize', 'values' => [ 'unlimited' ] } ], 1);}else {	&save_size('stacksize', $in{'stack_size'}, $in{'stack_unit'});}if ($in{'cache_size_def'} == 1) {	&save_directive($options, 'max-cache-size', [ ], 1);}elsif ($in{'cache_size_def'} == -1) {	&save_directive($options, 'max-cache-size',		[ { 'name' => 'max-cache-size',		    'values' => [ 'unlimited' ] } ], 1);}else {	&save_size('max-cache-size', $in{'cache_size'}, $in{'cache_size_unit'});}if ($in{'files_def'} == 1) {	&save_directive($options, 'files', [ ], 1);}elsif ($in{'files_def'} == -1) {	&save_directive($options, 'files',				[ { 'name' => 'files',				    'values' => [ 'unlimited' ] } ], 1);}else {	&trim($in{'files_size'});	if (! $in{'files_size'} || $in{'files_size'} =~ /\D/o) {		&terror('misc_efiles',				($in{'files_size'}) ? $in{'files_size'} : 0);	}	else {		&save_directive($options, 'files',				[ { 'name' => 'files',				    'values' => [ $in{'files_size'} ] } ], 1);	}}&flush_file_lines();&unlock_file($config{'chroot'} . $config{'named_conf'});&webmin_log('misc', undef, undef, \%in);&redirect('');exit;sub string_check {	&trim($_[0]);	$_[0] =~ s/^['"]//o;	$_[0] =~ s/['"]$//o;	$_[0] =~ s/([";\\])/\\$1/go;	return '';}sub file_check {	&trim($_[0]);	return (! $_[0] || $_[0] =~ /(\.\.|[\s;{}&])/o ||		(! -r $_[0])) ? $text{'files_efile'} : '';}## save_time(ttl_or_time_option, option_name, opt_time, opt_unit)#sub save_time {	$time = $_[2];	&trim($time);	if (! $time || ($time =~ /\D/o && $_[3])) {		&terror(($_[0]) ? 'misc_invalid_ttl' : 'misc_invalid_time');	}	else {		$time .= $_[3];		$ttl = &convert_time(0, $time);		if ($ttl) {			unless ($_[0]) {	# Times must be in minutes.				$ttl = int($ttl / 60);				$ttl++ unless ($ttl);			}			&save_directive($options, $_[1],					[ { 'name' => $_[1],					    'values' => [ $ttl ] } ], 1);		}		else {			&terror(($_[0]) ? 'misc_invalid_ttl'					: 'misc_invalid_time');		}	}	return;}## save_size(option_name, opt_size, opt_unit)#sub save_size {	$time = $_[1];	&trim($time);	if (! $time || $time =~ /\D/o) {		&terror('misc_esize', ($time) ? $time : 0);	}	else {		if ($_[2] eq 'KB') {			$time .= 'K';		}		elsif ($_[2] eq 'MB') {			$time .= 'M';		}		elsif ($_[2] eq 'GB') {			$time .= 'G';		}		&save_directive($options, $_[0],				[ { 'name' => $_[0], 'values' => [ $time ] } ], 1);	}	return;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -