From 3c514f6a09b4cb7d5668412f3d8025bb5770e639 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 13 Feb 2008 12:18:59 +0000 Subject: [PATCH] Update DNS service -Disable network settings if zone is in use. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@8893 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/systems/class_servDNSeditZone.inc | 28 ++++++++++++------- plugins/admin/systems/servdnseditzone.tpl | 13 +++++++-- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/plugins/admin/systems/class_servDNSeditZone.inc b/plugins/admin/systems/class_servDNSeditZone.inc index 0b9850e0b..8dd76dc05 100644 --- a/plugins/admin/systems/class_servDNSeditZone.inc +++ b/plugins/admin/systems/class_servDNSeditZone.inc @@ -39,6 +39,7 @@ class servdnseditZone extends plugin var $isNew = true; var $cn; var $ZoneObject = array(); + var $Zone_is_used = FALSE; function servdnseditZone ($config, $dn= NULL,$attrs = array()) { @@ -129,6 +130,13 @@ class servdnseditZone extends plugin $this->ReverseZone .= ".0"; } } + + /* Check if this used, in this case disable forward and reverse configuration */ + $tmp = $this->getUsedZoneNames(); + $this->Zone_is_used = FALSE; + if(isset($tmp[FlipIp(getNameFromMix($this->InitialReverseZone)).".in-addr.arpa"])){ + $this->Zone_is_used = TRUE; + } } /* TRansports the geiven Arraykey one position up*/ @@ -204,6 +212,7 @@ class servdnseditZone extends plugin /* Fill templating stuff */ $smarty= get_smarty(); + $smarty->assign("Zone_is_used",$this->Zone_is_used); $display= ""; /* Open Zone Entry Edit Dialog @@ -368,12 +377,16 @@ class servdnseditZone extends plugin { //plugin::save_object(); foreach($this->attributes as $attr){ + if($this->Zone_is_used && in_array($attr,array("ReverseZone","zoneName"))){ + continue; + } + if(isset($_POST[$attr])){ $this->$attr = $_POST[$attr]; } } - if(isset($_POST['NetworkClass'])){ + if(isset($_POST['NetworkClass']) && !$this->Zone_is_used){ $this->NetworkClass = $_POST['NetworkClass']; } @@ -484,26 +497,21 @@ class servdnseditZone extends plugin return ($message); } + /* This funtion returns all used Zonenames */ function getUsedZoneNames() { $ret = array(); $ldap = $this->config->get_ldap_link(); $ldap->cd($this->config->current['BASE']); - $ldap->search("(&(objectClass=dNSZone)(relativeDomainName=@)(zoneName=*))",array("zoneName","tXTRecord")); + $ldap->search("(&(objectClass=dNSZone)(!(relativeDomainName=@))(zoneName=*))",array("zoneName","relativeDomainName")); while($attr = $ldap->fetch()){ - if(preg_match("/in-addr\.arpa/",$attr['zoneName'][0])){ - if(isset($attr['tXTRecord'][0])){ - $zn = preg_replace("/zoneName\=/","",$attr['tXTRecord'][0]); - $ret[$zn] =FlipIp(preg_replace("/\.in-addr\.arpa/","",$attr['zoneName'][0])); - } - }else{ - $ret[$attr['zoneName'][0]]=""; - } + $ret[$attr['zoneName'][0]][] = $attr['dn']; } return($ret); } + /* Save to LDAP */ function save() { diff --git a/plugins/admin/systems/servdnseditzone.tpl b/plugins/admin/systems/servdnseditzone.tpl index 2e7c969be..016eba51d 100644 --- a/plugins/admin/systems/servdnseditzone.tpl +++ b/plugins/admin/systems/servdnseditzone.tpl @@ -6,24 +6,31 @@ {t}Zone name{/t}{$must} - + {t}Network address{/t}{$must} - + {t}Netmask{/t} - {html_options options=$NetworkClasses selected=$NetworkClass } + {if $Zone_is_used} + + + {t}Zone is in use, network settings can't be modified.{/t} + + + {/if} -- 2.30.2