summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5f91684)
raw | patch | inline | side by side (parent: 5f91684)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 21 Feb 2008 13:48:10 +0000 (13:48 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 21 Feb 2008 13:48:10 +0000 (13:48 +0000) |
-Speed up the way we read zones from ldap.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9020 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9020 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/dns/admin/systems/services/dns/class_DNS.inc | patch | blob | history |
diff --git a/gosa-plugins/dns/admin/systems/services/dns/class_DNS.inc b/gosa-plugins/dns/admin/systems/services/dns/class_DNS.inc
index 2359889d05d7b0325bce6507256660975beec44c..ade653d2d5e447ba740c64ca194b70fa8a4a1521 100644 (file)
static function getAvailableZones($config)
{
$ret = array();
- $ldap = $config->get_ldap_link();
- $ldap->cd ($config->current['BASE']);
/* Search for zones ...
*/
- $ldap->search("(&(objectClass=dNSZone)(sOARecord=*))",array("zoneName"));
+ $ou = preg_replace("/,.*$/","",get_ou("serverou"));
+ $deps = array();
+ $ldap = $config->get_ldap_link();
+ $ldap->cd ($config->current['BASE']);
+ $ldap->search("(&(objectClass=organizationalUnit)(".$ou."))",array("dn"));
+ while($attrs = $ldap->fetch()){
+ $deps[] = $attrs['dn'];
+ }
$ForwardZones = array();
$ReverseZones = array();
$zones = array();
+ foreach($deps as $dep){
+ $ldap->cd($dep);
+ $ldap->search("(&(objectClass=dNSZone)(sOARecord=*))",array("zoneName"));
- while($at = $ldap->fetch()){
- if(preg_match("/\.in\-addr\.arpa/",$at['zoneName'][0])){
- $ReverseZones[$at['dn']] = $at;
- }else{
- $ForwardZones[$at['dn']] = $at;
+
+ while($at = $ldap->fetch()){
+ if(preg_match("/\.in\-addr\.arpa/",$at['zoneName'][0])){
+ $ReverseZones[$at['dn']] = $at;
+ }else{
+ $ForwardZones[$at['dn']] = $at;
+ }
}
- }
- foreach($ForwardZones as $dn => $obj){
+ foreach($ForwardZones as $dn => $obj){
- /* try to find reverse
- */
- foreach($ReverseZones as $Rdn => $Robj ){
- if(preg_match("/".$dn."/",$Rdn)){
- $zones[strtoupper($ldap->getCn($dn))."/".$Robj['zoneName'][0]] =
- strtoupper($ldap->getCn($dn))."/".$obj['zoneName'][0];
- }
- }
+ /* try to find reverse
+ */
+ foreach($ReverseZones as $Rdn => $Robj ){
+ if(preg_match("/".$dn."/",$Rdn)){
+ $zones[strtoupper($ldap->getCn($dn))."/".$Robj['zoneName'][0]] =
+ strtoupper($ldap->getCn($dn))."/".$obj['zoneName'][0];
+ }
+ }
+ }
}
return($zones);
}