From e6b26a300fef08717833a9be239e81ea547414af Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 11 Sep 2008 07:14:06 +0000 Subject: [PATCH] Updated DNS - DNS was only available for hosts if the tab object was configured in lowercase was not working. - Fixed problem with duplicated domain parts in ldap2zone. The doamin part in the host name will now be cut in the DNS settings. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@12412 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/functions_dns.inc | 32 +++++++++++++++++++++--- plugins/admin/groups/class_groupMail.inc | 4 +-- plugins/admin/systems/class_termDNS.inc | 2 +- 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/include/functions_dns.inc b/include/functions_dns.inc index 9a62acf4c..d300589d7 100644 --- a/include/functions_dns.inc +++ b/include/functions_dns.inc @@ -371,9 +371,20 @@ function getDNSHostEntries($config,$name,$silent = false) foreach($zonesArr as $nameServer => $nameServerArr){ $foundInTmp = array(); foreach($nameServerArr as $zoneArr => $zone){ + + /* Strip eventually domain part from hostname + */ + $zN = trim($zone,"."); + $nN = trim($name,"."); + if(preg_match("/".normalizePreg($zN)."$/",$nN)){ + $nN = preg_replace("/[\.]*".normalizePreg($zN)."[\.]*$/","",$nN); + }else{ + $nN = $name; + } + $zoneMix = $nameServer."/".$zone; $zoneDn = getDNSZoneDN($config,$zoneMix); - $ldap->ls("(&(objectClass=dNSZone)(zoneName=*)(relativeDomainName=".$name.")(!(relativeDomainName=@)))", $zoneDn,$attrs = array("*")); + $ldap->ls("(&(objectClass=dNSZone)(zoneName=*)(relativeDomainName=".$nN.")(!(relativeDomainName=@)))", $zoneDn,$attrs = array("*")); while($attrs = $ldap->fetch()){ $foundInTmp [$zoneMix] = $attrs['dn']; $foundIn [$zoneMix] = $attrs['dn']; @@ -394,10 +405,15 @@ function getDNSHostEntries($config,$name,$silent = false) $ldap->search("(&(objectClass=dNSZone)(zoneName=*)(!(relativeDomainName=@)))",array("*")); while($attrs = $ldap->fetch()){ - /* If relative domainname == cn - * Try to read dnsclass / TTl / zone + /* Strip eventually domain part from hostname */ - if($attrs['relativeDomainName'][0] == $name){ + $zN = trim($attrs['zoneName'][0],"."); + $nN = trim($name,"."); + $testname = $attrs['relativeDomainName'][0].".".$zN; + + /* Check given host name with zone settings + */ + if(preg_match("/".normalizePreg($testname)."[\.]*$/",$nN) || $attrs['relativeDomainName'][0] == $name){ $ret['exists'] = true; $ret['zoneName'] = $id_tmp; foreach(array("dNSClass","dNSTTL") as $atr){ @@ -450,6 +466,14 @@ function getDNSHostEntriesDiff($config,$oldName,$newEntry,$newName) $zoneDn = getDNSZoneDN($config,$zoneNameMix); $tmp = array_flip($zones); $zoneName = getNameFromMix($zoneNameMix); + + /* Strip domain part out of dns host entry + */ + $zN = trim($zoneName,"."); + $nN = trim($newName,"."); + $oN = trim($oldName,"."); + $newName = preg_replace("/[\.]*".normalizePreg($zN)."$/i","",$nN); + $oldName = preg_replace("/[\.]*".normalizePreg($zN)."$/i","",$oN); /* If reverseZone can't be resolved ... this * can't be a valid entry, so remove this account diff --git a/plugins/admin/groups/class_groupMail.inc b/plugins/admin/groups/class_groupMail.inc index 775763c56..ab86f0fb3 100644 --- a/plugins/admin/groups/class_groupMail.inc +++ b/plugins/admin/groups/class_groupMail.inc @@ -892,8 +892,8 @@ I: Only insider delivery */ $method= new $this->method($this->config); $method->fixAttributesOnStore($this); if (($method->connect($this->gosaMailServer))){ - $method->updateMailbox($this->uid); - $method->setQuota($this->uid, $this->gosaMailQuota); + $method->updateMailbox("share+".$this->uid); + $method->setQuota("share+".$this->uid, $this->gosaMailQuota); /* Only write imap acls directly if we are not * using a kolab like mail method. diff --git a/plugins/admin/systems/class_termDNS.inc b/plugins/admin/systems/class_termDNS.inc index a9568b3c0..9e90cb8bf 100644 --- a/plugins/admin/systems/class_termDNS.inc +++ b/plugins/admin/systems/class_termDNS.inc @@ -101,7 +101,7 @@ class termDNS extends plugin */ $DNSenabled = false; foreach($this->config->data['TABS']['SERVTABS'] as $tab){ - if(preg_match("/^servdns$/",$tab['CLASS'])){ + if(preg_match("/^servdns$/i",$tab['CLASS'])){ $this->DNSenabled = true; } } -- 2.30.2