mirror of
https://github.com/Froxlor/Froxlor.git
synced 2024-09-21 10:27:29 +00:00
validate record/label in dns-editor; better escaping for soa-admin mail
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
parent
b029fe113e
commit
b14ab6b1c1
@ -51,7 +51,24 @@ if ($action == 'add_record' && ! empty($_POST)) {
|
||||
|
||||
$record = strtolower($record);
|
||||
|
||||
// TODO regex validate record and content for invalid characters
|
||||
if ($record != '@' && $record != '*')
|
||||
{
|
||||
// validate record
|
||||
if (strpos($record, '--') !== false) {
|
||||
$errors[] = $lng['error']['domain_nopunycode'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$record = $idna_convert->encode($record);
|
||||
$check_dom = $record.'.example.com';
|
||||
if (!validateDomain($check_dom))
|
||||
{
|
||||
$errors[] = sprintf($lng['error']['subdomainiswrong'], $idna_convert->decode($record));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO regex validate content for invalid characters
|
||||
|
||||
if ($ttl <= 0) {
|
||||
$ttl = 18000;
|
||||
|
@ -266,7 +266,7 @@ function createDomainZone($domain_id, $froxlorhostname = false)
|
||||
}
|
||||
|
||||
// TODO for now, dummy time-periods
|
||||
$soa_content = $primary_ns . " " . str_replace('@', '.', Settings::Get('panel.adminmail')) . ". (" . PHP_EOL;
|
||||
$soa_content = $primary_ns . " " . escapeSoaAdminMail(Settings::Get('panel.adminmail')) . " (" . PHP_EOL;
|
||||
$soa_content .= $domain['bindserial'] . "\t; serial" . PHP_EOL;
|
||||
$soa_content .= "1800\t; refresh (30 mins)" . PHP_EOL;
|
||||
$soa_content .= "900\t; retry (15 mins)" . PHP_EOL;
|
||||
@ -302,3 +302,10 @@ function encloseTXTContent($txt_content, $isMultiLine = false)
|
||||
}
|
||||
return $txt_content;
|
||||
}
|
||||
|
||||
function escapeSoaAdminMail($email)
|
||||
{
|
||||
$mail_parts = explode("@", $email);
|
||||
$escpd_mail = str_replace(".", "\.", $mail_parts[0]).".".$mail_parts[1].".";
|
||||
return $escpd_mail;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user