Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/pi-hole/pi-hole.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Warner <me@adamwarner.co.uk>2019-11-30 20:45:07 +0300
committerAdam Warner <me@adamwarner.co.uk>2019-11-30 20:45:07 +0300
commit76460f01e9c70905b7ac82d9a294855c6bfd19bc (patch)
tree5a233cd3c06ef7c7ee5b8c887923a20b864015ca /advanced
parent4b8a72fda71bae5cc0ed2cfb6ba5bbb70a623b89 (diff)
Change the regex used for domain validation
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
Diffstat (limited to 'advanced')
-rwxr-xr-xadvanced/Scripts/list.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/advanced/Scripts/list.sh b/advanced/Scripts/list.sh
index 5fbe831f..50541872 100755
--- a/advanced/Scripts/list.sh
+++ b/advanced/Scripts/list.sh
@@ -84,8 +84,8 @@ ValidateDomain() {
if [[ ( "${typeId}" == "3" || "${typeId}" == "2" ) && "${wildcard}" == false ]]; then
validDomain="${domain}"
else
- validDomain=$(grep -P "^((-|_)*[a-z\\d]((-|_)*[a-z\\d])*(-|_)*)(\\.(-|_)*([a-z\\d]((-|_)*[a-z\\d])*))*$" <<< "${domain}") # Valid chars check
- validDomain=$(grep -P "^[^\\.]{1,63}(\\.[^\\.]{1,63})*$" <<< "${validDomain}") # Length of each label
+ # Use regex to check the validity of the passed domain. see https://regexr.com/3abjr
+ validDomain=$(grep -P "^((?!-))(xn--)?[a-z0-9][a-z0-9-_]{0,61}[a-z0-9]{0,1}\.(xn--)?([a-z0-9\-]{1,61}|[a-z0-9-]{1,30}\.[a-z]{2,})$" <<< "${domain}")
fi
fi