From: hickert Date: Mon, 27 Aug 2007 10:16:26 +0000 (+0000) Subject: Update ptr record. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=7e928cbb1483099f55ebf7aefe1bb7a911b6a2cb;p=gosa.git Update ptr record. Automatically add systems ptr record. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7144 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/systems/class_termDNS.inc b/plugins/admin/systems/class_termDNS.inc index de022df19..520853442 100644 --- a/plugins/admin/systems/class_termDNS.inc +++ b/plugins/admin/systems/class_termDNS.inc @@ -121,10 +121,14 @@ class termDNS extends plugin /* Remove A record which equals $this->ipHostNumber */ + $ptr = $this->get_pTRRecord(); foreach($this->dnsEntry['RECORDS'] as $key => $rec){ if(($rec['type'] == "aRecord") && ($rec['value'] == $this->ipHostNumber)){ unset($this->dnsEntry['RECORDS'][$key]); } + if(($rec['type'] == "pTRRecord") && ($rec['value'] == $ptr)){ + unset($this->dnsEntry['RECORDS'][$key]); + } } /* Get Record types @@ -602,10 +606,10 @@ class termDNS extends plugin */ if(!empty($this->ipHostNumber)){ $this->dnsEntry['RECORDS'][] = array("type"=>"aRecord","value"=>$this->ipHostNumber); - $ldap->cat(getDNSZoneDN($this->config,$this->dnsEntry['zoneName'])); - $attrs = $ldap->fetch(); - $str = trim(preg_replace("/(^[^ ]*).*$/","\\1",$attrs['sOARecord'][0])); - $this->dnsEntry['RECORDS'][] = array("type"=>"nsRecord","value"=>$str); + $ptr = $this->get_pTRRecord(); + if(!empty($ptr)){ + $this->dnsEntry['RECORDS'][] = array("type"=>"pTRRecord","value"=>$ptr); + } } /* Create diff and follow instructions @@ -782,6 +786,24 @@ class termDNS extends plugin } + /* this function returns the default ptr record entry */ + function get_pTRRecord() + { + if(!empty($this->ipHostNumber) && isset($this->dnsEntry['zoneName'])){ + $ldap = $this->config->get_ldap_link(); + $ldap->cat(getDNSZoneDN($this->config,$this->dnsEntry['zoneName'])); + $attrs = $ldap->fetch(); + $tmp = array_flip($this->Zones); + $tmp = preg_replace("/^[^\/]*+\//","",$tmp[$this->dnsEntry['zoneName']]); + $tmp = trim(preg_replace("/\.in-addr.arpa$/","",$tmp)); + $ptr = preg_replace("/^".normalizePreg(FlipIp($tmp))."\./","",$this->ipHostNumber); + return($ptr); + }else{ + return(FALSE); + } + } + + function create_tree($arr,$base,$current = "") { $ret = array();