From: hickert Date: Thu, 14 Feb 2008 08:34:31 +0000 (+0000) Subject: Updated DNS function. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2db85e7b6fee81450665a47c35e85c1f33018b5c;p=gosa.git Updated DNS function. -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 --- diff --git a/include/functions_dns.inc b/include/functions_dns.inc index e1cda20a0..9a62acf4c 100644 --- a/include/functions_dns.inc +++ b/include/functions_dns.inc @@ -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); }