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

📄 save_logging.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 logging options.#use strict;no strict 'vars';require './b9ddns-lib.pl';my $i = 0;my $conf = my $logging = my $cat = my $cat_name = my $p = '';my @cchan = my @channel = my @category = ();%access = &get_module_acl();unless ($access{'defaults'}) {	&terror('logging_ecannot');}&error_setup($text{'files_err'});&ReadParse();&lock_file($config{'chroot'} . $config{'named_conf'});$conf = &get_config();$logging = &find('logging', $conf);## Save the categories.#for ($i = 0; defined($cat = $in{"cat_$i"}); $i++) {	next unless ($cat);	@cchan = split(/\0/, $in{"cchan_$i"});	push(@category, { 'name' => 'category',			  'values' => [ $cat ],			  'type' => 1,			  'members' => [ map { { 'name' => $_ } } @cchan ] });}## Save the channels.#for ($i = 0; defined($cat_name = $in{"cname_$i"}); $i++) {	&trim($cat_name);	next unless ($cat_name);	if ($cat_name =~ /[\s{}]/o) {		&terror('logging_ename', $cat_name);	}	local @members = ();	if ($in{"to_$i"} == 0) {		if (! $in{"file_$i"} || $in{"file_$i"} =~ /\s/o) {			&terror('logging_efile');		}		local @fvals = ( $in{"file_$i"} );		if ($in{"vmode_$i"} == 1) {			push(@fvals, 'versions', 'unlimited');		}		elsif ($in{"vmode_$i"} == 2) {			if ($in{"ver_$i"} =~ /\D/o) {				&terror('logging_ever', $in{"ver_$i"});			}			push(@fvals, 'versions', $in{"ver_$i"});		}		if ($in{"smode_$i"}) {			if (! $in{"size_$i"} || $in{"size_$i"} =~ /\D/o) {				&terror('logging_esize',					($in{"size_$i"}) ? $in{"size_$i"} : 0);			}			if ($in{"size_unit_$i"} eq 'KB') {				$in{"size_$i"} .= 'K';			}			elsif ($in{"size_unit_$i"} eq 'MB') {				$in{"size_$i"} .= 'M';			}			elsif ($in{"size_unit_$i"} eq 'GB') {				$in{"size_$i"} .= 'G';			}			push(@fvals, 'size', $in{"size_$i"});		}		push(@members, { 'name' => 'file', 'values' => \@fvals });	}	elsif ($in{"to_$i"} == 1) {		push(@members, { 'name' => 'syslog',				 'values' => [ $in{"syslog_$i"} ] });	}	elsif ($in{"to_$i"} == 2) {		push(@members, { 'name' => 'stderr' });	}	else {		push(@members, { 'name' => 'null' });	}	if ($in{"sev_$i"} eq 'debug') {		push(@members, { 'name' => 'severity',				 'values' => [ 'debug', $in{"debug_$i"} ] });	}	elsif ($in{"sev_$i"}) {		push(@members, { 'name' => 'severity',				 'values' => [ $in{"sev_$i"} ] });	}	foreach $p ('print-category', 'print-severity', 'print-time') {		if ($in{"$p-$i"}) {			push(@members, { 'name' => $p,					 'values' => [ $in{"$p-$i"} ] });		}	}	push(@channel, { 'name' => 'channel',			 'values' => [ $cat_name ],			 'type' => 1,			 'members' => \@members } );}if (defined($logging)) {	&save_directive($logging, 'channel', \@channel, 1);	&save_directive($logging, 'category', [ ], 1);	&save_directive($logging, 'category', [ reverse(@category) ], 1);}else {	$logging = { 'name' => 'logging', 'type' => 1,		     'members' => [ @channel, @category ] };	&save_directive(&get_config_parent(), 'logging', [ $logging ], 0);}&flush_file_lines();&unlock_file($config{'chroot'} . $config{'named_conf'});&webmin_log('logging', undef, undef, \%in);&redirect('');exit;

⌨️ 快捷键说明

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