From: hickert Date: Tue, 30 Jan 2007 05:10:49 +0000 (+0000) Subject: Fixed dns zone selection. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=4aabc272af51ea996d0f6bd9cbadf8a42da8969d;p=gosa.git Fixed dns zone selection. Avoid selection '- no reverse zone matching you ip -' as zone. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5653 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/systems/class_termDNS.inc b/plugins/admin/systems/class_termDNS.inc index a4f234ed8..c3a3994d9 100644 --- a/plugins/admin/systems/class_termDNS.inc +++ b/plugins/admin/systems/class_termDNS.inc @@ -66,16 +66,6 @@ class termDNS extends plugin /* Get Zones */ $this->Zones = getAvailableZones($config); - //echo '
DEBUG: '.print_r($this->Zones, true).'
'; - - $idZones = array_flip($this->Zones); - - $idZones = array_filter($idZones,array($this,"netmaskIsCoherent")); - $this->Zones = array_flip($idZones); - - if(count($this->Zones) < 1) $this->Zones = array("" => "- no reverse zone matching you ip -"); - - //echo '
DEBUG: '.print_r($this->Zones, true).'
'; /* Get Entry */ @@ -108,12 +98,15 @@ class termDNS extends plugin $this->DNSinitially_was_account = $this->DNS_is_account; } - function netmaskIsCoherent($idZone) { + + function netmaskIsCoherent($idZone) + { $netmask = FlipIp(str_replace(".in-addr.arpa","",getNameFromMix($idZone))); - if(!strstr($this->ipHostNumber, $netmask)) + if(!strstr($this->ipHostNumber, $netmask)){ return false; - else + }else{ return true; + } } @@ -221,7 +214,19 @@ class termDNS extends plugin $smarty->assign("Zones",$this->Zones); $smarty->assign("ZoneKeys",($this->Zones)); $smarty->assign("IPisMust",(($this->IPisMust)||($this->DNS_is_account))); - + + /* Create zone array */ + $idZones = array(); + foreach($this->Zones as $id => $zone){ + if($this->netmaskIsCoherent($id)) { + $idZones[$id] = $zone; + }else{ + $idZones[$id] = $zone." ("._("Not matching").")"; + } + } + $smarty->assign("Zones",$idZones); + $smarty->assign("ZoneKeys", $idZones); + $tmp = $this->generateRecordsList(); $changeStateForRecords = $tmp['changeStateForRecords']; @@ -329,6 +334,13 @@ class termDNS extends plugin $checkArray = array(); $onlyOnce = array(); + $tmp = array_flip($this->Zones); + $tmp2 = $tmp[$this->dnsEntry['zoneName']]; + if(!$this->netmaskIsCoherent($tmp2)){ //this->dnsEntry['zoneName'])){ + $tmp2 = preg_replace("/^.*\//","",$tmp2); + $message[] =sprintf(_("The specified IP address '%s' is not matching the selected reverse zone entry '%s'."),$this->ipHostNumber,$tmp2); + } + // There can be many CNAME records //$onlyOnce['cNAMERecord'] = 0;