From 91bb612618f7f5c32c6c58ac4833f575e15a16db Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Sat, 15 Feb 2014 09:33:43 +0100
Subject: [PATCH] Fixed: FS#3336 - Underscore shouln't be possible in DNS
 entries!

---
 interface/web/dns/form/dns_a.tform.php     | 2 +-
 interface/web/dns/form/dns_aaaa.tform.php  | 2 +-
 interface/web/dns/form/dns_alias.tform.php | 4 ++--
 interface/web/dns/form/dns_cname.tform.php | 4 ++--
 interface/web/dns/form/dns_hinfo.tform.php | 2 +-
 interface/web/dns/form/dns_mx.tform.php    | 4 ++--
 interface/web/dns/form/dns_ns.tform.php    | 4 ++--
 interface/web/dns/form/dns_ptr.tform.php   | 4 ++--
 interface/web/dns/form/dns_rp.tform.php    | 2 +-
 interface/web/dns/form/dns_slave.tform.php | 2 +-
 interface/web/dns/form/dns_soa.tform.php   | 6 +++---
 interface/web/dns/form/dns_srv.tform.php   | 2 +-
 interface/web/dns/form/dns_txt.tform.php   | 2 +-
 13 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/interface/web/dns/form/dns_a.tform.php b/interface/web/dns/form/dns_a.tform.php
index 7d4d276e8a..b7def7d1ea 100644
--- a/interface/web/dns/form/dns_a.tform.php
+++ b/interface/web/dns/form/dns_a.tform.php
@@ -86,7 +86,7 @@ $form["tabs"]['dns'] = array (
 					'type' => 'TOLOWER')
 			),
 			'validators' => array (  0 => array ( 'type' => 'REGEX',
-					'regex' => '/^[\a-zA-Z0-9\.\-\*]{0,64}$/',
+					'regex' => '/^[a-zA-Z0-9\.\-\*]{0,64}$/',
 					'errmsg'=> 'name_error_regex'),
 			),
 			'default' => '',
diff --git a/interface/web/dns/form/dns_aaaa.tform.php b/interface/web/dns/form/dns_aaaa.tform.php
index c03423b8b5..0550aa4269 100644
--- a/interface/web/dns/form/dns_aaaa.tform.php
+++ b/interface/web/dns/form/dns_aaaa.tform.php
@@ -79,7 +79,7 @@ $form["tabs"]['dns'] = array (
 			'datatype' => 'VARCHAR',
 			'formtype' => 'TEXT',
 			'validators' => array (  0 => array ( 'type' => 'REGEX',
-					'regex' => '/^[\w\.\-\*]{0,64}$/',
+					'regex' => '/^[a-zA-Z0-9\.\-\*]{0,64}$/',
 					'errmsg'=> 'name_error_regex'),
 			),
 			'default' => '',
diff --git a/interface/web/dns/form/dns_alias.tform.php b/interface/web/dns/form/dns_alias.tform.php
index b97889bb39..3325814dc1 100644
--- a/interface/web/dns/form/dns_alias.tform.php
+++ b/interface/web/dns/form/dns_alias.tform.php
@@ -88,7 +88,7 @@ $form["tabs"]['dns'] = array (
 			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
 					'errmsg'=> 'name_error_empty'),
 				1 => array ( 'type' => 'REGEX',
-					'regex' => '/^[\w\.\-]{1,255}$/',
+					'regex' => '/^[a-zA-Z0-9\.\-]{1,255}$/',
 					'errmsg'=> 'name_error_regex'),
 			),
 			'default' => '',
@@ -117,7 +117,7 @@ $form["tabs"]['dns'] = array (
 			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
 					'errmsg'=> 'data_error_empty'),
 				1 => array ( 'type' => 'REGEX',
-					'regex' => '/^[\w\.\-]{1,255}$/',
+					'regex' => '/^[a-zA-Z0-9\.\-]{1,255}$/',
 					'errmsg'=> 'data_error_regex'),
 			),
 			'default' => '',
diff --git a/interface/web/dns/form/dns_cname.tform.php b/interface/web/dns/form/dns_cname.tform.php
index b9d246c951..e2a86dea85 100644
--- a/interface/web/dns/form/dns_cname.tform.php
+++ b/interface/web/dns/form/dns_cname.tform.php
@@ -86,7 +86,7 @@ $form["tabs"]['dns'] = array (
 					'type' => 'TOLOWER')
 			),
 			'validators' => array (  0 => array ( 'type' => 'REGEX',
-					'regex' => '/^[\w\.\-\*]{0,255}$/',
+					'regex' => '/^[a-zA-Z0-9\.\-\*]{0,255}$/',
 					'errmsg'=> 'name_error_regex'),
 			),
 			'default' => '',
@@ -115,7 +115,7 @@ $form["tabs"]['dns'] = array (
 			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
 					'errmsg'=> 'data_error_empty'),
 				1 => array ( 'type' => 'REGEX',
-					'regex' => '/^[\w\.\-]{1,255}$/',
+					'regex' => '/^[a-zA-Z0-9\.\-]{1,255}$/',
 					'errmsg'=> 'data_error_regex'),
 			),
 			'default' => '',
diff --git a/interface/web/dns/form/dns_hinfo.tform.php b/interface/web/dns/form/dns_hinfo.tform.php
index c64dea02da..6e815f5cd8 100644
--- a/interface/web/dns/form/dns_hinfo.tform.php
+++ b/interface/web/dns/form/dns_hinfo.tform.php
@@ -88,7 +88,7 @@ $form["tabs"]['dns'] = array (
 			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
 					'errmsg'=> 'name_error_empty'),
 				1 => array ( 'type' => 'REGEX',
-					'regex' => '/^[\w\.\-]{1,64}$/',
+					'regex' => '/^[a-zA-Z0-9\.\-]{1,64}$/',
 					'errmsg'=> 'name_error_regex'),
 			),
 			'default' => '',
diff --git a/interface/web/dns/form/dns_mx.tform.php b/interface/web/dns/form/dns_mx.tform.php
index 34268f9ef9..6e0c7e3236 100644
--- a/interface/web/dns/form/dns_mx.tform.php
+++ b/interface/web/dns/form/dns_mx.tform.php
@@ -87,7 +87,7 @@ $form["tabs"]['dns'] = array (
 					'type' => 'TOLOWER')
 			),
 			'validators' => array (  0 => array ( 'type' => 'REGEX',
-					'regex' => '/^[\w\.\-\*]{0,255}$/',
+					'regex' => '/^[a-zA-Z0-9\.\-]{0,255}$/',
 					'errmsg'=> 'name_error_regex'),
 			),
 			'default' => '',
@@ -116,7 +116,7 @@ $form["tabs"]['dns'] = array (
 			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
 					'errmsg'=> 'data_error_empty'),
 				1 => array ( 'type' => 'REGEX',
-					'regex' => '/^[\w\.\-]{1,255}$/',
+					'regex' => '/^[a-zA-Z0-9\.\-]{1,255}$/',
 					'errmsg'=> 'data_error_regex'),
 			),
 			'default' => '',
diff --git a/interface/web/dns/form/dns_ns.tform.php b/interface/web/dns/form/dns_ns.tform.php
index 3eb39a927a..5020977739 100644
--- a/interface/web/dns/form/dns_ns.tform.php
+++ b/interface/web/dns/form/dns_ns.tform.php
@@ -86,7 +86,7 @@ $form["tabs"]['dns'] = array (
 					'type' => 'TOLOWER')
 			),
 			'validators' => array (  0 => array ( 'type' => 'REGEX',
-					'regex' => '/^[\w\.\-]{0,255}$/',
+					'regex' => '/^[a-zA-Z0-9\.\-]{0,255}$/',
 					'errmsg'=> 'name_error_regex'),
 			),
 			'default' => '',
@@ -115,7 +115,7 @@ $form["tabs"]['dns'] = array (
 			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
 					'errmsg'=> 'data_error_empty'),
 				1 => array ( 'type' => 'REGEX',
-					'regex' => '/^[\w\.\-]{1,255}$/',
+					'regex' => '/^[a-zA-Z0-9\.\-]{1,255}$/',
 					'errmsg'=> 'data_error_regex'),
 			),
 			'default' => '',
diff --git a/interface/web/dns/form/dns_ptr.tform.php b/interface/web/dns/form/dns_ptr.tform.php
index 3ba441b17a..b749992884 100644
--- a/interface/web/dns/form/dns_ptr.tform.php
+++ b/interface/web/dns/form/dns_ptr.tform.php
@@ -86,7 +86,7 @@ $form["tabs"]['dns'] = array (
 					'type' => 'TOLOWER')
 			),
 			'validators' => array (  0 => array ( 'type' => 'REGEX',
-					'regex' => '/^[\w\.\-]{1,256}$/',
+					'regex' => '/^[a-zA-Z0-9\.\-]{1,256}$/',
 					'errmsg'=> 'name_error_regex'),
 			),
 			'default' => '',
@@ -115,7 +115,7 @@ $form["tabs"]['dns'] = array (
 			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
 					'errmsg'=> 'data_error_empty'),
 				1 => array ( 'type' => 'REGEX',
-					'regex' => '/^[\w\.\-]{1,256}$/',
+					'regex' => '/^[a-zA-Z0-9\.\-]{1,256}$/',
 					'errmsg'=> 'data_error_regex'),
 			),
 			'default' => '',
diff --git a/interface/web/dns/form/dns_rp.tform.php b/interface/web/dns/form/dns_rp.tform.php
index 86c43ed328..3b7808e716 100644
--- a/interface/web/dns/form/dns_rp.tform.php
+++ b/interface/web/dns/form/dns_rp.tform.php
@@ -86,7 +86,7 @@ $form["tabs"]['dns'] = array (
 					'type' => 'TOLOWER')
 			),
 			'validators' => array (  0 => array ( 'type' => 'REGEX',
-					'regex' => '/^[\w\.\-]{0,255}$/',
+					'regex' => '/^[a-zA-Z0-9\.\-]{0,255}$/',
 					'errmsg'=> 'name_error_regex'),
 			),
 			'default' => '',
diff --git a/interface/web/dns/form/dns_slave.tform.php b/interface/web/dns/form/dns_slave.tform.php
index c5187317b8..0e4eedd587 100644
--- a/interface/web/dns/form/dns_slave.tform.php
+++ b/interface/web/dns/form/dns_slave.tform.php
@@ -96,7 +96,7 @@ $form["tabs"]['dns_slave'] = array (
 														'errmsg'=> 'origin_error_unique'),
 										*/
 				1 => array ( 'type' => 'REGEX',
-					'regex' => '/^[\w\.\-\/]{2,255}\.[a-zA-Z0-9\-]{2,10}[\.]{0,1}$/',
+					'regex' => '/^[a-zA-Z0-9\.\-\/]{2,255}\.[a-zA-Z0-9\-]{2,10}[\.]{0,1}$/',
 					'errmsg'=> 'origin_error_regex'),
 			),
 			'default' => '',
diff --git a/interface/web/dns/form/dns_soa.tform.php b/interface/web/dns/form/dns_soa.tform.php
index fd41c87c99..e4237e08bc 100644
--- a/interface/web/dns/form/dns_soa.tform.php
+++ b/interface/web/dns/form/dns_soa.tform.php
@@ -95,7 +95,7 @@ $form["tabs"]['dns_soa'] = array (
 				1 => array ( 'type' => 'UNIQUE',
 					'errmsg'=> 'origin_error_unique'),
 				2 => array ( 'type' => 'REGEX',
-					'regex' => '/^[\w\.\-\/]{2,255}\.[a-zA-Z0-9\-]{2,30}[\.]{0,1}$/',
+					'regex' => '/^[a-zA-Z0-9\.\-\/]{2,255}\.[a-zA-Z0-9\-]{2,30}[\.]{0,1}$/',
 					'errmsg'=> 'origin_error_regex'),
 			),
 			'default' => '',
@@ -115,7 +115,7 @@ $form["tabs"]['dns_soa'] = array (
 					'type' => 'TOLOWER')
 			),
 			'validators' => array (  0 => array ( 'type' => 'REGEX',
-					'regex' => '/^[\w\.\-]{1,255}$/',
+					'regex' => '/^[a-zA-Z0-9\.\-]{1,255}$/',
 					'errmsg'=> 'ns_error_regex'),
 			),
 			'default' => '',
@@ -137,7 +137,7 @@ $form["tabs"]['dns_soa'] = array (
 			'validators' => array (  0 => array ( 'type' => 'NOTEMPTY',
 					'errmsg'=> 'mbox_error_empty'),
 				1 => array ( 'type' => 'REGEX',
-					'regex' => '/^[[a-zA-Z0-9\.\-\_]{0,255}\.$/',
+					'regex' => '/^[a-zA-Z0-9\.\-\_]{0,255}\.$/',
 					'errmsg'=> 'mbox_error_regex'),
 			),
 			'default' => '',
diff --git a/interface/web/dns/form/dns_srv.tform.php b/interface/web/dns/form/dns_srv.tform.php
index b737bbd97a..368ecbf076 100644
--- a/interface/web/dns/form/dns_srv.tform.php
+++ b/interface/web/dns/form/dns_srv.tform.php
@@ -86,7 +86,7 @@ $form["tabs"]['dns'] = array (
 					'type' => 'TOLOWER')
 			),
 			'validators' => array (  0 => array ( 'type' => 'REGEX',
-					'regex' => '/^[\w\.\-]{0,255}$/',
+					'regex' => '/^[a-zA-Z0-9\.\-]{0,255}$/',
 					'errmsg'=> 'name_error_regex'),
 			),
 			'default' => '',
diff --git a/interface/web/dns/form/dns_txt.tform.php b/interface/web/dns/form/dns_txt.tform.php
index 159629b203..7b13d92c7c 100644
--- a/interface/web/dns/form/dns_txt.tform.php
+++ b/interface/web/dns/form/dns_txt.tform.php
@@ -86,7 +86,7 @@ $form["tabs"]['dns'] = array (
 					'type' => 'TOLOWER')
 			),
 			'validators' => array (  0 => array ( 'type' => 'REGEX',
-					'regex' => '/^[\w\.\-]{0,255}$/',
+					'regex' => '/^[a-zA-Z0-9\.\-]{0,255}$/',
 					'errmsg'=> 'name_error_regex'),
 			),
 			'default' => '',
-- 
GitLab