From fe38275cb5521c9a8c52b7fe42e97c002dffe39b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Peters?= Date: Sat, 21 Sep 2019 14:16:50 +0200 Subject: [PATCH] Revert "Make is_valid_domain_name more strict" --- data/web/inc/functions.inc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/data/web/inc/functions.inc.php b/data/web/inc/functions.inc.php index 93b8d968..34c63cde 100644 --- a/data/web/inc/functions.inc.php +++ b/data/web/inc/functions.inc.php @@ -709,14 +709,14 @@ function user_get_alias_details($username) { } return $data; } -function is_valid_domain_name($domain_name) { +function is_valid_domain_name($domain_name) { if (empty($domain_name)) { return false; } $domain_name = idn_to_ascii($domain_name, 0, INTL_IDNA_VARIANT_UTS46); - return (preg_match("/^([a-z\d](-*[a-z\d])*)\.(([a-z\d](-*[a-z\d])*))*$/i", $domain_name) + return (preg_match("/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i", $domain_name) && preg_match("/^.{1,253}$/", $domain_name) - && preg_match("/^[^\.]{1,63}\.([^\.]{1,63})*$/", $domain_name)); + && preg_match("/^[^\.]{1,63}(\.[^\.]{1,63})*$/", $domain_name)); } function set_tfa($_data) { global $lang;