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

Prevent CNAME loop (#4988)

This commit is contained in:
yubiuser 2022-10-29 15:44:03 +02:00 committed by GitHub
commit 01bf9ca42a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -738,7 +738,12 @@ AddCustomCNAMERecord() {
if [[ -n "${validDomain}" ]]; then if [[ -n "${validDomain}" ]]; then
validTarget="$(checkDomain "${target}")" validTarget="$(checkDomain "${target}")"
if [[ -n "${validTarget}" ]]; then if [[ -n "${validTarget}" ]]; then
if [ "${validDomain}" = "${validTarget}" ]; then
echo " ${CROSS} Domain and target are the same. This would cause a DNS loop."
exit 1
else
echo "cname=${validDomain},${validTarget}" >> "${dnscustomcnamefile}" echo "cname=${validDomain},${validTarget}" >> "${dnscustomcnamefile}"
fi
else else
echo " ${CROSS} Invalid Target Passed!" echo " ${CROSS} Invalid Target Passed!"
exit 1 exit 1