From da27c0bde3991ad4e9939b3d79ecfbec72cdd152 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 30 Mar 2006 11:01:07 +0000 Subject: [PATCH] added new zone management (zone editor is not updated yet) git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2930 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/systems/class_servDNS.inc | 436 +++++------------- .../admin/systems/class_servDNSeditZone.inc | 66 +-- plugins/admin/systems/class_termDNS.inc | 5 +- 3 files changed, 153 insertions(+), 354 deletions(-) diff --git a/plugins/admin/systems/class_servDNS.inc b/plugins/admin/systems/class_servDNS.inc index fb0cd3241..7bc056a17 100644 --- a/plugins/admin/systems/class_servDNS.inc +++ b/plugins/admin/systems/class_servDNS.inc @@ -13,13 +13,10 @@ class servdns extends plugin var $objectclasses = array("whatever"); var $RecordTypes = array(); + var $Zones = array(); + var $dialog = NULL; - var $Zones = array(); - var $dialog = NULL; - - var $usedDNS = array(); - - var $orig_dn = ""; + var $orig_dn = ""; var $DNSinitially_was_account; @@ -30,134 +27,25 @@ class servdns extends plugin $this->orig_dn = $dn; - /* All types with required attrs */ - $this->RecordTypes['aRecord'] = "aRecord"; // ok - $this->RecordTypes['mDRecord'] = "mDRecord"; // ok - $this->RecordTypes['mXRecord'] = "mXRecord"; // ok - $this->RecordTypes['nSRecord'] = "nSRecord"; // ok - $this->RecordTypes['hInfoRecord'] = "hInfoRecord"; // ok - $this->RecordTypes['mInfoRecord'] = "mInfoRecord"; // ok -// $this->RecordTypes['tXTRecord'] = "tXTRecord"; // ok - $this->RecordTypes['aFSDBRecord'] = "aFSDBRecord"; // ok - $this->RecordTypes['SigRecord'] = "SigRecord"; // ok - $this->RecordTypes['KeyRecord'] = "KeyRecord"; // ok - $this->RecordTypes['aAAARecord'] = "aAAARecord"; // ok - $this->RecordTypes['LocRecord'] = "LocRecord"; // ok - $this->RecordTypes['nXTRecord'] = "nXTRecord"; // ok - $this->RecordTypes['sRVRecord'] = "sRVRecord"; // ok - $this->RecordTypes['nAPTRRecord'] = "nAPTRRecord"; // ok - $this->RecordTypes['kXRecord'] = "kXRecord"; // ok - $this->RecordTypes['certRecord'] = "certRecord"; // ok - $this->RecordTypes['a6Record'] = "a6Record"; // ok - $this->RecordTypes['dSRecord'] = "dSRecord"; // ok - $this->RecordTypes['sSHFPRecord'] = "sSHFPRecord"; // ok - $this->RecordTypes['rRSIGRecord'] = "rRSIGRecord"; // ok - $this->RecordTypes['nSECRecord'] = "nSECRecord"; // ok - - $types = array(); - - /* Get all records */ - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->dn); - $ldap->ls("(&(objectClass=dNSZone)(relativeDomainName=@))",$dn,array("*")); - - while($attrs = $ldap->fetch()){ - - /* If relative domainname - * Try to read dnsclass / TTl / zone - */ - $this->usedDNS[$attrs['dn']] = $attrs['dn']; - if((isset($attrs['tXTRecord'][0]))&&(preg_match("/zoneName\=/",$attrs['tXTRecord'][0]))){ - $zoneName= preg_replace("/zoneName\=/","",$attrs['tXTRecord'][0]); - $z = preg_replace("/\.in\-addr\.arpa/","",$attrs['zoneName'][0]); - - $z = $this->FlipIp($z); - - $types[$zoneName]['ReverseZone'] = $z; - $types[$zoneName]['ReverseDN'] = $attrs['dn']; - }else{ - - /* Generate SOA entry - */ - if(isset($attrs['sOARecord'][0])){ - $tmp = split("\ ",$attrs['sOARecord'][0]) ; - $tmp2 = array(); - $ar = array("0"=>"sOAprimary","1"=>"sOAmail","2"=>"sOAserial","3"=>"sOArefresh","4"=>"sOAretry","5"=>"sOAexpire","6"=>"sOAttl"); - - /* Assign soa vars */ - foreach($ar as $key => $name){ - if(isset($tmp[$key])){ - $types[$attrs['zoneName'][0]][$name] = $tmp[$key]; - }else{ - $types[$attrs['zoneName'][0]][$name] = ""; - } - } - } - - /* Set dns Class - */ - if(isset($attrs['dNSClass'][0])){ - $types[$attrs['zoneName'][0]]['dNSClass'] = $attrs['dNSClass'][0]; - } - - /* Set zone Name - */ - if(isset($attrs['zoneName'][0])){ - $types[$attrs['zoneName'][0]]['zoneName'] = $attrs['zoneName'][0]; - } - - /* Create list with all used records - */ - foreach($this->RecordTypes as $name => $value){ - - /* If there is a record attribute - */ - if(isset($attrs[$name])){ - - /* get all entries - */ - for($i = 0 ; $i < $attrs[$value]['count']; $i ++){ - $types[$attrs['zoneName'][0]]['Records'][] =array("type" =>$name, - "inittype" =>$name, - "value" =>$attrs[$value][$i], - "status" =>"edited", - "dn" =>$attrs['dn']); - } - } - } - } - } + /* Get record types for zones + */ + $this->RecordTypes = getDnsRecordTypes(true); + /* Get all zone Informations + */ + $this->Zones = getDNSZoneEntries($config,$dn); + /* If there is at least one entry in this -> types, we have DNS enabled */ - $this->Zones = $types; if(count($this->Zones) == 0){ $this->is_account = false; }else{ $this->is_account = true; } - - /* Store initally account settings - */ $this->DNSinitially_was_account = $this->is_account; } - /* this is used to flip the ip address for example - 12.3.45 -> 54.3.12 - Because some entries (like zones) are store like that 54.3.12.in-addr.arpa - but we want to display 12.3.45. - */ - function FlipIp($ip) - { - $tmp = array_reverse(split("\.",$ip)); - $new = ""; - foreach($tmp as $section){ - $new .= $section."."; - } - return(preg_replace("/.$/","",$new)); - } - function execute() { /* Call parent execute @@ -175,8 +63,6 @@ class servdns extends plugin $this->is_account= !$this->is_account; } - /* Show tab dialog headers - */ if ($this->is_account){ $display= $this->show_header(_("Remove DNS service"), _("This server has DNS features enabled. You can disable them by clicking below.")); @@ -186,26 +72,26 @@ class servdns extends plugin return ($display); } - /* Edited or Added zone hould be saved saved + + /* Edited or Added zone */ if(isset($_POST['SaveZoneChanges'])){ $this->dialog->save_object(); - /* Check if noting went wrong + /* Check for errors */ if(count($this->dialog->check())){ foreach($this->dialog->check() as $msgs){ print_red($msgs); } }else{ - /* add new/edited zone */ $ret = $this->dialog->save(); - $ret['InitialzoneName']= $this->dialog->InitiallyZoneName; - $ret['InitialreverseZone']= $this->dialog->InitiallyReverseZone; - unset($this->Zones[$this->dialog->InitiallyZoneName]); - $this->Zones[$ret['zoneName']] = $ret; + if(!$this->dialog->isNew){ + unset($this->Zones[$this->dialog->OldZoneName]); + } + $this->Zones[$ret['zoneName']] = $ret; $this->dialog = NULL; } } @@ -219,7 +105,7 @@ class servdns extends plugin /* Add empty new zone */ if(isset($_POST['AddZone'])){ - $this->dialog = new servdnseditZone($this->config,$this->dn,$this->RecordTypes); + $this->dialog = new servdnseditZone($this->config,$this->dn); } /* Check for edit zone request @@ -233,44 +119,20 @@ class servdns extends plugin $once =true; $tmp = preg_replace("/^editZone_/","",$name); $tmp = base64_decode(preg_replace("/_.*$/","",$tmp)); - $this->dialog= new servdnseditZone($this->config,$this->dn,$this->RecordTypes,$this->Zones[$tmp]); + $this->dialog= new servdnseditZone($this->config,$this->dn,$this->Zones[$tmp]); } /* check posts for delete zone */ if(preg_match("/^delZone_/",$name)&&!$once){ + $once =true; $tmp = preg_replace("/^delZone_/","",$name); $tmp = base64_decode(preg_replace("/_.*$/","",$tmp)); - - $zones = $this->getUsedZoneNames(); - - if(isset($this->Zones[$tmp]['InitialreverseZone'])){ - $rev = $this->FlipIp($this->Zones[$tmp]['InitialreverseZone']); - }else{ - $rev = $this->FlipIp($this->Zones[$tmp]['ReverseZone']); - } - - if(isset($this->Zones[$tmp]['InitialzoneName'])){ - $tmp= $this->Zones[$tmp]['InitialzoneName']; - } - - $res = array_merge(($zones[$tmp]),($zones[$rev.".in-addr.arpa"])); - - if(count($res)){ - $i = 2; - $str =""; - foreach($res as $dn){ - if($i > 0 ){ - $i --; - $str.=$dn." "; - } - } - if(count($res)> 2) $str .=" ... "; - print_red(sprintf(_("Can't delete the selected zone, because it is still in use by these entry/entries '%s'"),trim($str))); - }else{ -// unset($this->Zones[$tmp]); - } + + /* Initiate deletion + */ + $this->RemoveZone($tmp); } } @@ -309,6 +171,63 @@ class servdns extends plugin } + /* Delete specified zone + */ + function RemoveZone($id) + { + $zones = $this->getUsedZoneNames(); + + if(isset($this->Zones[$id]['InitialReverseZone'])){ + $rev = FlipIp($this->Zones[$id]['InitialReverseZone']); + }else{ + $rev = FlipIp($this->Zones[$id]['ReverseZone']); + } + + $zonename = ""; + if(isset($this->Zones[$id]['InitialzoneName'])){ + $zonename= $this->Zones[$id]['InitialzoneName']; + } + + $used = array(); + + /* Add Records which use this zoneName + */ + if(isset($zones[$zonename])){ + $used = array_merge($used,$zones[$zonename]); + } + + /* Add Records which uses this reverse zone + */ + if(isset($zones[$rev.".in-addr.arpa"])){ + $used = array_merge($used,$zones[$rev.".in-addr.arpa"]); + } + + /* There are still entries using this configuration + * Abort deletion + */ + if(count($used)){ + $i = 2; + $str =""; + foreach($used as $dn){ + if($i > 0 ){ + $i --; + $str.=$dn." "; + } + } + + /* Only show 2 dns in the error message + */ + if(count($used)> 2) { + $str .=" ... "; + } + print_red(sprintf(_("Can't delete the selected zone, because it is still in use by these entry/entries '%s'"),trim($str))); + + }else{ + unset($this->Zones[$id]); + } + } + + /* This funtion returns all used Zonenames */ function getUsedZoneNames() @@ -316,13 +235,9 @@ class servdns extends plugin $ret = array(); $ldap = $this->config->get_ldap_link(); $ldap->cd($this->config->current['BASE']); - $ldap->search("(&(objectClass=dNSZone)(!(relativeDomainName=@))(zoneName=*))",array("zoneName","relativeDomainName","tXTRecord")); + $ldap->search("(&(objectClass=dNSZone)(!(relativeDomainName=@))(zoneName=*))",array("zoneName","relativeDomainName")); while($attr = $ldap->fetch()){ - if(preg_match("/in-addr\.arpa/",$attr['zoneName'][0])){ - $ret[$attr['zoneName'][0]][] = $attr['dn']; - }else{ - $ret[$attr['zoneName'][0]][] = $attr['dn']; - } + $ret[$attr['zoneName'][0]][] = $attr['dn']; } return($ret); } @@ -335,189 +250,66 @@ class servdns extends plugin if(!$this->DNSinitially_was_account){ return; } - - $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); - foreach($this->usedDNS as $dn){ - $ldap->cd($dn); - $ldap->rmdir_recursive($dn); - } - + print_red("Can't remove dns yet. returning without remove."); + return; $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->orig_dn); - $ldap->search("(&(objectClass=dNSZone)(zoneName=*)(relativeDomainName=@))",array("relativeDomainName","zoneName")); + $ldap->ls("(&(objectClass=dNSZone)(zoneName=*)(relativeDomainName=@))",$this->orig_dn,array("relativeDomainName","zoneName")); while($attr = $ldap->fetch()){ $ldap->cd($attr['dn']); $ldap->rmDir($attr['dn']); } - - show_ldap_error($ldap->get_error()); } - /* Save data to object */ - function save_object() - { - } - - - /* Check supplied data */ - function check() - { - $message= array(); - return ($message); - } - - /* Save to LDAP */ function save() { - /* Ldap conenction / var initialization - */ $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); - $actions =array("update"=>array(),"add"=>array(),"delete"=>array()); - - /* Generate entries for all zones, and check if they must be updated deleted added + $ldap->cd($this->config->current['BASE']); + + /* Get differences */ - foreach($this->Zones as $key => $zone){ - if(isset($zone['InitialzoneName']) && ($zone['zoneName'] != $zone['InitialzoneName'])){ - $dst = "zoneName=".$zone['zoneName'].",".$this->dn; - $src = "zoneName=".$zone['InitialzoneName'].",".$this->dn; - $this->recursive_move($src,$dst); - - $tmp['zoneName'] = $zone['zoneName']; - $ldap->search ("(&(objectClass=dNSZone)(zoneName=".$zone['InitialzoneName']."))",array("relativeDomainName")); - while($attrs = $ldap->fetch()){ - $ldap->cd($attrs['dn']); - $ldap->modify($tmp); - show_ldap_error($ldap->get_error()); - } - } - if(isset($zone['InitialreverseZone']) &&($zone['InitialreverseZone'] != $zone['ReverseZone'])){ - $dst = "zoneName=".$zone['ReverseZone'].",".$this->dn; - $src = "zoneName=".$zone['InitialreverseZone'].",".$this->dn; - $this->recursive_move($src,$dst); - - $tmp['zoneName'] = $zone['zoneName']; - $ldap->search ("(&(objectClass=dNSZone)(zoneName=".$zone['InitialzoneName']."))",array("relativeDomainName")); - while($attrs = $ldap->fetch()){ - $ldap->cd($attrs['dn']); - $ldap->modify($tmp); - show_ldap_error($ldap->get_error()); - } - } - - - /* Get ldap syntax - */ - $tmp = $this->generate_LDAP_entries($zone); - - /* Check if dn is new, or if entry was edited - */ - foreach($tmp as $key => $values){ - if(isset($this->usedDNS[$key])){ - $actions['update'][$key]=$values; - unset($this->usedDNS[$key]); - }else{ - $actions['add'][$key] = $values; - } - } - } - - /* Check which dns are not used anymore ... + $tmp = getDNSZoneEntriesDiff($this->config,$this->Zones,$this->orig_dn); + + /* Updated zone entries if reverser or forward name has changed + * Must be done before moving entries, else the given dn is invalid */ - foreach($this->usedDNS as $key => $values){ - $actions['delete'][$key] = $values; + if(isset($tmp['zoneUpdates'])){ + foreach($tmp['zoneUpdates'] as $dn => $attrs){ + $ldap->cd($dn); + $ldap->modify($attrs); + show_ldap_error("Zone:".$ldap->get_error()); + } } - /* Remove deleted zones + /* Delete dns */ - foreach($actions['delete'] as $dn => $attrs){ + foreach($tmp['del'] as $dn => $del){ $ldap->cd($dn); $ldap->rmdir_recursive($dn); + show_ldap_error("Zone:".$ldap->get_error()); } - /* Add new zones + /* move follwoing entries */ - foreach($actions['add'] as $dn => $attrs){ - $ldap->cd($this->config->current['BASE']); - $ldap->cd($dn); - $ldap->add($attrs); + foreach($tmp['move'] as $src => $dst){ + $this->recursive_move($src,$dst); } - /* Update existing entries + /* Add || Update new DNS entries */ - foreach($actions['update'] as $dn => $attrs){ + foreach($tmp['add'] as $dn => $attrs){ $ldap->cd($dn); - $ldap->modify ($attrs); - - } - - show_ldap_error($ldap->get_error()); - } - - - /* This function generates ldap friendly output - of all changes for a single zone (reverse and forward) - */ - function generate_LDAP_entries($zone) - { - $tmp = array(); - $tmp['objectClass'] = array("top","dNSZone"); - $tmp['dNSClass'] = "IN";//$zone['dNSClass']; - $tmp['relativeDomainName'] = "@";//$zone['relativeDomainName']; - - $str = ""; - foreach(array("sOAprimary","sOAmail","sOAserial","sOArefresh","sOAretry","sOAexpire","sOAttl") as $name){ - $str .= $zone[$name]." "; - } - $tmp['sOARecord'] = $str; - - - /* Generate Record entries - */ - $arr = array("aRecord","SigRecord","KeyRecord","aAAARecord","nSRecord","iaFSDBRecord","mInfoRecord","hInfoRecord","mXRecord","mDRecord","tXTRecord", - "LocRecord","nXTRecord","sRVRecord","nAPTRRecord","kXRecord","certRecord","a6Record","dSRecord","sSHFPRecord","rRSIGRecord","nSECRecord"); - $aRecords = array(); - foreach($arr as $ar){ - if((isset($zone['Records']))&&(is_array($zone['Records']))){ - foreach($zone['Records'] as $type){ - if(($type['type'] == $ar)&&($type['status']!="deleted")){ - $tmp[$ar][] = $type['value']; - } - } - } - } - /* Check if there are records removed, - if there are some removed records, then append an array - to ensure that these record types are deleted - */ - if((isset($zone['Records']))&&(is_array($zone['Records']))){ - foreach($zone['Records'] as $type){ - if((isset($type['inittype']))&&($type['inittype']!="")){ - if($type['type'] != $type['inittype']){ - $tmp[$type['inittype']] = array(); - } - } + $ldap->cat($dn); + if(count($ldap->fetch())){ + $ldap->cd($dn); + $ldap->modify ($attrs); + }else{ + $ldap->cd($dn); + $ldap->add($attrs); } } - - /* generate forward entry - */ - $dn = "zoneName=".$zone['zoneName'].",".$this->dn; - $tmp2[$dn] = $tmp; - $tmp2[$dn]['zoneName'] = $zone['zoneName']; - - /* generate reverse entry - */ - $dn = "zoneName=".$this->FlipIp($zone['ReverseZone']).".in-addr.arpa,".$this->dn; - $tmp2[$dn] = $tmp; - $tmp2[$dn]['tXTRecord'] ="zoneName=".$zone['zoneName']; - $tmp2[$dn]['zoneName'] = $this->FlipIp($zone['ReverseZone']).".in-addr.arpa"; - - return($tmp2); } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: diff --git a/plugins/admin/systems/class_servDNSeditZone.inc b/plugins/admin/systems/class_servDNSeditZone.inc index 2ab894396..9ec9c3ad0 100644 --- a/plugins/admin/systems/class_servDNSeditZone.inc +++ b/plugins/admin/systems/class_servDNSeditZone.inc @@ -13,13 +13,11 @@ class servdnseditZone extends plugin "sOAprimary","sOAmail","sOAserial","sOArefresh","sOAretry","sOAexpire","sOAttl"); var $objectclasses = array("whatever"); - var $RecordTypes = array(); + var $RecordTypes = array(); var $ReverseZone = ""; - var $ReverseDN = ""; var $zoneName = ""; var $dNSClass = "IN"; - var $status = "new"; var $sOAprimary = ""; var $sOAmail = ""; @@ -32,34 +30,45 @@ class servdnseditZone extends plugin var $Records = array(); var $mXRecords = array(); - var $InitiallyZoneName = ""; - var $InitiallyReverseZone = ""; - var $isNew = true; + var $OldZoneName = ""; // To detect changes made with this edit + var $OldReverseZone = ""; + + var $InitialReverseZone = ""; + var $InitialzoneName = ""; var $dialog = false; - function servdnseditZone ($config, $dn= NULL,$recordtypes,$attrs = array()) + var $isNew = true; + + function servdnseditZone ($config, $dn= NULL,$attrs = array()) { plugin::plugin ($config, $dn); /* All types with required attrs */ - $this->RecordTypes = $recordtypes; + $this->RecordTypes = getDnsRecordTypes(true); if(!count($attrs)){ - $this->InitiallyZoneName = ""; - $this->InitiallyReverseZone = ""; - $this->isNew = true; - $this->sOAserial = date("Ymd")."1"; + $this->OldZoneName = ""; + $this->OldReverseZone = ""; + $this->isNew = true; + $this->sOAserial = date("Ymd")."1"; + + $this->InitialzoneName = "";//$attrs['InitialzoneName']; + $this->InitialReverseZone = "";//$attrs['InitialReverseZone']; }else{ - $this->InitiallyZoneName = $attrs['zoneName']; - $this->InitiallyReverseZone = $attrs['ReverseZone']; + $this->OldZoneName = $attrs['zoneName']; + $this->OldReverseZone = $attrs['ReverseZone']; + + $this->InitialzoneName = $attrs['InitialzoneName']; + $this->InitialReverseZone = $attrs['InitialReverseZone']; + $this->isNew = false; foreach($this->attributes as $value){ $this->$value = $attrs[$value]; } - if(isset($attrs['Records'])){ - $this->Records = $attrs['Records']; + if(isset($attrs['RECORDS'])){ + $this->Records = $attrs['RECORDS']; $tmp2 = array(); $usedPrio = array(); @@ -169,7 +178,7 @@ class servdnseditZone extends plugin /* Open Zone Entry Edit Dialog */ if(isset($_POST['EditZoneEntries'])){ - $this->dialog= new servDNSeditZoneEntries($this->config,$this->dn,$this->InitiallyZoneName,$this->FlipIp($this->InitiallyReverseZone),$this->RecordTypes); + $this->dialog= new servDNSeditZoneEntries($this->config,$this->dn,$this->InitialzoneName,$this->FlipIp($this->InitialReverseZone)); } /* Save Zone Entry Edit Dialog @@ -239,7 +248,7 @@ class servdnseditZone extends plugin } if((isset($_POST['AddMXRecord'])) && (!empty($_POST['StrMXRecord']))){ - $this->mXRecords[] = array("type"=>"mXRecord","inittype"=>"","value"=>trim($_POST['StrMXRecord']),"status"=>"new"); + $this->mXRecords[] = array("type"=>"mXRecord","value"=>trim($_POST['StrMXRecord'])); } /* Handle Post events */ @@ -250,17 +259,13 @@ class servdnseditZone extends plugin if((preg_match("/RemoveRecord_/",$name))&&($once)){ $once = false; $id= preg_replace("/RemoveRecord_/","",$name); - if($this->Records[$id]['status']!= "new"){ - $this->Records[$id]['status']= "deleted"; - }else{ - unset($this->Records[$id]); - } + unset($this->Records[$id]); } } /* Add new Zonerecord */ if(isset($_POST['AddNewRecord'])){ - $this->Records[] = array("type"=>"aRecord","inittype"=>"","value"=>"","status"=>"new"); + $this->Records[] = array("type"=>"aRecord","value"=>""); } /* Fill in values */ @@ -331,11 +336,11 @@ class servdnseditZone extends plugin $message= array(); /* Check if zoneName is already in use */ $usedZones = $this->getUsedZoneNames(); - if(($this->isNew == true)||($this->zoneName != $this->InitiallyZoneName)||($this->ReverseZone != $this->InitiallyReverseZone)){ - if((isset($usedZones[$this->zoneName]))&&($this->zoneName != $this->InitiallyZoneName)){ + if(($this->isNew == true)||($this->zoneName != $this->InitialzoneName)||($this->ReverseZone != $this->InitialReverseZone)){ + if((isset($usedZones[$this->zoneName]))&&($this->zoneName != $this->InitialzoneName)){ $message[] =_("This zoneName is already in use"); } - if((in_array($this->ReverseZone,$usedZones))&&($this->ReverseZone != $this->InitiallyReverseZone)){ + if((in_array($this->ReverseZone,$usedZones))&&($this->ReverseZone != $this->InitialReverseZone)){ $message[] =_("This reverse zone is already in use"); } } @@ -440,7 +445,10 @@ class servdnseditZone extends plugin $this->Records [] = $rec; } - $ret['Records'] = $this->Records; + $ret['RECORDS'] = $this->Records; + + $ret['InitialReverseZone']= $this->InitialReverseZone; + $ret['InitialzoneName'] = $this->InitialzoneName; return($ret); } @@ -460,8 +468,6 @@ class servdnseditZone extends plugin if($entry['type'] == "mXRecord") continue; - if($entry['status'] == "deleted") continue; - $changeStateForRecords.= "changeState('RecordTypeSelectedFor_".$key."');\n"; $changeStateForRecords.= "changeState('RecordValue_".$key."');\n"; $changeStateForRecords.= "changeState('RemoveRecord_".$key."');\n"; diff --git a/plugins/admin/systems/class_termDNS.inc b/plugins/admin/systems/class_termDNS.inc index 4439e903d..c722bc59d 100644 --- a/plugins/admin/systems/class_termDNS.inc +++ b/plugins/admin/systems/class_termDNS.inc @@ -364,10 +364,11 @@ class termDNS extends plugin /* Create diff and follow instructions * If Account was disabled, remove account by setting exists to false */ - if((!$this->DNS_is_account)&&($this->DNSinitially_was_account)){ + if((!$this->DNS_is_account)&&($this->DNSinitially_was_account)){ $this->dnsEntry['exists'] = false; $tmp = getDNSHostEntriesDiff($this->config,$this->OrigCn,$this->dnsEntry,$this->cn); }else{ + $this->dnsEntry['exists'] = $this->DNS_is_account; $tmp = getDNSHostEntriesDiff($this->config,$this->OrigCn,$this->dnsEntry,$this->cn); } @@ -400,7 +401,7 @@ class termDNS extends plugin /* Display errors */ if($ldap->get_error() != "Success"){ - show_ldap_error($ldap->get_error()); + show_ldap_error("Record:".$ldap->get_error()); } } -- 2.30.2