Skip to content

Commit 050e033

Browse files
committed
check AAAA and CNAME for duplicate records. fixes #5623
1 parent 4c0c99a commit 050e033

33 files changed

+42
-9
lines changed

interface/web/dns/dns_aaaa_edit.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@
4545
// Loading classes
4646
class page_action extends dns_page_action {
4747

48+
protected function checkDuplicate() {
49+
global $app;
50+
//* Check for duplicates where IP and hostname are the same
51+
$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE (type = 'AAAA' AND name = ? AND zone = ? and data = ? and id != ?) OR (type = 'CNAME' AND name = ? AND zone = ? and id != ?)", $this->dataRecord["name"], $this->dataRecord["zone"], $this->dataRecord["data"], $this->id, $this->dataRecord["name"], $this->dataRecord["zone"], $this->id);
52+
if($tmp['number'] > 0) return true;
53+
return false;
54+
}
55+
4856
}
4957

5058
$page = new page_action;

interface/web/dns/dns_cname_edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class page_action extends dns_page_action {
4848
protected function checkDuplicate() {
4949
global $app;
5050
//* Check for duplicates where IP and hostname are the same
51-
$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE (type = 'A' AND name = ? AND zone = ? and id != ?) OR (type = 'CNAME' AND name = ? AND zone = ? and id != ?)", $this->dataRecord["name"], $this->dataRecord["zone"], $this->id, $this->dataRecord["name"], $this->dataRecord["zone"], $this->id);
51+
$tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_rr WHERE (type = 'A' AND name = ? AND zone = ? and id != ?) OR (type = 'AAAA' AND name = ? AND zone = ? and id != ?) OR (type = 'CNAME' AND name = ? AND zone = ? and id != ?)", $this->dataRecord["name"], $this->dataRecord["zone"], $this->id, $this->dataRecord["name"], $this->dataRecord["zone"], $this->id, $this->dataRecord["name"], $this->dataRecord["zone"], $this->id);
5252
if($tmp['number'] > 0) return true;
5353
return false;
5454
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ $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['ip_error_wrong'] = 'IP-Address format invalid';
15-
$wb['data_error_duplicate'] = 'Duplicate A-Record';
15+
$wb['data_error_duplicate'] = 'Duplicate A or CNAME Record';
1616
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
1717
?>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ $wb['no_zone_perm'] = 'You do not have the permission to add a record to this DN
1111
$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';
14+
$wb['data_error_duplicate'] = 'Duplicate AAAA or CNAME Record';
1415
$wb['ip_error_wrong'] = 'IP-Address format invalid';
1516
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
1617
?>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ $wb['no_zone_perm'] = 'Вие нямате право да добавяте за
1111
$wb['name_error_empty'] = 'Полето с имейла е празно.';
1212
$wb['name_error_regex'] = 'The hostname has the wrong format.';
1313
$wb['data_error_empty'] = 'IP-Address empty';
14+
$wb['data_error_duplicate'] = 'Duplicate AAAA or CNAME Record';
1415
$wb['ip_error_wrong'] = 'IP-Address format invalid';
1516
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
1617
?>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ $wb['no_zone_perm'] = 'Você não tem permissão para adicionar registros dns ne
1111
$wb['name_error_empty'] = 'O nome do host está em branco.';
1212
$wb['name_error_regex'] = 'O nome do host possui formato inválido (somente nomes canônicos são suportados).';
1313
$wb['data_error_empty'] = 'Endereço IPv6 está em branco.';
14+
$wb['data_error_duplicate'] = 'Duplicate AAAA or CNAME Record';
1415
$wb['ip_error_wrong'] = 'O endereço IPv6 possui formato inválido.';
1516
$wb['ttl_range_error'] = 'O TTL mínimo são 60 segundos.';
1617
?>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ $wb['no_zone_perm'] = 'Vous n\'avez pas la permission d\'ajouter un enregistreme
1111
$wb['name_error_empty'] = 'Le nom d\'hôte est vide.';
1212
$wb['name_error_regex'] = 'Le format du nom d\'hôte est invalide.';
1313
$wb['data_error_empty'] = 'L\'adresse IP est vide.';
14+
$wb['data_error_duplicate'] = 'Duplicate AAAA or CNAME Record';
1415
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
1516
$wb['ip_error_wrong'] = 'IP-Address format invalid';
1617
?>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ $wb['no_zone_perm'] = 'Nemáte oprávnění přidat záznam do této zóny.';
1111
$wb['name_error_empty'] = 'Název hostitele je prázdný.';
1212
$wb['name_error_regex'] = 'Název hostitele má chybný formát.';
1313
$wb['data_error_empty'] = 'IP adresa je prázdná';
14+
$wb['data_error_duplicate'] = 'Duplicate AAAA or CNAME Record';
1415
$wb['ttl_range_error'] = 'Min. TTL doba je 60 sekund.';
1516
$wb['ip_error_wrong'] = 'IP - formát adresy neplatný';
1617
?>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ $wb['no_zone_perm'] = 'Sie haben nicht die Berechtigung, einen Eintrag zu dieser
1111
$wb['name_error_empty'] = 'Der Hostname ist leer.';
1212
$wb['name_error_regex'] = 'Der Hostname hat das falsche Format.';
1313
$wb['data_error_empty'] = 'IPv6 Adresse ist leer';
14+
$wb['data_error_duplicate'] = 'Duplicate AAAA or CNAME Record';
1415
$wb['ip_error_wrong'] = 'IPv6 Adressen Format ist ungültig';
1516
$wb['ttl_range_error'] = 'Min. TTL time is 60 seconds.';
1617
?>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ $wb['no_zone_perm'] = 'Du har ikke tilladelse til at tilføje en post til denne
1111
$wb['name_error_empty'] = 'Værtsnavnet er tomt.';
1212
$wb['name_error_regex'] = 'Værtsnavnet har et forkert format.';
1313
$wb['data_error_empty'] = 'IP-Adressen er tom';
14+
$wb['data_error_duplicate'] = 'Duplicate AAAA or CNAME Record';
1415
$wb['ttl_range_error'] = 'Min. TTL tid er 60 sekunder.';
1516
$wb['ip_error_wrong'] = 'IP-Address format invalid';
1617
?>

0 commit comments

Comments
 (0)