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

📄 index.cgi

📁 BIND 9 dynamic DNS webmin module. This module supports both static and dynamic zones, and IPv4 and I
💻 CGI
📖 第 1 页 / 共 2 页
字号:
#! /usr/bin/perl##    B9DDNS - BIND 9 dynamic DNS webmin module.#    Copyright (C) 2003 John Horne. <john.horne@plymouth.ac.uk>#    Copyright (C) 2004 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.### Display a list of zones and links to options.#use strict;no strict 'vars';require './b9ddns-lib.pl';my $len = my $mid = my $mconfig_err = my $bind_version = my $read_only = 0;my $need_create = my $hashint = my $named_status = my $zones_found = 0;my $third1 = my $third2 = 0;my $zn_type = my $v = my $z = my $server = my $dir = '';my $zone = my $zone_name = my $vname = my $spaces = '';my $cmd = my $err = my $conf = my $type = '';my $opts = my $disabled = my $server_name = my $url = '';my @servers = my @zones = my @vnames = ();my @views = my @view_zones = my @zone_views = ();my @otitles = my @olinks = my@oicons = ();my @vtitles = my @vlinks = my@vicons = ();my @zorder = my @ztypes = my @ztitles = ();my @zlinks = my@zicons = my @zsort = ();my @zone_list = ();my %view = my %zone_types = ();%access = &get_module_acl();## First we must verify that the module config data looks reasonable.# Doing the checks now will save a lot of problems later on.#&verify_mconfig();$conf = &get_config();$need_create = (! -r $config{'chroot'} . $config{'named_conf'});unless ($need_create) {	#	# The file exists...but check if it is valid. Some systems have a	# default invalid config file!	#	$need_create = 1 if (($opts = &find('options', $conf)) &&			     ($dir = &find('directory', $opts->{'members'})) &&			     (! -d $config{'chroot'} . $dir->{'value'}));}## Check the BIND version number.#$bind_version = &bind_version(0);if ($bind_version < 9) {	&finish('index_eversion', $config{'named_path'}, $bind_version);}@views = &find('view', $conf);foreach $v (@views) {	@view_zones = &find('zone', $v->{'members'});	map { $view{$_} = $v } @view_zones;	push(@zone_list, @view_zones);}push(@zone_list, &find('zone', $conf));foreach $zone (@zone_list) {	next unless (&can_edit_zone(\%access, $zone, $view{$zone}));	$zone->{'value'} = lc($zone->{'value'});	$zone->{'value'} =~ s/\.$//o unless ($zone->{'value'} eq '.');	$type = &find_value('type', $zone->{'members'});	next unless ($type);	$zone_types{$zone->{'value'}} = $type;	$hashint++ if ($type eq 'hint');	push(@zones, $zone);}$zones_found++ if (@zones);if (@zones == 1 && $access{'zones'} ne '*' && ! $access{'defaults'} &&    ! $access{'views'} && $access{'apply'} != 1 && ! $access{'master'} &&    ! $access{'slave'} && ! $access{'forward'} && $access{'noconfig'}) {	#	# Only one zone so go directly to it.	#	$type = $zone_types{$zones[0]->{'value'}};	&redirect("edit_zone.cgi?index=$zones[0]->{'index'}&view=$views[0]->{'index'}&type=$type");	exit;}## Display the page header with the version number.#&header($text{'index_title'}, '', undef, 1, 1, 0, &hlink('About', 'help'),	undef, undef, &text('index_version', &bind_version(1)));print '<hr>';## If the named.conf file does not exist, offer to create it.#if ($need_create) {	print '<center>', &text('index_eempty',		    "<tt>$config{'chroot'}$config{'named_conf'}</tt>"), '<p>';	print '<form action=dns_boot.cgi>';	print '<input type=submit value="', $text{'index_create'},	      '"></form></center><hr>';	&footer('/', $text{'index'});	&unlock_all_files();	exit;}print '<h3>', $text{'index_opts'}, '</h3>';@otitles = ('servers', 'logging', 'acls', 'files', 'forwarding', 'net',	    'misc', 'controls', 'keys', 'zonedef');if ($access{'defaults'}) {	@olinks = map { 'conf_' . $_ . '.cgi' } @otitles;}else {	@olinks = map { '' } @otitles;}@oicons = map { 'images/' . $_ . '.gif' } @otitles;@otitles = map { $text{$_ . '_title'} } @otitles;&icons_table(\@olinks, \@otitles, \@oicons, 5);print '<hr><h3>', $text{'index_zones'}, '</h3>';if (@zones > $config{'max_zones'}) {	print '<p>', $text{'index_toomany1'}, $#zones + 1,		$text{'index_toomany2'}, '<p>';	print '<form action=find_zones.cgi>';	print '<b>', $text{'index_find'}, '</b> ';	print '<input name=search size=20>';	print '<input type=submit value="', $text{'index_search'}, '"></form>';}elsif (@zones && (! @views || ! $config{'by_view'})) {	#	# Show all zones.	#	$len = 0;	&show_buttons() if ($#zones > 100);	$spaces = '&nbsp;' x 4;	foreach $z (@zones) {		$zone = $z->{'value'};		$type = $zone_types{$zone};		if ($zone eq '.') {			$zone_name = '<i>' . $text{'index_root'} . '</i>';		}		else {			$zone_name = $zone;			$zone_name .= '.' unless ($zone =~ /\.$/o);			unless ($config{'display_fqdn'}) {				$zone_name = &convert_fqdn(-1, $zone_name, '.', 1);			}		}		$url = 'edit_zone.cgi?index=' . $z->{'index'} . '&type=' . $type;		$vname = '';		if ($view{$z}) {			$v = $view{$z};			$url .= '&view=' . $v->{'index'};			$vname = $v->{'value'};			unless ($config{'show_list'}) {				$zone_name .= $spaces . '(' . $vname . ')';			}		}		push(@zlinks, $url);		push(@ztitles, $zone_name);		push(@zsort, ($type eq 'hint') ? undef : $zone_name);		push(@zicons, "images/$type.gif");		push(@vnames, $vname);		if ($type eq 'master' || $type eq 'slave') {			$v = ((&dynamic_zone($z, 0) > 0) ?				$text{'Dynamic'} : $text{'Static'}) . ' ';		}		else {			$v = '';		}		$v .= $text{"index_$type"};		push(@ztypes, $v);		$len++;	}	#	# Sort the list of zones.	#	@zorder = sort { &compare_zones($zsort[$a], $zsort[$b]) } (0 .. $len - 1);	@zlinks = map { $zlinks[$_] } @zorder;	@ztitles = map { $ztitles[$_] } @zorder;	@zicons = map { $zicons[$_] } @zorder;	@ztypes = map { $ztypes[$_] } @zorder;	@vnames = map { $vnames[$_] } @zorder;	if ($config{'show_list'}) {		#		# Display as a list.		#		$mid = int((@zlinks + 1) / 2);		print '<table width=100%><tr><td width=50% valign=top>';		&zones_table([ @zlinks[0 .. $mid - 1] ],			     [ @ztitles[0 .. $mid - 1] ],			     [ @vnames[0 .. $mid - 1] ],			     [ @ztypes[0 .. $mid - 1] ]);		print '</td><td width=50% valign=top>';		if ($mid < @zlinks) {			&zones_table([ @zlinks[$mid .. $#zlinks] ],				     [ @ztitles[$mid .. $#ztitles] ],				     [ @vnames[$mid .. $#vnames] ],				     [ @ztypes[$mid .. $#ztypes] ]);		}		print '</td></tr></table>';	}	else {		#		# Display as icons.		#		&icons_table(\@zlinks, \@ztitles, \@zicons, 5);	}}elsif (@zones) {	#	# Show the zones under views.	#	$vname = '';	&show_buttons() if ($#zones > 100);	foreach $v (@views) {		$len = 0;		@zorder = @zlinks = @ztitles = @zicons = @ztypes = @zsort = ();		@zone_views = grep { $view{$_} eq $v } @zones;		next unless (@zone_views);		print '<b>', $text{'View'}, '</b>&nbsp;&nbsp;', $v->{'value'}, '<br>';		foreach $z (@zone_views) {			$zone = $z->{'value'};			$type = $zone_types{$zone};			if ($zone eq '.') {				$zone = '<i>' . $text{'index_root'} . '</i>';			}			else {				$zone .= '.' unless ($zone =~ /\.$/o);				unless ($config{'display_fqdn'}) {					$zone = &convert_fqdn(-1, $zone, '.', 1);				}			}			push(@zlinks, "edit_zone.cgi?index=$z->{'index'}" .					"&view=$v->{'index'}&type=$type");			push(@ztitles, $zone);			push(@zsort, $type eq 'hint' ? undef : $zone);			push(@zicons, 'images/' . $type . '.gif');			push(@vnames, $vname);			$zn_type = '';			if ($type eq 'master' || $type eq 'slave') {				$zn_type = ((&dynamic_zone($z, 0) > 0) ?				      $text{'Dynamic'} : $text{'Static'}) . ' ';			}			$zn_type .= $text{"index_$type"};			push(@ztypes, $zn_type);			$len++;		}		# Sort the list of zones.		@zorder = sort { &compare_zones($zsort[$a], $zsort[$b]) } (0 .. $len - 1);		@zlinks = map { $zlinks[$_] } @zorder;		@ztitles = map { $ztitles[$_] } @zorder;		@zicons = map { $zicons[$_] } @zorder;		@ztypes = map { $ztypes[$_] } @zorder;		if ($config{'show_list'}) {			#			# Display as a list.			#			$mid = int((@zlinks + 1) / 2);			print '<table width=100%><tr><td width=50% valign=top>';			&zones_table([ @zlinks[0 .. $mid - 1] ],				     [ @ztitles[0 .. $mid - 1] ],				     [ @vnames[0 .. $mid - 1] ],				     [ @ztypes[0 .. $mid - 1] ]);			print '</td><td width=50% valign=top>';			if ($mid < @zlinks) {				&zones_table([ @zlinks[$mid .. $#zlinks] ],					     [ @ztitles[$mid .. $#ztitles] ],					     [ @vnames[$mid .. $#vnames] ],					     [ @ztypes[$mid .. $#ztypes] ]);			}			print '</td></tr></table>';		}		else {			#			# Display as icons.			#			&icons_table(\@zlinks, \@ztitles, \@zicons, 5);		}		print '<br>';	}}elsif ($zones_found) {	print $text{'index_none_avail'}, '<p>';}else {	print $text{'index_none'}, '<p>';}## Display the buttons to create new zone types.#&show_buttons();## Display the list of views (if any).#if ($access{'views'}) {	print '<hr>';	@views = grep { &can_edit_view(\%access, $_) } @views;	foreach $v (@views) {		push(@vlinks, 'edit_view.cgi?index=' . $v->{'index'});		push(@vtitles, $v->{'value'});		push(@vicons, 'images/view.gif');	}	print '<h3>', $text{'index_views'}, '</h3>';

⌨️ 快捷键说明

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