comparison scripts/nameserver_autogen/bind_tld_zonefile @ 341:4a4f9682f43e draft

Updated the bind generator script so that it checks that FQDNs are actually ending in . properly now so that stupid things don't happen whenever we transfer zones or, well, do anything with DNS
author lex <lex@lynx.ano>
date Mon, 10 Jan 2011 17:45:04 -0600
parents 1299c56b6d5c
children c9b4cd6ac74e
comparison
equal deleted inserted replaced
340:1299c56b6d5c 341:4a4f9682f43e
6 foreach ($names as $name) { 6 foreach ($names as $name) {
7 if (!file_exists($name.'/ns/')) continue; 7 if (!file_exists($name.'/ns/')) continue;
8 $servers = scandir($name.'/ns/'); 8 $servers = scandir($name.'/ns/');
9 foreach ($servers as $server) { 9 foreach ($servers as $server) {
10 if ($server[0] == '.') continue; 10 if ($server[0] == '.') continue;
11 print($name.' IN NS '.$server."\n"); 11 if (substr($name, -4) == ".ano") $name .= ".";
12 $fqserver = $server;
13 if (substr($server, -4) == ".ano") $fqserver .= ".";
14 print($name.' IN NS '.$fqserver."\n");
12 $ips = file($name.'/ns/'.$server, FILE_IGNORE_NEW_LINES | 15 $ips = file($name.'/ns/'.$server, FILE_IGNORE_NEW_LINES |
13 FILE_SKIP_EMPTY_LINES); 16 FILE_SKIP_EMPTY_LINES);
14 if (substr($server, -4, 4) == ".ano") $server .= ".";
15 foreach ($ips as $ip) { 17 foreach ($ips as $ip) {
16 print($server.' IN A '.$ip."\n"); 18 print($fqserver.' IN A '.$ip."\n");
17 } 19 }
18 } 20 }
19 } 21 }
20 ?> 22 ?>