diff options
Diffstat (limited to 'packages/tinydns/tinydns.inc')
-rw-r--r-- | packages/tinydns/tinydns.inc | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/packages/tinydns/tinydns.inc b/packages/tinydns/tinydns.inc index 55f5fe69..7bfd44e0 100644 --- a/packages/tinydns/tinydns.inc +++ b/packages/tinydns/tinydns.inc @@ -121,8 +121,28 @@ function tinydns_create_zone_file() { conf_mount_rw(); $fd = fopen("/service/tinydns/root/data", "w"); if($config['installedpackages']['tinydnsdomains']) - foreach($config['installedpackages']['tinydnsdomains'] as $domain) - fwrite($fd, $domain['recordtype'] . ":" . $domain['hostname'] . "\n"); + foreach($config['installedpackages']['tinydnsdomains'] as $domain) { + $record_type = ""; + switch ($domain['recordtype']) { + case "SOA": + $record_type = "."; + break; + case "MX": + $record_type = "@"; + break; + case "A": + $record_type = "+"; + break; + case "PTR": + $record_type = "="; + break; + case "CNAME": + $record_type = "C"; + break; + } + if($record_type) + fwrite($fd, $record_type . ":" . $domain['hostname'] . "\n"); + } fclose($fd); /* tell tinydns to reload zone file */ exec("cd /service/tinydns/root && /usr/local/bin/tinydns-data"); |