X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-plugins%2Fsystems%2Fadmin%2Fsystems%2Fclass_termDNS.inc;h=e08e9afddb7c0dde791fc1c558a1654b362fd9e8;hb=f12547c4b6640b7de58b3474ba5c42e756233de0;hp=a1aa50bcdcf43ddc85ac28e378f78ec649e1ffeb;hpb=b9fd31eeafebce9726838811dea2457f845f1d29;p=gosa.git diff --git a/gosa-plugins/systems/admin/systems/class_termDNS.inc b/gosa-plugins/systems/admin/systems/class_termDNS.inc index a1aa50bcd..e08e9afdd 100644 --- a/gosa-plugins/systems/admin/systems/class_termDNS.inc +++ b/gosa-plugins/systems/admin/systems/class_termDNS.inc @@ -79,7 +79,9 @@ class termDNS extends plugin $this->IPisMust = $IPisMust; $this->namingAttr = $namingAttr; - plugin::plugin ($config, $parent->dn); + plugin::plugin ($config, $parent->dn, $this->parent); + + $this->attrs = &$this->parent->attrs; if(isset($this->attrs[$namingAttr][0])){ $this->OrigCn = preg_replace("/\\\$\$/","",$this->attrs[$namingAttr][0]); @@ -154,9 +156,10 @@ class termDNS extends plugin */ $this->dnsEntry = DNS::getDNSHostEntries($config,$this->OrigCn); + $ptr = DNS::FlipIp($this->get_pTRRecord()); + /* 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]); @@ -256,7 +259,7 @@ class termDNS extends plugin { /* Call parent execute */ $smarty= get_smarty(); - $smarty->assign("autonetACL",$this->acl_is_writeable("macAddress").$this->acl_is_writeable("ipHostNumber")); + $smarty->assign("autonetACL",$this->acl_is_writeable("macAddress") && $this->acl_is_writeable("ipHostNumber")?"rw":""); $tmp = $this->plInfo(); foreach($tmp['plProvidedAcls'] as $name => $translation){ @@ -324,7 +327,7 @@ class termDNS extends plugin $this->dialog->read_only = !$this->acl_is_writeable("dhcpSetup"); $this->dialog->dhcpHWAddress = "ethernet ".$this->macAddress; if(!empty($this->ipHostNumber)){ - $this->dialog->statements['fixed-address'] = $this->ipHostNumber; + $this->dialog->statements->set('fixed-address', $this->ipHostNumber); } } @@ -332,7 +335,7 @@ class termDNS extends plugin $this->dialog = FALSE; } - if(isset($_POST['save_dhcp']) && $this->acl_is_writeable("dhcpSetup")){ + if(isset($_POST['save_dhcp']) && $this->acl_is_writeable("dhcpSetup") && is_object($this->dialog)){ $this->dialog->save_object(); $msgs = $this->dialog->check(array()); if(count($msgs)){ @@ -457,7 +460,7 @@ class termDNS extends plugin $smarty->assign("changeStateForRecords",$changeStateForRecords); $smarty->assign("staticAddress","*"); - $smarty->assign("autonetACL",$this->acl_is_writeable("macAddress").$this->acl_is_writeable("ipHostNumber")); + $smarty->assign("autonetACL",$this->acl_is_writeable("macAddress") && $this->acl_is_writeable("ipHostNumber")?"rw":""); $display.= $smarty->fetch(get_template_path('network.tpl', TRUE)); } @@ -541,11 +544,15 @@ class termDNS extends plugin DNS posts ******/ - /* Check if DNS should be enabled / disabled */ - if($this->DNS_is_account && $this->acl_is_writeable("dnsSetup") && !isset($_POST['DNS_is_account'])){ - $this->DNS_is_account = false; - }elseif(!$this->DNS_is_account && $this->acl_is_writeable("dnsSetup") && isset($_POST['DNS_is_account'])){ - $this->DNS_is_account = true; + /* Check if DNS should be enabled / disabled + * -skip this, if the dns account is enforced. + */ + if(!$this->hide_dns_check_box){ + if($this->DNS_is_account && $this->acl_is_writeable("dnsSetup") && !isset($_POST['DNS_is_account'])){ + $this->DNS_is_account = false; + }elseif(!$this->DNS_is_account && $this->acl_is_writeable("dnsSetup") && isset($_POST['DNS_is_account'])){ + $this->DNS_is_account = true; + } } /* Get dns attributes */ @@ -715,7 +722,7 @@ class termDNS extends plugin } /* Do not add the objectClass ipHost if no ip address is given */ - if(!$this->attrs['ipHostNumber']){ + if(!isset($this->attrs['ipHostNumber'])){ $this->attrs['objectClass'] = array_remove_entries(array("ipHost"),$this->attrs['objectClass']); } @@ -736,7 +743,7 @@ class termDNS extends plugin $this->dialog->cn = $this->cn; $this->dialog->dhcpHWAddress = "ethernet ".$this->macAddress; if(!empty($this->ipHostNumber)){ - $this->dialog->statements['fixed-address'] = $this->ipHostNumber; + $this->dialog->statements->set('fixed-address', $this->ipHostNumber); } $this->dialog->execute(); $this->dialog->save_object(); @@ -744,6 +751,15 @@ class termDNS extends plugin if(count($this->dhcpHostEntry['dhcpOption']) == 0){ $this->dhcpHostEntry['dhcpOption']= array("host-name ".$this->cn); } + }else{ + + // Updated Host-Name entry + foreach($this->dhcpHostEntry['dhcpOption'] as $key => $entry){ + if(preg_match("/^host-name/", $entry)){ + $this->dhcpHostEntry['dhcpOption'][$key] = "host-name ".$this->cn; + break; + } + } } /* Write mac address to dhcp settings */ @@ -1117,9 +1133,11 @@ class termDNS extends plugin "(objectClass=gotoPrinter)". "(objectClass=ipHost)"; $list = array(); - $ldap->search("(&(|{$ocs})(ipHostNumber={$net}*))",array("ipHostNumber")); + $ldap->search("(&(|{$ocs})(ipHostNumber=*))",array("ipHostNumber")); while($attrs = $ldap->fetch()){ - $list[] = $attrs['ipHostNumber'][0]; + if (preg_match("/^$net\./", $attrs['ipHostNumber'][0])) { + $list[] = $attrs['ipHostNumber'][0]; + } } // Set starting ip.