From be373e278fcff764e4b99d4b6f65e33344a37cdd Mon Sep 17 00:00:00 2001 From: "Michael Kaufmann (d00p)" Date: Fri, 20 May 2016 16:17:33 +0200 Subject: [PATCH] allow defined non-existing entry for SRV target-value Signed-off-by: Michael Kaufmann (d00p) --- dns_editor.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/dns_editor.php b/dns_editor.php index adebd536..325fe1d7 100644 --- a/dns_editor.php +++ b/dns_editor.php @@ -144,11 +144,6 @@ if ($action == 'add_record' && ! empty($_POST)) { if ($prio === null || $prio < 0) { $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: // _service._proto.name. TTL class SRV priority weight port target. $_split_content = explode(" ", $content); @@ -157,6 +152,13 @@ if ($action == 'add_record' && ! empty($_POST)) { $errors[] = $lng['error']['dns_srv_invalidcontent']; } $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)) { $errors[] = $lng['error']['dns_srv_needdom']; } else { @@ -170,7 +172,9 @@ if ($action == 'add_record' && ! empty($_POST)) { } } // append trailing dot (again) - $content .= '.'; + if ($target != '.') { + $content .= '.'; + } } $new_entry = array(