From 7d0f6e3ba1be640099d4e83a418930d6931669cf Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 13 Feb 2008 11:17:12 +0000 Subject: [PATCH] Updated DNS service. - DNS zones can't be modified anymore, if the are used. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8892 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../services/dns/class_servDNSeditZone.inc | 37 ++++++++++++------- .../systems/services/dns/servdnseditzone.tpl | 17 ++++++--- 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/gosa-plugins/dns/admin/systems/services/dns/class_servDNSeditZone.inc b/gosa-plugins/dns/admin/systems/services/dns/class_servDNSeditZone.inc index 9242662a8..bb7053e70 100644 --- a/gosa-plugins/dns/admin/systems/services/dns/class_servDNSeditZone.inc +++ b/gosa-plugins/dns/admin/systems/services/dns/class_servDNSeditZone.inc @@ -44,6 +44,7 @@ class servdnseditZone extends plugin var $isNew = true; var $ZoneObject = array(); + var $Zone_is_used = FALSE; function servdnseditZone (&$config, $dn= NULL,$attrs = array()) { @@ -115,6 +116,13 @@ class servdnseditZone extends plugin }else{ $this->sOAserial = date("Ymd")."01"; } + + /* Check if this used, in this case disable forward and reverse configuration */ + $tmp = $this->getUsedZoneNames(); + $this->Zone_is_used = FALSE; + if(isset($tmp[DNS::FlipIp($this->InitialReverseZone).".in-addr.arpa"])){ + $this->Zone_is_used = TRUE; + } } /* Detect Network class */ @@ -204,10 +212,9 @@ class servdnseditZone extends plugin /* Call parent execute */ plugin::execute(); - - /* Fill templating stuff */ $smarty= get_smarty(); + $smarty->assign("Zone_is_used",$this->Zone_is_used); $ui = get_userinfo(); $smarty->assign("ACLs",$this->parent->getacl("")); @@ -367,6 +374,11 @@ 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]; } @@ -381,7 +393,7 @@ class servdnseditZone extends plugin } } - if(isset($_POST['NetworkClass'])){ + if(isset($_POST['NetworkClass']) && !$this->Zone_is_used){ $this->NetworkClass = $_POST['NetworkClass']; } @@ -478,26 +490,22 @@ class servdnseditZone extends plugin return ($message); } - /* This funtion returns all used Zonenames */ + + /* 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] =DNS::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() { @@ -597,7 +605,8 @@ class servdnseditZone extends plugin $str.=""; return($str); } -} + +} // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> diff --git a/gosa-plugins/dns/admin/systems/services/dns/servdnseditzone.tpl b/gosa-plugins/dns/admin/systems/services/dns/servdnseditzone.tpl index 1136dba53..60b39101f 100644 --- a/gosa-plugins/dns/admin/systems/services/dns/servdnseditzone.tpl +++ b/gosa-plugins/dns/admin/systems/services/dns/servdnseditzone.tpl @@ -4,20 +4,20 @@ - - @@ -26,12 +26,19 @@ + {if $Zone_is_used} + + + + {/if}
{t}Zone name{/t}{$must} + {t}Zone name{/t}{$must} {render acl=$ACLs} - + {/render}
{t}Network address{/t}{$must} + {t}Network address{/t}{$must} {render acl=$ACLs} - + {/render}
{render acl=$ACLs} - {html_options options=$NetworkClasses selected=$NetworkClass } {/render}
+ {t}Zone is in use, network settings can't be modified.{/t} +
-- 2.30.2