From f552044e1a99273e4320dd08e8f16dc2a0e1a01b Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 13 Aug 2007 08:23:10 +0000 Subject: [PATCH] Updated dns addon: Save changes made on dns plugin to current dn. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7044 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/systems/class_servDNS.inc | 16 +++++++++++++--- plugins/admin/systems/class_servGeneric.inc | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/plugins/admin/systems/class_servDNS.inc b/plugins/admin/systems/class_servDNS.inc index f12ad0f8b..362fb6448 100644 --- a/plugins/admin/systems/class_servDNS.inc +++ b/plugins/admin/systems/class_servDNS.inc @@ -284,8 +284,17 @@ class servdns extends plugin if($old_dn == "new"){ $old_dn = $this->dn; } - + + /* Update dns to current object dn */ $tmp = getDNSZoneEntriesDiff($this->config,$this->Zones,$old_dn); + $tmp2 = array(); + foreach($tmp as $key1 => $data1){ + $tmp2[$key1] = array(); + foreach($data1 as $key2 => $data2){ + $tmp2[$key1][preg_replace("/".normalizePreg($old_dn)."$/",$this->dn,$key2)] = $data2; + } + } + $tmp = $tmp2; /* Updated zone entries if reverser or forward name has changed * Must be done before moving entries, else the given dn is invalid @@ -317,14 +326,15 @@ class servdns extends plugin foreach($tmp['add'] as $dn => $attrs){ $ldap->cd($dn); $ldap->cat($dn, array('dn')); - if(count($ldap->fetch())){ + if($ldap->count()){ $ldap->cd($dn); $ldap->modify ($attrs); + show_ldap_error($ldap->get_error(), _("Saving DNS entries failed")); }else{ $ldap->cd($dn); $ldap->add($attrs); + show_ldap_error($ldap->get_error(), _("Saving DNS entries failed")); } - show_ldap_error($ldap->get_error(), _("Saving DNS entries failed")); } } } diff --git a/plugins/admin/systems/class_servGeneric.inc b/plugins/admin/systems/class_servGeneric.inc index fc3a089e6..c0f824bc4 100644 --- a/plugins/admin/systems/class_servGeneric.inc +++ b/plugins/admin/systems/class_servGeneric.inc @@ -309,7 +309,7 @@ class servgeneric extends plugin } }else{ if ($this->orig_dn != $this->dn){ - $this->move($this->orig_dn, $this->dn); + $this->recursive_move($this->orig_dn, $this->dn); plugin::save(); } } -- 2.30.2