1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-22 23:08:07 +00:00

Merge pull request #1173 from pi-hole/tweak/domainfilter

Improve CLI domain filter
This commit is contained in:
Dan Schaper 2017-01-27 11:16:18 -08:00 committed by GitHub
commit a5c6bbeee7

View File

@ -66,7 +66,7 @@ HandleOther(){
domain=$(sed -e "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/" <<< "$1")
#check validity of domain
validDomain=$(perl -ne "print if /\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}\b/" <<< "$domain")
validDomain=$(perl -ne 'print if /^(?!.*[^a-z0-9-\.].*)\b((?=[a-z0-9-]{1,63}\.)(xn--)?[a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,63}\b/' <<< "$domain")
if [ -z "${validDomain}" ]; then
echo "::: $1 is not a valid argument or domain name"
else