From cc35718b7a40563e349761db1cb428ffb09d2ae7 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 11 Apr 2009 18:45:45 -0700 Subject: Next release --- config/tinydns/new_zone_wizard.xml | 29 +++++++++++++++---- config/tinydns/tinydns.inc | 59 ++++++++++++++++++++++++++++++++++---- config/tinydns/tinydns_domains.xml | 38 ++++++++++++++++-------- 3 files changed, 103 insertions(+), 23 deletions(-) diff --git a/config/tinydns/new_zone_wizard.xml b/config/tinydns/new_zone_wizard.xml index 82d8d62b..0f75291f 100644 --- a/config/tinydns/new_zone_wizard.xml +++ b/config/tinydns/new_zone_wizard.xml @@ -92,7 +92,7 @@ Mail exchanger record IP address input 1 - Enter the IP address of your Mail exchanger (MX) - (example: 9.10.11.12) + Enter the IP address of your Mail exchanger (MX) - (not needed if hostname above is in a different domain) First A record (optional) @@ -151,12 +151,14 @@ 128 && $reclen <= 256) { + /* TinyDNS generic records require an escaped Octal string length padded to three chars before the actual string! */ + /* The logic here shouldn't ever require padding but including it anyway in case somebody changes code down the road */ + $reclen = str_pad(decoct($reclen),3,"0",STR_PAD_LEFT); + $record_data = ":{$hostname}:16:\\{$reclen}{$saferecordip}{$ttl_string}"; + } else { + $record_data = "'{$hostname}:{$saferecordip}{$ttl_string}"; + } break; + case "raw": + /* We don't know or care what is in a raw entry, just pass it along as-is */ + $record_data = "{$recordip}"; + break; } return $record_data; } @@ -961,4 +992,22 @@ EOD; fclose($fr); } +function tinydns_cleanup_addedit_form_record() { + /* Clean some things up and simplify per limited subset of TinyDNS record syntax before saving. */ + if((($_POST['recordtype'] == "SOA") || ($_POST['recordtype'] == "NS") || ($_POST['recordtype'] == "MX")) && substr($_POST['ipaddress'],-1) != ".") + $_POST['ipaddress'] = $_POST['ipaddress'] . "."; + + if($_POST['recordtype'] == "TXT") { + /* TinyDNS provides surrounding quotes for TXT records automatically so we check & remove them here */ + if(substr($_POST['ipaddress'],-1) == "\"") + $_POST['ipaddress'] = substr($_POST['ipaddress'],0,-1); + if(substr($_POST['ipaddress'],0,1) == "\"") + $_POST['ipaddress'] = substr($_POST['ipaddress'],1); + if(substr($_POST['ipaddress'],0,5) == "v=spf") { + /* more cleanup specific to SPF records - strip newlines and carriage returns) */ + $_POST['ipaddress'] = str_replace("\r", "", $_POST['ipaddress']); + $_POST['ipaddress'] = str_replace("\n", "", $_POST['ipaddress']); + } + } +} ?> \ No newline at end of file diff --git a/config/tinydns/tinydns_domains.xml b/config/tinydns/tinydns_domains.xml index 3e313511..19468213 100644 --- a/config/tinydns/tinydns_domains.xml +++ b/config/tinydns/tinydns_domains.xml @@ -37,7 +37,7 @@ */ /* ========================================================================== */ ]]> - + Describe your package here Describe your package requirements here Currently there are no FAQ items provided. @@ -75,11 +75,11 @@ installedpackages->package->tinydnsdomains - Fully Qualified Domain Name (Hostname) + Record Name hostname - Record type + Record Type recordtype @@ -87,9 +87,13 @@ rdns - IP Address + Record Data ipaddress + + TTL + ttl + @@ -98,7 +102,7 @@ temp - Hostname or FQDN www.exampledomain.com + Record Name (Hostname or FQDN. E.g. www.exampledomain.com) hostname The DNS server will supply Records for the Fully Qualified Domain Name that is entered input @@ -106,9 +110,9 @@ - Record type + Record Type recordtype - DNS Record types. A, PTR, MX, NS, SOA, TXT, CNAME + Supported Record types: A, PTR, MX, NS, SOA, TXT, CNAME, raw ("raw" allows direct entry of a complete TinyDNS record in the FQDN field below) select 1 @@ -121,18 +125,25 @@ + - FQDN or IP Address + Record Data (FQDN, IP Address, or "raw" TinyDNS record) ipaddress - IP Address for A Records. FQDN or Hostname for SOA, PTR, CNAME Records. For NS Records an IP:FQDN + Use IP Address for A Records - FQDN or Hostname for SOA, PTR, CNAME Records - NS Records use colon-separated IP and FQDN, e.g. 1.2.3.4:mydomain.com input - 40 + 80 - DNS record time to live + MX priority (only used for MX records) + dist + input + 4 + + + DNS record time to live (in seconds) ttl input 35 @@ -212,8 +223,11 @@ tinydns_setup_ping_items(); tinydns_sync_on_changes(); + + tinydns_cleanup_addedit_form_record(); + - log_error("Begin tinydns add"); + log_error("Begin tinydns add"); tinydns_create_zone_file(); log_error("Zone file done."); tinydns_setup_ping_items(); -- cgit v1.2.3