add extra validation for new domains

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2023-11-11 14:31:45 +01:00
parent 1f74bf059c
commit ace1651ceb
4 changed files with 5 additions and 1 deletions

View File

@@ -349,6 +349,8 @@ class Domains extends ApiCommand implements ResourceEntity
if (substr($p_domain, 0, 4) == 'xn--') {
Response::standardError('domain_nopunycode', '', true);
} elseif (Validate::validate_ip2($p_domain, true, '', true, true)) {
Response::standardError('domain_noipaddress', '', true);
}
$idna_convert = new IdnaWrapper();

View File

@@ -224,7 +224,7 @@ class Validate
* Check if the submitted string is a valid domainname
*
* @param string $domainname The domainname which should be checked.
* @param bool $allow_underscore optional if true, allowes the underscore character in a domain label (DKIM etc.)
* @param bool $allow_underscore optional if true, allows the underscore character in a domain label (DKIM etc.)
*
* @return string|boolean the domain-name if the domain is valid, false otherwise
*/

View File

@@ -920,6 +920,7 @@ return [
'dns_duplicate_entry' => 'Eintrag existiert bereits',
'dns_notfoundorallowed' => 'Domain nicht gefunden oder keine Berechtigung',
'domain_nopunycode' => 'Die Eingabe von Punycode (IDNA) ist nicht notwendig. Die Domain wird automatisch konvertiert.',
'domain_noipaddress' => 'Eine IP-Adresse kann nicht als Domain angelegt werden',
'dns_record_toolong' => 'Records/Labels können maximal 63 Zeichen lang sein',
'noipportgiven' => 'Keine IP/Port angegeben',
'nosslippportgiven' => 'Wenn SSL aktiviert ist, muss eine SSL IP/Port angegeben werden',

View File

@@ -992,6 +992,7 @@ return [
'dns_duplicate_entry' => 'Record already exists',
'dns_notfoundorallowed' => 'Domain not found or no permission',
'domain_nopunycode' => 'You must not specify punycode (IDNA). The domain will automatically be converted',
'domain_noipaddress' => 'Cannot add an IP address as domain',
'dns_record_toolong' => 'Records/labels can only be up to 63 characters',
'noipportgiven' => 'No IP/port given',
'nosslippportgiven' => 'When enabling SSL you need to select a SSL IP/port',