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

📄 save_controls.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 controls options.#use strict;no strict 'vars';require './b9ddns-lib.pl';my $i = 0;my $conf = my $controls = my $addr = my $port = my $not = '';my @keys = my @inet_ref = ();%access = &get_module_acl();unless ($access{'defaults'}) {	&terror('misc_ecannot');}&error_setup($text{'controls_err'});&ReadParse();&lock_file($config{'chroot'} . $config{'named_conf'});$conf = &get_config();$controls = &find('controls', $conf);$controls = &create_entry('controls', $conf) unless (defined($controls));if ($in{'inet_def'} == -1) {	&save_directive($controls, 'inet', [ { } ], 1);	&save_directive($controls, 'keys', [ { } ], 1);}elsif ($in{'inet_def'} == 1) {	&save_directive(&get_config_parent(), 'controls', [ ], 0);}elsif ($in{'inet_def'} == 0) {	if ($in{'disabled'}) {		&terror('controls_nokey_def');	}	for ($i = 0; defined($addr = $in{"addr_$i"}); $i += 2) {		local @values = ();		local @allow = ();		local @members = ();		if ($addr == -1) {			$addr = '*';		}		elsif ($addr == -2) {			$addr = '::';		}		else {			$addr = $in{"address_$i"};			&trim($addr);			next unless ($addr);			if ($addr =~ /^[\d.]+$/o) {				if (&check_ipaddress($addr)) {					$addr = &compress_ip($addr);				}				else {					&terror('edit_eip', $addr);				}			}			elsif ($addr =~ /^([\da-f:])+:[\da-f:]*$/io) {				if (&check_ip6address($addr)) {					$addr = &compress_ip6($addr);				}				else {					&terror('edit_eip6', $addr);				}			}			else {				&terror('edit_eip', $addr);			}		}		push (@values, $addr);		unless ($in{"pdef_$i"}) {			$port = $in{"port_$i"};			&trim($port);			unless ($port) {				&terror('controls_eport');			}			elsif ($port =~ /\D/o || $port > 65535) {				&terror('net_eport', $port);			}			push (@values, 'port', $port);		}		@allow = &compress_not($in{"allow_$i"});		unless (@allow) {			&terror('edit_eipmissing');		}		push (@values, 'allow');		foreach my $n (0 .. $#allow) {			$addr = $allow[$n];			if (&valid_acl_value($addr, $conf)) {				if ($addr =~ /^!(.*)$/o) {					$not = '!';					$addr = $1;				}				else {					$not = '';				}				if ($addr =~ /^[\d.]+$/o) {					$addr = &compress_ip($addr);				}				elsif ($addr =~ /^([\da-f:])+:[\da-f:]*$/io) {					$addr = &compress_ip6($addr);				}				$allow[$n] = { 'name' => $not . $addr };			}			else {				&terror('edit_evalue', $addr);			}		}		push (@inet_ref, { 'name' => 'inet', 'type' => 1,				   'values' => \@values,				   'members' => \@allow } );		@keys = split(/\0/, $in{"keys_$i"});		unless (@keys) {			&terror('controls_nokey');		}		@members = map { { 'name' => $_ } } @keys;		push (@inet_ref, { 'name' => 'keys', 'type' => 1,				   'members' => \@members } );	}	&save_directive($controls, 'inet', [ ], 1);	&save_directive($controls, 'keys', [ ], 1);	&save_directive($controls, 'inet', [ reverse(@inet_ref) ], 1);}&flush_file_lines();&unlock_file($config{'chroot'} . $config{'named_conf'});&webmin_log('controls', undef, undef, \%in);&redirect('');exit;

⌨️ 快捷键说明

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