?? create_hint.cgi
字號:
#! /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.### Create a new root/hint zone.#use strict;no strict 'vars';require './b9ddns-lib.pl';my $dir = my $conf = my $parent_conf = my $view = my $file = '';my $base = my $vconf = my $newidx = '';my @recs = ();&ReadParse();&error_setup($text{'hcreate_err'});%access = &get_module_acl();unless ($access{'master'}) { &terror('hcreate_ecannot');}if ($access{'ro'}) { &terror('master_ero');}$conf = &get_config();## Validate the input.#$file = $in{'file'};if (! $file || $file =~ /\s/o) { &terror('files_efile');}if ($file !~ /^\//o) { $base = &zone_dir(1, \%access, $conf); $file = $base . '/' . $file;}unless (&allowed_zone_file(\%access, $file)) { &terror('hcreate_efile', $file);}unless (-r $config{'chroot'} . $file) { &terror('hcreate_efile2');}## Get the root server information. This must already exist.#@recs = &get_zone(0, $file, '.', undef, 'hint');if (@recs < 2) { &terror('hcreate_erecs');}## Add a new hint zone.#$base = &base_directory($conf);$file =~ s/^$base\/// if ($base); # Only need to save the shortened name.$dir = { 'name' => 'zone', 'values' => [ '.' ], 'type' => 1, 'members' => [ { 'name' => 'type', 'values' => [ 'hint' ] }, { 'name' => 'file', 'values' => [ $file ] } ] };if ($in{'view'}) { $conf = &get_config(); $view = $conf->[$in{'view'}]; &lock_file($config{'chroot'} . $view->{'file'}); &save_directive($view, undef, [ $dir ], 1); &flush_file_lines(); &unlock_file($config{'chroot'} . $view->{'file'}); $vconf = $view->{'members'};}else { $parent_conf = &get_config_parent(); &lock_file($config{'chroot'} . $parent_conf->{'file'}); &save_directive($parent_conf, undef, [ $dir ], 0); &flush_file_lines(); &unlock_file($config{'chroot'} . $parent_conf->{'file'}); $vconf = $conf;}$newidx = @$vconf;&webmin_log('create', 'hint', '.', \%in);&redirect("edit_zone.cgi?index=${newidx}&view=$in{'view'}&type=hint&new_zone=1");exit;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -