Code

Updated DNS function.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 14 Feb 2008 08:34:31 +0000 (08:34 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 14 Feb 2008 08:34:31 +0000 (08:34 +0000)
-getDNSZoneEntriesDiff also updates the reverse zone now.

git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@8898 594d385d-05f5-0310-b6e9-bd551577e9d8

include/functions_dns.inc

index e1cda20a0af871f8972d184bdf70ac72d122c6ce..9a62acf4c0a2c5da9720620c3c180febe2cb42e5 100644 (file)
@@ -217,7 +217,7 @@ function getDNSZoneEntriesDiff($config,$newZones,$HostDn)
   /* Walk through all zones and detect renamed/added/deleted zones ... 
    */
   foreach($newZones as $name => $zone){
-    
+   
     /* This zone was renamed 
      */
     if((!empty($zone['InitialzoneName'])) && ($zone['InitialzoneName'] != $zone['zoneName'])){
@@ -226,7 +226,7 @@ function getDNSZoneEntriesDiff($config,$newZones,$HostDn)
        */ 
       $oldDn = "zoneName=".getNameFromMix($zone['InitialzoneName']).",".$HostDn;
       $newDn = "zoneName=".getNameFromMix($zone['zoneName']).",".$HostDn;
-      $PrePareZoneEntries[$zone['InitialzoneName']] = getNameFromMix($zone['zoneName']);
+      $PrePareZoneEntries[getNameFromMix($zone['InitialzoneName'])] = getNameFromMix($zone['zoneName']);
       $move [$oldDn] = $newDn;      
     }
 
@@ -259,7 +259,7 @@ function getDNSZoneEntriesDiff($config,$newZones,$HostDn)
         $base = "zoneName=".getNameFromMix($zone['zoneName']).",".$HostDn;
         $oldRDn = "zoneName=". FlipIp(getNameFromMix($zone['InitialReverseZone'])).".in-addr.arpa,".$base; 
         $newRDn = "zoneName=". FlipIp(getNameFromMix($zone['ReverseZone'])).".in-addr.arpa,".$base;
-        $PrePareZoneEntries[FlipIp($zone['InitialReverseZone']).".in-addr.arpa"] = FlipIp($zone['ReverseZone']).".in-addr.arpa";
+        $PrePareZoneEntries[FlipIp(getNameFromMix($zone['InitialReverseZone'])).".in-addr.arpa"] = FlipIp(getNameFromMix($zone['ReverseZone'])).".in-addr.arpa";
         $move [$oldRDn] = $newRDn;
       }
     }
@@ -319,15 +319,17 @@ function getDNSZoneEntriesDiff($config,$newZones,$HostDn)
   $udpate = array();
   if(count($PrePareZoneEntries)){
     $ldap = $config->get_ldap_link();
+
     foreach($PrePareZoneEntries as $FromZoneName => $ToZoneName){
       $ldap->cd($HostDn);
-      $ldap->search("(&(objectClass=dNSZone)(zoneName=".getNameFromMix($FromZoneName).")(!(relativeDomainName=@)))",array("zoneName"));
+      $ldap->search("(&(objectClass=dNSZone)(zoneName=".$FromZoneName.")(!(relativeDomainName=@)))",array("zoneName"));
       while($attrs = $ldap->fetch()){
-        $zoneUpdates[$attrs['dn']] = array("zoneName"=>$ToZoneName);
+        $attr_to_change = array();
+        $attr_to_change['zoneName'] = $ToZoneName;
+        $zoneUpdates[$attrs['dn']] = $attr_to_change;
       }
     }
   }
-
   $ret = array("del" => $del , "move" => $move , "add" => $add,"zoneUpdates"=>$zoneUpdates);
   return($ret);
 }