mirror of
https://github.com/pi-hole/web.git
synced 2026-04-26 03:40:09 +01:00
Avoid cname loops
Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
This commit is contained in:
@@ -392,12 +392,17 @@ function addCustomCNAMEEntry($domain = '', $target = '', $reload = '', $json = t
|
||||
return returnError('Target must be valid', $json);
|
||||
}
|
||||
|
||||
// Check if each submitted domain is valid
|
||||
$domains = array_map('trim', explode(',', $domain));
|
||||
foreach ($domains as $d) {
|
||||
// Check if each submitted domain is valid
|
||||
if (!validDomain($d)) {
|
||||
return returnError("Domain '{$d}' is not valid", $json);
|
||||
}
|
||||
|
||||
// Check if each submitted domain is different than the target to avoid loops
|
||||
if (strtolower($d) === strtolower($target)) {
|
||||
return returnError('Domain and target cannot be the same', $json);
|
||||
}
|
||||
}
|
||||
|
||||
$existingEntries = getCustomCNAMEEntries();
|
||||
|
||||
Reference in New Issue
Block a user