From 7ce2a27b33fefac065b3e890df9f304fba881e99 Mon Sep 17 00:00:00 2001 From: Marcello Coutinho Date: Fri, 11 Oct 2013 20:03:41 -0300 Subject: bind - bump version and add field validation for zone tab --- config/bind/bind.inc | 34 ++++++++++++++++++++++++++---- config/bind/bind_zones.xml | 52 ++++++++++++++++++++++++++-------------------- pkg_config.8.xml | 2 +- pkg_config.8.xml.amd64 | 2 +- 4 files changed, 61 insertions(+), 29 deletions(-) diff --git a/config/bind/bind.inc b/config/bind/bind.inc index 0eddda73..30828927 100644 --- a/config/bind/bind.inc +++ b/config/bind/bind.inc @@ -47,6 +47,29 @@ else define('CHROOT_LOCALBASE','/conf/named'); +function bind_zone_validate($post, $input_errors){ + if ($_POST['type']=='reverso'){ + if( $_POST['nameserver'] == "") + $input_errors[] = 'The field \'Name Server\' is required'; + } + if (key_exists("mail",$_POST)) + $_POST['mail']=preg_replace("/@/",".",$post['mail']); + for ($i=0;$i < count($_POST);$i++){ + if (key_exists("hostname$i",$_POST)){ + if (preg_match("/(MX|NS)/",$_POST["hosttype$i"])) + $_POST["hostname$i"]=""; + if (!preg_match("/(MX|NS)/",$_POST["hosttype$i"]) && $_POST["hostname$i"]=="") + $input_errors[] = 'Record cannot be empty for '.$_POST["hosttype$i"].' type '; + if ($_POST["hosttype$i"]=="MX" && $_POST["hostvalue$i"]=="") + $_POST["hostvalue$i"]="10"; + if ($_POST["hosttype$i"]!="MX" && $_POST["hostvalue$i"]!="") + $_POST["hostvalue$i"]=""; + if ($_POST["hostdst$i"]=="") + $input_errors[] = 'Alias or IP address cannot be empty.'; + } + } +} + function bind_sync(){ global $config; @@ -68,8 +91,9 @@ $bind_conf .= <<['installedpackages']['bindzone']['config'] - Zones Name + Zone Name name - Zonas Type + Zone Type type @@ -106,16 +106,16 @@ temp01 - Zone Name: + Zone Name name - Enter the name for zone (ex:exemple.com.br) + Enter the name for zone (ex:mydomain.com) input - + - Zonas Type + Zone Type type - Select the type that zone to Master Primary DNS, Secondary DNS to select Slave. + Select zone type select - Zone Reverse + Reverse Zone reverso - Enable this if the zone is reverse. + Enable if this is a reverse zone. checkbox @@ -188,19 +188,19 @@ Name Server nameserver - Enter ns.example.com is a nameserver for example.com + Enter nameserver for this zone input - IP Name Server + Base Domain ip ipns - Enter address ip for nameserver + Enter ip address for base domain lookup. Ex: nslookup mydomain.com input Mail Admin Zone mail - Enter mail admin zone, is . not @ + Enter mail admin zone. input @@ -272,23 +272,28 @@ listtopic - Hosts Configuration Zone Domain + Zone Domain records temp02 - Enter the desired host, "Host Name" is the name of the Host: www or pop, "Host Type" simple kind host, "Value" in case the MX priority, "CNAME or IP address" is the destination host. + Enter Domain records. + "Record" is the name or last octec of ip. Sample: www or pop
+ "Type" is the type of the record Sample: A CNAME MX NS
+ "Priority" in used only in mx records to define its priority
+ "Alias or IP address" is the destination host or ip address.

+ You can order elements on this list with drag and drop between columns.]]>
none rowhelper - Host Name + Record hostname Enter the Host Name (ex: www) input - 20 + 10 - Host Type + Type hosttype Select Type Host select @@ -306,18 +311,18 @@ - Value + Priority hostvalue MX 10 or 20 input - 1 + 3 - Ip Address or CNAME destination + Alias or IP address hostdst Enter the IP address or CNAME destination for Domain (ex: 10.31.11.1 or mail.example.com) input - 20 + 35
@@ -331,7 +336,8 @@ - $_POST['serial']=(date("U")+ 1000000000); + $_POST['serial']=(date("U")+ 1000000000); + bind_zone_validate($_POST, &$input_errors); bind_sync(); diff --git a/pkg_config.8.xml b/pkg_config.8.xml index 3a8c1dc8..561f66ae 100644 --- a/pkg_config.8.xml +++ b/pkg_config.8.xml @@ -53,7 +53,7 @@ http://www.isc.org/downloads/BIND/ Services - 9.9.4 pkg v 0.1.2 + 9.9.4 pkg v 0.1.3 Beta 2.1 http://www.pfsense.com/packages/config/bind/bind.xml diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64 index 7548f7ad..30801007 100644 --- a/pkg_config.8.xml.amd64 +++ b/pkg_config.8.xml.amd64 @@ -53,7 +53,7 @@ http://www.isc.org/downloads/BIND/ Services - 9.9.4 pkg v 0.1.2 + 9.9.4 pkg v 0.1.3 Beta 2.1 http://www.pfsense.com/packages/config/bind/bind.xml -- cgit v1.2.3