Avoid cname loops

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
This commit is contained in:
RD WebDesign
2022-10-20 02:35:55 -03:00
parent 76bf7d74c9
commit 39f23fde76

View File

@@ -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();