Code

Fixed FAI
[gosa.git] / plugins / admin / fai / class_faiHook.inc
index c7edf194ca907c2fc3d688fb3f49ec2215f4c64e..a589e67ebf545e36c416e466643668fee41de6dc 100644 (file)
@@ -225,8 +225,8 @@ class faiHook extends plugin
       $ldap->modify($this->attrs);
     }else{
       /* Write FAIscript to ldap*/ 
-      $ldap->cd($this->dn);
-      $ldap->create_missing_trees($this->dn);
+      $ldap->cd(preg_replace('/^[^,]+,[^,]+,/', '', $this->dn));
+      $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
       $ldap->cd($this->dn);
       $ldap->add($this->attrs);
     }
@@ -276,8 +276,8 @@ class faiHook extends plugin
         $ldap->modify($tmp);
         $this->handle_post_events("modify");
       }elseif($obj['status']=="new"){
-        $ldap->cd($sub_dn);
-        $ldap->create_missing_trees($sub_dn);
+        $ldap->cd(preg_replace('/^[^,]+,[^,]+,/', '', $sub_dn));
+        $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $sub_dn));
         $ldap->cd($sub_dn);
         $ldap->add($tmp); 
         $this->handle_post_events("add");