Code

Apply patch for #225 by mba
authorpsc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8>
Sun, 21 Jun 2009 19:45:04 +0000 (19:45 +0000)
committerpsc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8>
Sun, 21 Jun 2009 19:45:04 +0000 (19:45 +0000)
- Properly handle renaming of systems that contain
  special characters
- Properly capture object group membership when editing systems

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

trunk/gosa-core/include/class_ldap.inc
trunk/gosa-core/include/class_plugin.inc

index bcf06951d4d6c573e0be93f7106c9a9af26a84de..1263256612ad436c864a2dcd8188a7c1431007ab 100644 (file)
@@ -120,7 +120,10 @@ class LDAP{
      requests. I.e. member=....                                               */
   static function prepare4filter($dn)
   {
-    return normalizeLdap(str_replace('\\\\', '\\\\\\', LDAP::fix($dn)));
+    $str = normalizeLdap(str_replace('\\\\', '\\\\\\', LDAP::fix($dn)));
+    /* Special-case '\,' for filters */
+    $str = str_replace('\\,', '\\5C2C', $str);
+    return $str;
   }
 
 
index 1c57be2cc96bd77e92e8edd950d568e6db171e58..d1acf6346b502a5dca0c9798d06970057fb0b365 100644 (file)
@@ -954,6 +954,7 @@ class plugin
     /* Walk through all objectGroups and check if there are 
         members matching the source dn 
      */
+    $src_dn=str_replace('\\,', '\\2C', LDAP::fix($src_dn));
     foreach($ogroups as $ogroup){
       if(isset($ogroup['member'])){
 
@@ -972,7 +973,9 @@ class plugin
               $o_ogroup = new ogroup($this->config,$ogroup['dn']);
             }              
 
-            unset($o_ogroup->member[$c_mem]);
+            /* Members are stored with their converted names, so convert $c_mem as well
+               to have it match in case of special characters in its name. */
+            unset($o_ogroup->member[LDAP::convert($c_mem)]);
             $o_ogroup->member[$d_mem]= $d_mem;
           }
         }