diff --git a/gosa-plugins/systems/admin/systems/class_termDNS.inc b/gosa-plugins/systems/admin/systems/class_termDNS.inc
index a1aa50bcdcf43ddc85ac28e378f78ec649e1ffeb..e08e9afddb7c0dde791fc1c558a1654b362fd9e8 100644 (file)
$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]);
*/
$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]);
{
/* 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){
$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);
}
}
$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)){
$smarty->assign("changeStateForRecords",$changeStateForRecords);
$smarty->assign("staticAddress","<font class=\"must\">*</font>");
- $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));
}
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 */
}
/* 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']);
}
$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();
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 */
"(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.