Code

Updated DNS
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 11 Sep 2008 07:14:06 +0000 (07:14 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 11 Sep 2008 07:14:06 +0000 (07:14 +0000)
- DNS was only available for hosts if the tab object was configured in lowercase <tab class="servDNS"> 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
plugins/admin/groups/class_groupMail.inc
plugins/admin/systems/class_termDNS.inc

index 9a62acf4c0a2c5da9720620c3c180febe2cb42e5..d300589d76d39bd34866e486fc7f1fe35c9e0c70 100644 (file)
@@ -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
index 775763c56ce61f3b794e6ace68a1733a3fac83d0..ab86f0fb3a8e43fb4676eda62f5e43c091830f22 100644 (file)
@@ -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.
index a9568b3c0cfb260516c8203aa06d76de3ca64730..9e90cb8bf3916db769bde4b5b4813d4019747aa4 100644 (file)
@@ -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;
       }
     }