Handle hostnames with upper-case letters
[webmin.git] / dnsadmin / dns_boot.cgi
1 #!/usr/local/bin/perl
2 # dns_boot.cgi
3 # Create an empty named.boot file and start the name server
4
5 require './dns-lib.pl';
6 $whatfailed = "Download failed";
7 &ReadParse();
8 $config{'named_boot_file'} =~ /^(\/[^\/]+)/;
9 $named_boot_directory = $1;
10
11 &lock_file($config{'named_boot_file'});
12 &lock_file("$named_boot_directory/db.cache");
13 $boot_temp = &transname("webmin.named.boot");
14 open(BOOT, "> $boot_temp");
15 print BOOT "directory $named_boot_directory\n";
16 if ($in{real} == 0) {
17         # Create an empty root domain file... no need to do anything here
18         }
19 elsif ($in{real} == 1) {
20         # Try to download the root servers file from
21         # ftp://rs.internic.net/domain/named.root
22         &ftp_download("rs.internic.net", "/domain/named.root", 
23                       "$named_boot_directory/db.cache");
24         print BOOT "cache\t\t.\tdb.cache\n";
25         }
26 elsif ($in{real} == 2) {
27         # Use builtin db.cache
28         system("cp ./db.cache $named_boot_directory/db.cache 2>/dev/null");
29         print BOOT "cache\t\t.\tdb.cache\n";
30         }
31 close(BOOT);
32 system("cp $boot_temp $config{'named_boot_file'} 2>/dev/null");
33 unlink($boot_temp);
34 &unlock_file($config{'named_boot_file'});
35 &unlock_file("$named_boot_directory/db.cache");
36 &system_logged("$config{'named_pathname'} >/dev/null 2>/dev/null </dev/null");
37 &webmin_log("boot");
38 redirect("");
39
40