Skip to content

Commit 8d3061f

Browse files
committed
Fixed: FS#1318 - Bind won't load zone if multiple entries exist for same hostname
1 parent 957aaf3 commit 8d3061f

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

interface/web/dns/dns_a_edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ function onSubmit() {
9797
} // end if user is not admin
9898

9999
//* Check for duplicates where IP and hostname are the same
100-
$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE type = 'A' AND name = '".$this->dataRecord["name"]."' AND zone = '".$this->dataRecord["zone"]."' and data = '".$this->dataRecord["data"]."' and id != ".$this->id);
100+
$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE (type = 'A' AND name = '".$this->dataRecord["name"]."' AND zone = '".$this->dataRecord["zone"]."' and data = '".$this->dataRecord["data"]."' and id != ".$this->id.") OR (type = 'CNAME' AND name = '".$this->dataRecord["name"]."' AND zone = '".$this->dataRecord["zone"]."' and id != ".$this->id.")");
101101
if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("data_error_duplicate")."<br>";
102102
unset($tmp);
103103

interface/web/dns/dns_cname_edit.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ function onSubmit() {
9696
}
9797
} // end if user is not admin
9898

99+
//* Check for duplicates where IP and hostname are the same
100+
$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE (type = 'A' AND name = '".$this->dataRecord["name"]."' AND zone = '".$this->dataRecord["zone"]."' and id != ".$this->id.") OR (type = 'CNAME' AND name = '".$this->dataRecord["name"]."' AND zone = '".$this->dataRecord["zone"]."' and id != ".$this->id.")");
101+
if($tmp['number'] > 0) $app->tform->errorMessage .= $app->tform->lng("data_error_duplicate")."<br>";
102+
unset($tmp);
103+
99104

100105
// Set the server ID of the rr record to the same server ID as the parent record.
101106
$this->dataRecord["server_id"] = $soa["server_id"];

interface/web/dns/lib/lang/en_dns_a.lng

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ $wb["name_error_empty"] = 'The hostname is empty.';
1212
$wb["name_error_regex"] = 'The hostname has the wrong format.';
1313
$wb["data_error_empty"] = 'IP-Address empty';
1414
$wb["data_error_regex"] = 'IP-Address format invalid';
15-
$wb["data_error_duplicate"] = 'Duplicate A-Record';
15+
$wb["data_error_duplicate"] = 'Duplicate A-Record or CNAME-Record';
1616
?>

interface/web/dns/lib/lang/en_dns_cname.lng

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ $wb["name_error_empty"] = 'The hostname is empty.';
1212
$wb["name_error_regex"] = 'The hostname has the wrong format.';
1313
$wb["data_error_empty"] = 'Target hostname empty';
1414
$wb["data_error_regex"] = 'Target hostname format invalid';
15+
$wb["data_error_duplicate"] = 'Duplicate A-Record or CNAME-Record';
1516
?>

0 commit comments

Comments
 (0)