From 361a49efe6100bc705cfd0d53d09f45ca54842ec Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Tue, 6 Feb 2007 23:22:30 +0000 Subject: Add rDNS and show the IP address in the column list Submitted-by: GAndreone@imapro.com --- packages/tinydns/tinydns.inc | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'packages/tinydns/tinydns.inc') diff --git a/packages/tinydns/tinydns.inc b/packages/tinydns/tinydns.inc index 7a27ca4c..97b30fd5 100644 --- a/packages/tinydns/tinydns.inc +++ b/packages/tinydns/tinydns.inc @@ -279,7 +279,7 @@ function tinydns_create_zone_file() { log_error("tinydns_get_backup_record returned $ipaddress "); } } - $record_data = tinydns_get_rowline_data($ipaddress, $domain['recordtype'], $ttl, $hostname); + $record_data = tinydns_get_rowline_data($ipaddress, $domain['recordtype'], $ttl, $hostname, $domain['rdns']); if($record_data) { fwrite($fd, $record_data . "\n"); } @@ -313,7 +313,8 @@ function tinydns_create_zone_file() { } /* formats data as a tinydns data row item */ -function tinydns_get_rowline_data($recordip, $recordtype, $ttl, $hostname) { +/* A full description of the data format is available at 'man tinydns-data' */ +function tinydns_get_rowline_data($recordip, $recordtype, $ttl, $hostname,$rdns) { if($ttl) $ttl_string = ":{$ttl}"; else @@ -325,15 +326,25 @@ function tinydns_get_rowline_data($recordip, $recordtype, $ttl, $hostname) { case "MX": $record_data = "@{$hostname}:{$recordip}::{$ttl_string}"; break; - case "A": - $record_data = "+{$hostname}:{$recordip}{$ttl_string}"; - break; case "PTR": + /* "^" creates "PTR" record only to allow reverse DNS */ + $record_data = "^{$hostname}:{$recordip}{$ttl_string}"; + break; + case "A": + /* "=" creates both "A" and "PTR" records to allow both forward and reverse DNS */ + if($rdns) $record_data = "={$hostname}:{$recordip}{$ttl_string}"; + else + /* "+" creates "A" records only to allow forward DNS */ + $record_data = "+{$hostname}:{$recordip}{$ttl_string}"; break; case "CNAME": $record_data = "C{$hostname}:{$recordip}{$ttl_string}"; break; + case "TXT": + /* "'" creates "TXT" record that can be used for SPF */ + $record_data = "'{$hostname}:{$recordip}{$ttl_string}"; + break; } return $record_data; } -- cgit v1.2.3