Skip to content

Commit 2a1b32e

Browse files
author
Till Brehm
committed
Merge branch 'longer-tld' into 'stable-3.1'
Allow 63 char TLD See merge request ispconfig/ispconfig3!1028
2 parents f8aa1e1 + ae6dc98 commit 2a1b32e

File tree

11 files changed

+44
-44
lines changed

11 files changed

+44
-44
lines changed

interface/lib/classes/validate_cron.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function command_format($field_name, $field_value, $validator) {
5252

5353
if($parsed["scheme"] != "http" && $parsed["scheme"] != "https") return $this->get_error($validator['errmsg']);
5454

55-
if(preg_match("'^([a-z0-9][a-z0-9_\-]{0,62}\.)+([A-Za-z0-9\-]{2,30})$'i", $parsed["host"]) == false) return $this->get_error($validator['errmsg']);
55+
if(preg_match("'^([a-z0-9][a-z0-9_\-]{0,62}\.)+([A-Za-z0-9\-]{2,63})$'i", $parsed["host"]) == false) return $this->get_error($validator['errmsg']);
5656
}
5757
if(strpos($field_value, "\n") !== false || strpos($field_value, "\r") !== false || strpos($field_value, chr(0)) !== false) {
5858
return $this->get_error($validator['errmsg']);

interface/lib/classes/validate_domain.inc.php

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function web_domain($field_name, $field_value, $validator) {
5151

5252
$result = $this->_check_unique($field_value);
5353
if(!$result) return $this->get_error('domain_error_unique');
54-
54+
5555
$pattern = '/\.acme\.invalid$/';
5656
if(preg_match($pattern, $field_value)) return $this->get_error('domain_error_acme_invalid');
5757
}
@@ -68,7 +68,7 @@ function sub_domain($field_name, $field_value, $validator) {
6868

6969
$result = $this->_check_unique($field_value);
7070
if(!$result) return $this->get_error('domain_error_unique');
71-
71+
7272
$pattern = '/\.acme\.invalid$/';
7373
if(preg_match($pattern, $field_value)) return $this->get_error('domain_error_acme_invalid');
7474
}
@@ -83,7 +83,7 @@ function alias_domain($field_name, $field_value, $validator) {
8383

8484
$result = $this->_check_unique($field_value);
8585
if(!$result) return $this->get_error('domain_error_unique');
86-
86+
8787
$pattern = '/\.acme\.invalid$/';
8888
if(preg_match($pattern, $field_value)) return $this->get_error('domain_error_acme_invalid');
8989
}
@@ -98,7 +98,7 @@ function web_domain_autosub($field_name, $field_value, $validator) {
9898
} else {
9999
$check_domain = $_POST['domain'];
100100
}
101-
101+
102102
$app->uses('ini_parser,getconf');
103103
$settings = $app->getconf->get_global_config('domains');
104104
if ($settings['use_domain_module'] == 'y') {
@@ -111,26 +111,26 @@ function web_domain_autosub($field_name, $field_value, $validator) {
111111
$result = $this->_check_unique($field_value . '.' . $check_domain, true);
112112
if(!$result) return $this->get_error('domain_error_autosub');
113113
}
114-
114+
115115
/* Check apache directives */
116116
function web_apache_directives($field_name, $field_value, $validator) {
117117
global $app;
118-
118+
119119
if(trim($field_value) != '') {
120120
$security_config = $app->getconf->get_security_config('ids');
121-
121+
122122
if($security_config['apache_directives_scan_enabled'] == 'yes') {
123-
123+
124124
// Get blacklist
125125
$blacklist_path = '/usr/local/ispconfig/security/apache_directives.blacklist';
126126
if(is_file('/usr/local/ispconfig/security/apache_directives.blacklist.custom')) $blacklist_path = '/usr/local/ispconfig/security/apache_directives.blacklist.custom';
127127
if(!is_file($blacklist_path)) $blacklist_path = realpath(ISPC_ROOT_PATH.'/../security/apache_directives.blacklist');
128-
128+
129129
$directives = explode("\n",$field_value);
130130
$regex = explode("\n",file_get_contents($blacklist_path));
131131
$blocked = false;
132132
$blocked_line = '';
133-
133+
134134
if(is_array($directives) && is_array($regex)) {
135135
foreach($directives as $directive) {
136136
$directive = trim($directive);
@@ -144,31 +144,31 @@ function web_apache_directives($field_name, $field_value, $validator) {
144144
}
145145
}
146146
}
147-
147+
148148
if($blocked === true) {
149149
return $this->get_error('apache_directive_blocked_error').' '.$blocked_line;
150150
}
151151
}
152-
152+
153153
/* Check nginx directives */
154154
function web_nginx_directives($field_name, $field_value, $validator) {
155155
global $app;
156-
156+
157157
if(trim($field_value) != '') {
158158
$security_config = $app->getconf->get_security_config('ids');
159-
159+
160160
if($security_config['nginx_directives_scan_enabled'] == 'yes') {
161-
161+
162162
// Get blacklist
163163
$blacklist_path = '/usr/local/ispconfig/security/nginx_directives.blacklist';
164164
if(is_file('/usr/local/ispconfig/security/nginx_directives.blacklist.custom')) $blacklist_path = '/usr/local/ispconfig/security/nginx_directives.blacklist.custom';
165165
if(!is_file($blacklist_path)) $blacklist_path = realpath(ISPC_ROOT_PATH.'/../security/nginx_directives.blacklist');
166-
166+
167167
$directives = explode("\n",$field_value);
168168
$regex = explode("\n",file_get_contents($blacklist_path));
169169
$blocked = false;
170170
$blocked_line = '';
171-
171+
172172
if(is_array($directives) && is_array($regex)) {
173173
foreach($directives as $directive) {
174174
$directive = trim($directive);
@@ -182,16 +182,16 @@ function web_nginx_directives($field_name, $field_value, $validator) {
182182
}
183183
}
184184
}
185-
185+
186186
if($blocked === true) {
187187
return $this->get_error('nginx_directive_blocked_error').' '.$blocked_line;
188188
}
189189
}
190-
190+
191191

192192
/* internal validator function to match regexp */
193193
function _regex_validate($domain_name, $allow_wildcard = false) {
194-
$pattern = '/^' . ($allow_wildcard == true ? '(\*\.)?' : '') . '[\w\.\-]{1,255}\.[a-zA-Z0-9\-]{2,30}$/';
194+
$pattern = '/^' . ($allow_wildcard == true ? '(\*\.)?' : '') . '[\w\.\-]{1,255}\.[a-zA-Z0-9\-]{2,63}$/';
195195
return preg_match($pattern, $domain_name);
196196
}
197197

@@ -229,8 +229,8 @@ function _check_unique($domain_name, $only_domain = false) {
229229
$domain_params[] = $aliassubdomain['domain'];
230230
}
231231
}
232-
233-
232+
233+
234234
$qrystr = "SELECT d.domain_id, IF(d.parent_domain_id != 0 AND p.domain_id IS NOT NULL, p.ip_address, d.ip_address) as `ip_address`, IF(d.parent_domain_id != 0 AND p.domain_id IS NOT NULL, p.ipv6_address, d.ipv6_address) as `ipv6_address` FROM `web_domain` as d LEFT JOIN `web_domain` as p ON (p.domain_id = d.parent_domain_id) WHERE (d.domain = ?" . $additional_sql1 . ") AND d.server_id = ? AND d.domain_id != ?" . ($primary_id ? " AND d.parent_domain_id != ?" : "");
235235
$params = array_merge(array($domain_name), $domain_params, array($domain['server_id'], $primary_id, $primary_id));
236236
$checks = $app->db->queryAllRecords($qrystr, true, $params);
@@ -242,7 +242,7 @@ function _check_unique($domain_name, $only_domain = false) {
242242
if($domain['ipv6_address'] != '' && $check['ipv6_address'] == $domain['ipv6_address']) return false;
243243
}
244244
}
245-
245+
246246
if($only_domain == false) {
247247
$qrystr = "SELECT d.domain_id, IF(d.parent_domain_id != 0 AND p.domain_id IS NOT NULL, p.ip_address, d.ip_address) as `ip_address`, IF(d.parent_domain_id != 0 AND p.domain_id IS NOT NULL, p.ipv6_address, d.ipv6_address) as `ipv6_address` FROM `web_domain` as d LEFT JOIN `web_domain` as p ON (p.domain_id = d.parent_domain_id) WHERE (CONCAT(d.subdomain, '.', d.domain) = ?" . $additional_sql2 . ") AND d.server_id = ? AND d.domain_id != ?" . ($primary_id ? " AND d.parent_domain_id != ?" : "");
248248
$params = array_merge(array($domain_name), $domain_params, array($domain['server_id'], $primary_id, $primary_id));
@@ -256,7 +256,7 @@ function _check_unique($domain_name, $only_domain = false) {
256256
}
257257
}
258258
}
259-
259+
260260
return true;
261261
}
262262

@@ -274,6 +274,6 @@ function _wildcard_limit() {
274274
}
275275
return true; // admin may always add wildcard domain
276276
}
277-
277+
278278

279279
}

interface/web/admin/form/server_config.tform.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
'validators' => array( 0 => array('type' => 'NOTEMPTY',
132132
'errmsg' => 'hostname_error_empty'),
133133
1 => array ('type' => 'REGEX',
134-
'regex' => '/^[\w\.\-]{2,255}\.[a-zA-Z0-9\-]{2,30}$/',
134+
'regex' => '/^[\w\.\-]{2,255}\.[a-zA-Z0-9\-]{2,63}$/',
135135
'errmsg'=> 'hostname_error_regex'),
136136
),
137137
'value' => '',

interface/web/client/form/domain.tform.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
1 => array ( 'type' => 'UNIQUE',
101101
'errmsg'=> 'domain_error_unique'),
102102
2 => array ( 'type' => 'REGEX',
103-
'regex' => '/^[\w\.\-]{2,255}\.[a-zA-Z0-9\-]{2,30}$/',
103+
'regex' => '/^[\w\.\-]{2,255}\.[a-zA-Z0-9\-]{2,63}$/',
104104
'errmsg'=> 'domain_error_regex'),
105105
),
106106
'default' => '',

interface/web/dns/dns_wizard.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,10 @@
220220
}
221221

222222
if($_POST['create'] == 1) {
223-
223+
224224
//* CSRF Check
225225
$app->auth->csrf_token_check();
226-
226+
227227
$error = '';
228228

229229
if ($post_server_id)
@@ -277,17 +277,17 @@
277277

278278

279279
if(isset($_POST['domain']) && $_POST['domain'] == '') $error .= $app->lng('error_domain_empty').'<br />';
280-
elseif(isset($_POST['domain']) && !preg_match('/^[\w\.\-]{2,64}\.[a-zA-Z0-9\-]{2,30}$/', $_POST['domain'])) $error .= $app->lng('error_domain_regex').'<br />';
280+
elseif(isset($_POST['domain']) && !preg_match('/^[\w\.\-]{2,64}\.[a-zA-Z0-9\-]{2,63}$/', $_POST['domain'])) $error .= $app->lng('error_domain_regex').'<br />';
281281

282282
if(isset($_POST['ip']) && $_POST['ip'] == '') $error .= $app->lng('error_ip_empty').'<br />';
283283

284284
if(isset($_POST['ipv6']) && $_POST['ipv6'] == '') $error .= $app->lng('error_ipv6_empty').'<br />';
285285

286286
if(isset($_POST['ns1']) && $_POST['ns1'] == '') $error .= $app->lng('error_ns1_empty').'<br />';
287-
elseif(isset($_POST['ns1']) && !preg_match('/^[\w\.\-]{2,64}\.[a-zA-Z0-9]{2,30}$/', $_POST['ns1'])) $error .= $app->lng('error_ns1_regex').'<br />';
287+
elseif(isset($_POST['ns1']) && !preg_match('/^[\w\.\-]{2,64}\.[a-zA-Z0-9]{2,63}$/', $_POST['ns1'])) $error .= $app->lng('error_ns1_regex').'<br />';
288288

289289
if(isset($_POST['ns2']) && $_POST['ns2'] == '') $error .= $app->lng('error_ns2_empty').'<br />';
290-
elseif(isset($_POST['ns2']) && !preg_match('/^[\w\.\-]{2,64}\.[a-zA-Z0-9]{2,30}$/', $_POST['ns2'])) $error .= $app->lng('error_ns2_regex').'<br />';
290+
elseif(isset($_POST['ns2']) && !preg_match('/^[\w\.\-]{2,64}\.[a-zA-Z0-9]{2,63}$/', $_POST['ns2'])) $error .= $app->lng('error_ns2_regex').'<br />';
291291

292292
if(isset($_POST['email']) && $_POST['email'] == '') $error .= $app->lng('error_email_empty').'<br />';
293293
elseif(isset($_POST['email']) && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) === false) $error .= $app->lng('error_email_regex').'<br />';
@@ -324,7 +324,7 @@
324324
if($_POST['ns2'] != '') $tpl_content = str_replace('{NS2}', $_POST['ns2'], $tpl_content);
325325
if($_POST['email'] != '') $tpl_content = str_replace('{EMAIL}', $_POST['email'], $tpl_content);
326326
$enable_dnssec = (($_POST['dnssec'] == 'Y') ? 'Y' : 'N');
327-
if(isset($_POST['dkim']) && preg_match('/^[\w\.\-\/]{2,255}\.[a-zA-Z0-9\-]{2,30}[\.]{0,1}$/', $_POST['domain'])) {
327+
if(isset($_POST['dkim']) && preg_match('/^[\w\.\-\/]{2,255}\.[a-zA-Z0-9\-]{2,63}[\.]{0,1}$/', $_POST['domain'])) {
328328
$sql = $app->db->queryOneRecord("SELECT dkim_public, dkim_selector FROM mail_domain WHERE domain = ? AND dkim = 'y' AND ".$app->tform->getAuthSQL('r'), $_POST['domain']);
329329
$public_key = $sql['dkim_public'];
330330
if ($public_key!='') {

interface/web/dns/form/dns_slave.tform.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
'errmsg'=> 'origin_error_unique'),
9797
*/
9898
1 => array ( 'type' => 'REGEX',
99-
'regex' => '/^[a-zA-Z0-9\.\-\/]{2,255}\.[a-zA-Z0-9\-]{2,30}[\.]{0,1}$/',
99+
'regex' => '/^[a-zA-Z0-9\.\-\/]{2,255}\.[a-zA-Z0-9\-]{2,63}[\.]{0,1}$/',
100100
'errmsg'=> 'origin_error_regex'),
101101
),
102102
'default' => '',

interface/web/dns/form/dns_soa.tform.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
1 => array ( 'type' => 'UNIQUE',
9696
'errmsg'=> 'origin_error_unique'),
9797
2 => array ( 'type' => 'REGEX',
98-
'regex' => '/^[a-zA-Z0-9\.\-\/]{2,255}\.[a-zA-Z0-9\-]{2,30}[\.]{0,1}$/',
98+
'regex' => '/^[a-zA-Z0-9\.\-\/]{2,255}\.[a-zA-Z0-9\-]{2,63}[\.]{0,1}$/',
9999
'errmsg'=> 'origin_error_regex'),
100100
),
101101
'default' => '',

interface/web/mail/ajax_get_json.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
$mail_config = $app->getconf->get_server_config($server_id, 'mail');
5353
$dkim_strength = $app->functions->intval($mail_config['dkim_strength']);
5454
if ($dkim_strength=='') $dkim_strength = 2048;
55-
55+
5656
$rnd_val = $dkim_strength * 10;
5757
$app->system->exec_safe('openssl rand -out ../../temp/random-data.bin '.$rnd_val.' 2> /dev/null');
5858
$app->system->exec_safe('openssl genrsa -rand ../../temp/random-data.bin '.$dkim_strength.' 2> /dev/null');
@@ -113,7 +113,7 @@
113113
echo $json;
114114

115115
function validate_domain($domain) {
116-
$regex = '/^[\w\.\-]{2,255}\.[a-zA-Z0-9\-]{2,30}$/';
116+
$regex = '/^[\w\.\-]{2,255}\.[a-zA-Z0-9\-]{2,63}$/';
117117
if ( preg_match($regex, $domain) === 1 ) return true; else return false;
118118
}
119119

interface/web/mail/form/mail_domain_catchall.tform.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
1 => array ( 'type' => 'UNIQUE',
8787
'errmsg'=> 'domain_error_unique'),
8888
2 => array ( 'type' => 'REGEX',
89-
'regex' => '/^\@[\w\.\-]{2,255}\.[a-zA-Z\-]{2,30}$/',
89+
'regex' => '/^\@[\w\.\-]{2,255}\.[a-zA-Z\-]{2,63}$/',
9090
'errmsg'=> 'domain_error_regex'),
9191
),
9292
'default' => '',

interface/web/mail/form/mail_user.tform.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@
181181
'type' => 'TOLOWER')
182182
),
183183
'validators' => array ( 0 => array ( 'type' => 'REGEX',
184-
'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}(,\s*\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,}$/i',
184+
'regex' => '/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,63}){0,1}(,\s*\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,63}){0,}$/i',
185185
'errmsg'=> 'cc_error_isemail'),
186186
),
187187
'default' => '',
@@ -200,7 +200,7 @@
200200
'type' => 'TOLOWER')
201201
),
202202
'validators' => array ( 0 => array ( 'type' => 'REGEX',
203-
'regex'=>'/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,1}(,\s*\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,10}){0,}$/i',
203+
'regex'=>'/^(\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,63}){0,1}(,\s*\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\.[a-z\-]{2,63}){0,}$/i',
204204
'errmsg'=> 'sender_cc_error_isemail'),
205205
),
206206
'default' => '',
@@ -360,7 +360,7 @@
360360
'autoresponder_start_date' => array (
361361
'datatype' => 'DATETIME',
362362
'formtype' => 'DATETIME',
363-
'validators'=> array (
363+
'validators'=> array (
364364
0 => array ( 'type' => 'ISDATETIME',
365365
'allowempty' => 'y',
366366
'errmsg'=> 'autoresponder_start_date_is_no_date'),
@@ -373,7 +373,7 @@
373373
'autoresponder_end_date' => array (
374374
'datatype' => 'DATETIME',
375375
'formtype' => 'DATETIME',
376-
'validators'=> array (
376+
'validators'=> array (
377377
0 => array ( 'type' => 'ISDATETIME',
378378
'allowempty' => 'y',
379379
'errmsg'=> 'autoresponder_end_date_is_no_date'),

0 commit comments

Comments
 (0)