Handle hostnames with upper-case letters
[webmin.git] / bind8 / convert_master.cgi
1 #!/usr/local/bin/perl
2 # convert_master.cgi
3 # Convert a master zone into a slave
4
5 require './bind8-lib.pl';
6 &ReadParse();
7 $conf = &get_config();
8 if ($in{'view'} ne '') {
9         $conf = $conf->[$in{'view'}]->{'members'};
10         }
11 $zconf = $conf->[$in{'index'}];
12 &error_setup($text{'convert_err'});
13 &lock_file(&make_chroot($zconf->{'file'}));
14 $access{'slave'} || &error($text{'screate_ecannot1'});
15
16 # Change the type directive
17 &save_directive($zconf, 'type', [ { 'name' => 'type',
18                                     'values' => [ 'slave' ] } ], 1);
19
20 # Add a masters section
21 if ($config{'default_master'}) {
22         @mdirs = map { { 'name' => $_ } } split(/\s+/, $config{'default_master'});
23         &save_directive($zconf, 'masters', [ { 'name' => 'masters',
24                                                'type' => 1,
25                                                'members' => \@mdirs } ], 1);
26         }
27
28 # Take out directives not allowed in slaves
29 &save_directive($zconf, 'allow-update', [ ], 1);
30
31 &flush_file_lines();
32 &unlock_file(&make_chroot($zconf->{'file'}));
33 &redirect("");
34