From fdd6fee6b96279edc1758fb7d8990153632069a4 Mon Sep 17 00:00:00 2001
From: ftimme <ft@falkotimme.com>
Date: Fri, 30 Dec 2005 16:22:11 +0000
Subject: [PATCH]

---
 interface/web/dns/list/rr.list.php |  2 +-
 interface/web/dns/rr_edit.php      | 17 +++++++++++++++--
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/interface/web/dns/list/rr.list.php b/interface/web/dns/list/rr.list.php
index 24becc22c7..fc33958937 100644
--- a/interface/web/dns/list/rr.list.php
+++ b/interface/web/dns/list/rr.list.php
@@ -40,7 +40,7 @@ $liste["delete_file"]                = "rr_del.php";
 $liste["paging_tpl"]                = "templates/paging.tpl.htm";
 
 // Enable auth
-$liste["auth"]                                = "no";
+$liste["auth"]                                = "yes";
 
 
 /*****************************************************
diff --git a/interface/web/dns/rr_edit.php b/interface/web/dns/rr_edit.php
index 7a5ea61572..8d0f9f3b5e 100644
--- a/interface/web/dns/rr_edit.php
+++ b/interface/web/dns/rr_edit.php
@@ -118,7 +118,22 @@ class page_action extends tform_actions {
 
                       // if IP address changes, delete/change old PTR record
                       if(!empty($old_record)){
+
+
+
+
                         list($oa, $ob, $oc, $od) = explode('.', $old_record['data']);
+                        $old_ptr_soa = $oc.'.'.$ob.'.'.$oa.'.in-addr.arpa.';
+                        $old_ptr_soa_exist = $app->db->queryOneRecord("SELECT * FROM soa WHERE origin = '".$old_ptr_soa."'");
+                        if(substr($old_record['name'], -1) == '.'){
+                          $old_ptr_soa_rr_data = $old_record['name'];
+                        } else {
+                          $old_ptr_soa_rr_data = $old_record['name'].(trim($old_record['name']) == '' ? '' : '.').$soa['origin'];
+                        }
+                        if(!$app->db->queryOneRecord("SELECT * FROM rr WHERE zone = '".$old_ptr_soa_exist['id']."' AND name = '".$od."' AND type = 'PTR' AND data = '".$old_ptr_soa_rr_data."'")){
+                          parent::onSubmit();
+                          return true;
+                        }
 
                         if($old_record['data'] == $this->dataRecord['data']){
                           $a_rr_with_same_ip = $this->dataRecord;
@@ -126,8 +141,6 @@ class page_action extends tform_actions {
                         } else {
                           $a_rr_with_same_ip = $app->db->queryOneRecord("SELECT rr.*, soa.origin FROM rr, soa WHERE rr.type = 'A' AND rr.data = '".$old_record['data']."' AND rr.zone = soa.id AND soa.active = 'Y' AND rr.id != ".$this->dataRecord["id"]);
                         }
-                        $old_ptr_soa = $oc.'.'.$ob.'.'.$oa.'.in-addr.arpa.';
-                        $old_ptr_soa_exist = $app->db->queryOneRecord("SELECT * FROM soa WHERE origin = '".$old_ptr_soa."'");
 
                         if($a_rr_with_same_ip){
                           if(substr($a_rr_with_same_ip['name'], -1) == '.'){
-- 
GitLab