allow defined non-existing entry for SRV target-value

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2016-05-20 16:17:33 +02:00
parent 61eab6fd93
commit be373e278f

View File

@@ -144,11 +144,6 @@ if ($action == 'add_record' && ! empty($_POST)) {
if ($prio === null || $prio < 0) { if ($prio === null || $prio < 0) {
$errors[] = $lng['error']['dns_srv_prioempty']; $errors[] = $lng['error']['dns_srv_prioempty'];
} }
// check for trailing dot
if (substr($content, - 1) == '.') {
// remove it for checks
$content = substr($content, 0, - 1);
}
// check only last part of content, as it can look like: // check only last part of content, as it can look like:
// _service._proto.name. TTL class SRV priority weight port target. // _service._proto.name. TTL class SRV priority weight port target.
$_split_content = explode(" ", $content); $_split_content = explode(" ", $content);
@@ -157,6 +152,13 @@ if ($action == 'add_record' && ! empty($_POST)) {
$errors[] = $lng['error']['dns_srv_invalidcontent']; $errors[] = $lng['error']['dns_srv_invalidcontent'];
} }
$target = trim($_split_content[count($_split_content) - 1]); $target = trim($_split_content[count($_split_content) - 1]);
if ($target != '.') {
// check for trailing dot
if (substr($target, - 1) == '.') {
// remove it for checks
$target = substr($target, 0, - 1);
}
}
if (! validateDomain($target)) { if (! validateDomain($target)) {
$errors[] = $lng['error']['dns_srv_needdom']; $errors[] = $lng['error']['dns_srv_needdom'];
} else { } else {
@@ -170,7 +172,9 @@ if ($action == 'add_record' && ! empty($_POST)) {
} }
} }
// append trailing dot (again) // append trailing dot (again)
$content .= '.'; if ($target != '.') {
$content .= '.';
}
} }
$new_entry = array( $new_entry = array(