From 1ae12cf536f1d276cd697b092b1fe1a4818dca70 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 27 Jun 2007 08:02:05 +0000 Subject: [PATCH] Updated zone Handling git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@6711 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/systems/class_servDNSeditZone.inc | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/plugins/admin/systems/class_servDNSeditZone.inc b/plugins/admin/systems/class_servDNSeditZone.inc index 1b19fafb3..fc5c81c5e 100644 --- a/plugins/admin/systems/class_servDNSeditZone.inc +++ b/plugins/admin/systems/class_servDNSeditZone.inc @@ -102,15 +102,17 @@ class servdnseditZone extends plugin /* Detect Network class */ if(!empty($this->ReverseZone)){ - $addr = preg_replace("/^[^\/]+\//","",$this->ReverseZone); - if(preg_match("/^[0-9]*\.0\.0\.0$/",$addr)){ - $this->NetworkClass = "A"; - } - if(preg_match("/^[0-9]*\.[0-9]*\.0\.0$/",$addr)){ - $this->NetworkClass = "B"; - } - if(preg_match("/^[0-9]*\.[0-9]*\.[0-9]*\.0$/",$addr)){ - $this->NetworkClass = "C"; + + $dots = count(split(".",$this->ReverseZone)); + if($dots == 0){ + $this->NetworkClass = "A"; + $this->ReverseZone .= ".0.0.0"; + }elseif($dots == 1){ + $this->NetworkClass = "B"; + $this->ReverseZone .= ".0.0"; + }else{ + $this->NetworkClass = "C"; + $this->ReverseZone .= ".0"; } } } @@ -505,7 +507,15 @@ class servdnseditZone extends plugin $this->Records [] = $rec; } + $ret['RECORDS'] = $this->Records; + + switch($this->NetworkClass){ + case 'C' : $ret['ReverseZone']= preg_replace("/\.[0-9]*$/","",$this->ReverseZone);break; + case 'B' : $ret['ReverseZone']= preg_replace("/\.[0-9]*\.[0-9]*$/","",$this->ReverseZone);break; + case 'A' : $ret['ReverseZone']= preg_replace("/\.[0-9]*\.[0-9]*\.[0-9]*$/","",$this->ReverseZone);break; + default : trigger_error("Invalid network class given '".$this->NetworkClass."'"); + } $ret['InitialReverseZone']= $this->InitialReverseZone; $ret['InitialzoneName'] = $this->InitialzoneName; -- 2.30.2