Handle hostnames with upper-case letters
[webmin.git] / dnsadmin / save_slave.cgi
1 #!/usr/local/bin/perl
2 # save_slave.cgi
3 # Save changes to slave zone options in named.boot
4
5 require './dns-lib.pl';
6 &ReadParse();
7 &lock_file($config{'named_boot_file'});
8 $zconf = &get_config()->[$in{'index'}];
9 $whatfailed = "Failed to save slave zone";
10 %access = &get_module_acl();
11 &can_edit_zone(\%access, $zconf->{'values'}->[0]) ||
12         &error("You are not allowed to edit this zone");
13
14 @mast = split(/\s+/, $in{'masters'});
15 foreach $m (@mast) {
16         &check_ipaddress($m) ||
17                 &error("'$m' is not a valid master server IP address");
18         }
19 if (!@mast) { &error("You must enter at least one master server address"); }
20 $in{'file_def'} || $in{'file'} =~ /^\S+$/ ||
21         &error("'$in{'file'}' is not a valid records filename");
22
23 push(@vals, $zconf->{'values'}->[0]);
24 push(@vals, @mast);
25 if (!$in{'file_def'}) {
26         $file = $in{'file'};
27         $file = &base_directory($conf)."/".$file if ($file !~ /^\//);
28         &allowed_zone_file(\%access, $file) ||
29                 &error("'$in{'file'}' is not an allowable records file");
30         push(@vals, $in{'file'});
31         }
32 &modify_zone($zconf, { 'name' => 'secondary', 'values' => \@vals });
33 &unlock_file($config{'named_boot_file'});
34 &webmin_log("opts", undef, $zconf->{'values'}->[0], \%in);
35 &redirect("");
36