aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2006-12-08 19:43:59 +0000
committerScott Ullrich <sullrich@pfsense.org>2006-12-08 19:43:59 +0000
commit1108c111e3c5f9458a91bf72628e33c763512df4 (patch)
tree8b41c60bf2107551a6f50ea934106070cdd40e7a /packages
parent0d3b49ccd42e49548aed77abf524306e1bfe4770 (diff)
downloadpfsense-packages-1108c111e3c5f9458a91bf72628e33c763512df4.tar.gz
pfsense-packages-1108c111e3c5f9458a91bf72628e33c763512df4.tar.bz2
pfsense-packages-1108c111e3c5f9458a91bf72628e33c763512df4.zip
* Pass hostname to tinydns row creator function
* Check that records ip is up correctly
Diffstat (limited to 'packages')
-rw-r--r--packages/tinydns/tinydns.inc18
1 files changed, 9 insertions, 9 deletions
diff --git a/packages/tinydns/tinydns.inc b/packages/tinydns/tinydns.inc
index 48e12216..3399d2c8 100644
--- a/packages/tinydns/tinydns.inc
+++ b/packages/tinydns/tinydns.inc
@@ -196,7 +196,7 @@ function tinydns_create_zone_file() {
$status = tinydns_get_record_status($ipaddress);
if(!$status)
$ipaddress = tinydns_get_backup_record($ipaddress);
- $record_data = tinydns_get_rowline_data($ipaddress, $domain['recordtype'], $ttl);
+ $record_data = tinydns_get_rowline_data($ipaddress, $domain['recordtype'], $ttl, $hostname);
if($record_data)
fwrite($fd, $record_data . "\n");
/* process load balanced items */
@@ -204,8 +204,8 @@ function tinydns_create_zone_file() {
foreach($domain['row'] as $row) {
if($row['loadbalance']) {
$status = tinydns_get_record_status($row['failoverip']);
- if(!$status) {
- $record_data = tinydns_get_rowline_data($row['failoverip'], $domain['recordtype'], $ttl);
+ if($status) {
+ $record_data = tinydns_get_rowline_data($row['failoverip'], $domain['recordtype'], $ttl, $hostname);
fwrite($fd, $record_data . "\n");
}
}
@@ -220,26 +220,26 @@ function tinydns_create_zone_file() {
}
/* formats data as a tinydns data row item */
-function tinydns_get_rowline_data($recordip, $recordtype, $ttl) {
+function tinydns_get_rowline_data($recordip, $recordtype, $ttl, $hostname) {
if($ttl)
$ttl_string = "::{$ttl}";
else
$ttl_string = "";
switch ($recordtype) {
case "SOA":
- $record_data = ".{$hostname}::{$ipaddress}";
+ $record_data = ".{$hostname}::{$recordip}";
break;
case "MX":
- $record_data = "@{$hostname}:{$ipaddress}{$ttl_string}";
+ $record_data = "@{$hostname}:{$recordip}{$ttl_string}";
break;
case "A":
- $record_data = "+{$hostname}:{$ipaddress}{$ttl_string}";
+ $record_data = "+{$hostname}:{$recordip}{$ttl_string}";
break;
case "PTR":
- $record_data = "={$hostname}:{$ipaddress}{$ttl_string}";
+ $record_data = "={$hostname}:{$recordip}{$ttl_string}";
break;
case "CNAME":
- $record_data = "C{$hostname}:{$ipaddress}{$ttl_string}";
+ $record_data = "C{$hostname}:{$recordip}{$ttl_string}";
break;
}
return $record_data;