Fix issue with Adding Local DNS Records does not add to /etc/pihole/custom.list when using grep 3.10 (#5269)

This commit is contained in:
Adam Warner 2023-05-27 11:28:19 +01:00 committed by GitHub
commit 82b60b09d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -664,7 +664,7 @@ checkDomain()
local domain validDomain
# Convert to lowercase
domain="${1,,}"
validDomain=$(grep -P "^((-|_)*[a-z\\d]((-|_)*[a-z\\d])*(-|_)*)(\\.(-|_)*([a-z\\d]((-|_)*[a-z\\d])*))*$" <<< "${domain}") # Valid chars check
validDomain=$(grep -P "^((-|_)*[a-z0-9]((-|_)*[a-z0-9)*(-|_)*)(\\.(-|_)*([a-z0-9]((-|_)*[a-z0-9])*))*$" <<< "${domain}") # Valid chars check
validDomain=$(grep -P "^[^\\.]{1,63}(\\.[^\\.]{1,63})*$" <<< "${validDomain}") # Length of each label
echo "${validDomain}"
}