Code

Oups - a couple of member= fixes needed to make it work completely...
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 15 Jan 2008 13:19:26 +0000 (13:19 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 15 Jan 2008 13:19:26 +0000 (13:19 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8354 594d385d-05f5-0310-b6e9-bd551577e9d8

24 files changed:
gosa-core/include/class_ldap.inc
gosa-core/include/class_location.inc
gosa-core/include/class_plugin.inc
gosa-core/plugins/admin/acl/class_aclRole.inc
gosa-core/plugins/admin/applications/class_applicationGeneric.inc
gosa-core/plugins/admin/departments/class_departmentManagement.inc
gosa-core/plugins/admin/groups/class_groupGeneric.inc
gosa-core/plugins/admin/mimetypes/class_mimetypeGeneric.inc
gosa-core/plugins/admin/systems/class_componentGeneric.inc
gosa-core/plugins/admin/systems/class_phoneGeneric.inc
gosa-core/plugins/admin/systems/class_printGeneric.inc
gosa-core/plugins/admin/systems/class_servGeneric.inc
gosa-core/plugins/admin/systems/class_terminalGeneric.inc
gosa-core/plugins/admin/systems/class_terminalService.inc
gosa-core/plugins/admin/systems/class_terminalStartup.inc
gosa-core/plugins/admin/systems/class_winGeneric.inc
gosa-core/plugins/admin/systems/class_workstationGeneric.inc
gosa-core/plugins/admin/systems/class_workstationService.inc
gosa-core/plugins/admin/systems/class_workstationStartup.inc
gosa-core/plugins/generic/references/class_reference.inc
gosa-core/plugins/gofon/conference/class_phoneConferenceManagment.inc
gosa-core/plugins/gofon/macro/class_gofonMacro.inc
gosa-core/plugins/personal/generic/class_user.inc
gosa-core/setup/class_setupStep_Migrate.inc

index 625d052cd48603c2b7c9dd737ebe3cd268818a5b..489f3954e1adbd2ebe3c9d45f75087d2c53905ad 100644 (file)
@@ -91,6 +91,14 @@ class LDAP{
   }
 
 
+  /* Function to fix problematic characters in DN's that are used for search
+     requests. I.e. member=....                                               */
+  static function prepare4filter($dn)
+  {
+       return normalizeLdap(preg_replace('/\\\\/', '\\\\\\', LDAP::fix($dn)));
+  }
+
+
   function connect()
   {
     $this->hascon=false;
index a0ba97bbed9b76ab0b58ae04c9b45a2a4c8f717c..ec6e578432d193c8e33814cd2ce8a0466be21367 100644 (file)
@@ -186,8 +186,8 @@ $class_mapping= array(
                 "divListUsers" => "plugins/admin/users/class_divListUsers.inc",
                 "userManagement" => "plugins/admin/users/class_userManagement.inc",
                 "usertabs" => "plugins/admin/users/tabs_user.inc",
+                "fai_func" => "plugins/admin/fai/functions_FAI.inc",
                 "faiTemplateEntry" => "plugins/admin/fai/class_faiTemplateEntry.inc",
-                               "fai_func" => "plugins/admin/fai/functions_FAI.inc",
                 "faiTemplate" => "plugins/admin/fai/class_faiTemplate.inc",
                 "tabsTemplate" => "plugins/admin/fai/tabsTemplate.inc",
                 "faiProfileEntry" => "plugins/admin/fai/class_faiProfileEntry.inc",
@@ -307,4 +307,4 @@ $class_mapping= array(
                 "setup" => "setup/class_setup.inc",
                 "Step_Migrate" => "setup/class_setupStep_Migrate.inc",
  );
-?>
+?>
\ No newline at end of file
index 9e5d706d37f14aa2622d94672bf50fc09d62adf6..29e8840407e5939715e251d16936ae9336ba17c0 100644 (file)
@@ -822,7 +822,7 @@ class plugin
   {
     /* Rename dn in possible object groups */
     $ldap= $this->config->get_ldap_link();
-    $ldap->search('(&(objectClass=gosaGroupOfNames)(member='.@LDAP::fix($src_dn).'))',
+    $ldap->search('(&(objectClass=gosaGroupOfNames)(member='.@LDAP::preapre4filter($src_dn).'))',
         array('cn'));
     while ($attrs= $ldap->fetch()){
       $og= new ogroup($this->config, $ldap->getDN());
index 9c72d0ab5269af16f55e89ebf34349dabed69eed..01581ab9bb67b4ed5619f3c9b15bcd99ed31b9f6 100644 (file)
@@ -606,7 +606,7 @@ class aclrole extends acl
 
     /* Delete references to object groups */
     $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
     while ($ldap->fetch()){
       $og= new ogroup($this->config, $ldap->getDN());
       unset($og->member[$this->dn]);
index daa97d63720ecbe65d002c0ea504e4778265e169..247acf97278aac3f39452d5eadd6ca5fef353b35 100644 (file)
@@ -242,7 +242,7 @@ class application extends plugin
 
     /* Delete references to object groups */
     $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
     while ($ldap->fetch()){
       $og= new ogroup($this->config, $ldap->getDN());
       unset($og->member[$this->dn]);
index c8577edb2b2d6a6e52a4dbf9028fb9c109e7e50b..adb1bed530fb846dea6441e253cf96e7c5eab90f 100644 (file)
@@ -491,7 +491,7 @@ class departmentManagement extends plugin
 
     /* Delete references to object groups */
     $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
     while ($ldap->fetch()){
       $og= new ogroup($this->config, $ldap->getDN());
       unset($og->member[$this->dn]);
index 2de3144046e58de37e3e1374624300987e83fdba..24c16c7bcf35bac7355bc8979153e3038f31e5c8 100644 (file)
@@ -564,7 +564,7 @@ class group extends plugin
 
     /* Delete references to object groups */
     $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
     while ($ldap->fetch()){
       $og= new ogroup($this->config, $ldap->getDN());
       unset($og->member[$this->dn]);
index 1895e163a6b78d380b01f037f96759cb5914b8f5..03867ebab5497458f99500b8ca130b91de98329f 100644 (file)
@@ -513,7 +513,7 @@ class mimetype extends plugin
 
     /* Delete references to object groups */
     $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
     while ($ldap->fetch()){
       $og= new ogroup($this->config, $ldap->getDN());
       unset($og->member[$this->dn]);
index 2772f3501cdd81e2d487476417b394e57c845b85..583625188ab6e8c2063b5ba4f5025d699feb759d 100644 (file)
@@ -141,7 +141,7 @@ class componentGeneric extends plugin
 
     /* Delete references to object groups */
     $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
     while ($ldap->fetch()){
       $og= new ogroup($this->config, $ldap->getDN());
       unset($og->member[$this->dn]);
index 3357e5c0bad1fd74da0ae1daea3d31e65335c92e..444e3f6f349679a386d350408c51c11b6ef09529 100644 (file)
@@ -284,7 +284,7 @@ class phoneGeneric extends plugin
 
       /* Delete references to object groups */
       $ldap->cd ($this->config->current['BASE']);
-      $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+      $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
       while ($ldap->fetch()){
         $og= new ogroup($this->config, $ldap->getDN());
         unset($og->member[$this->dn]);
index b2954dc04644e80be21f9e982c6c8fc96bf9c63c..8940a9356a0b0b0000745793a159796802162943 100644 (file)
@@ -605,7 +605,7 @@ class printgeneric extends plugin
 
       /* Delete references to object groups */
       $ldap->cd ($this->config->current['BASE']);
-      $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+      $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
       while ($ldap->fetch()){
         $og= new ogroup($this->config, $ldap->getDN());
         unset($og->member[$this->dn]);
index c0f1d595cb04bfe6a87209ee0c2f957c56b5911d..91eec6805b528ff08c3c65a9e65bd668df8c91f8 100644 (file)
@@ -252,7 +252,7 @@ class servgeneric extends plugin
 
     /* Delete references to object groups */
     $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
     while ($ldap->fetch()){
       $og= new ogroup($this->config, $ldap->getDN());
       unset($og->member[$this->dn]);
index 6782d8fab197a69e0be69c1f4594c01fc089f3ea..cdd9b8d685dcab0233915f91c9d88393e23977d0 100644 (file)
@@ -73,7 +73,7 @@ class termgeneric extends plugin
     if(!isset($this->parent->by_object['ogroup'])){
       $ldap = $this->config->get_ldap_link();
       $ldap->cd ($this->config->current['BASE']);
-      $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".$this->dn."))",array("cn"));
+      $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".LDAP::prepare4filter($this->dn)."))",array("cn"));
       $this->member_of_ogroup = $ldap->count() >= 1;
     }
 
@@ -385,7 +385,7 @@ class termgeneric extends plugin
 
         /* Delete references to object groups */
         $ldap->cd ($this->config->current['BASE']);
-        $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+        $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
         while ($ldap->fetch()){
           $og= new ogroup($this->config, $ldap->getDN());
           unset($og->member[$this->dn]);
index e73acf2298eaf27c313134233c3ff2f12d972c0b..54e1d865d2f43f4c0aa2e2998d0512bc5ea2e006 100644 (file)
@@ -200,7 +200,7 @@ class termservice extends plugin
     /* Load hardware list */
     $ldap= $this->config->get_ldap_link();
     $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".$this->dn."))");
+    $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".LDAP::prepare4filter($this->dn)."))");
     if ($ldap->count() == 1){
       $map= array("gotoXResolution", "gotoXColordepth", "gotoXKbModel", "gotoXKbLayout",
                   "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport");
index b03aa140bb2794e7c1b94dd24a0b90a7d3db60e2..362bc7d8c10b920a8b66b5d08819e1c22178852a 100644 (file)
@@ -139,7 +139,7 @@ class termstartup extends plugin
     /* Load hardware list */
     $ldap= $this->config->get_ldap_link();
     $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".$this->dn."))");
+    $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".LDAP::prepare4filter($this->dn)."))");
     if ($ldap->count() == 1){
       $map= array("gotoLdapServer");
       $attrs= $ldap->fetch();
index 8e21266117cf158dfb1e08887031dc2bb10f90ef..559446548bf584490ec6bf4e689fa04686e1bae2 100644 (file)
@@ -161,7 +161,7 @@ class wingeneric extends plugin
 
     /* Delete references to object groups */
     $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
     while ($ldap->fetch()){
       $og= new ogroup($this->config, $ldap->getDN());
       unset($og->member[$this->dn]);
index 505397535399a159a24db014905eff4196065ce5..0f0f97a982b59974afb99bca93f5e1a5c7220e31 100644 (file)
@@ -78,7 +78,7 @@ class workgeneric extends plugin
     if(!isset($this->parent->by_object['ogroup'])){
       $ldap = $this->config->get_ldap_link();
       $ldap->cd ($this->config->current['BASE']);
-      $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".normalizeLdap(preg_replace('/\\\\/', '\\\\\\', LDAP::fix($this->dn)))."))",array("cn"));
+      $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".LDAP::prepare4filter($this->dn)."))",array("cn"));
       $this->member_of_ogroup = $ldap->count() >= 1;
     }
 
@@ -368,7 +368,7 @@ class workgeneric extends plugin
 
       /* Delete references to object groups */
       $ldap->cd ($this->config->current['BASE']);
-      $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+      $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
       while ($ldap->fetch()){
         $og= new ogroup($this->config, $ldap->getDN());
         unset($og->member[$this->dn]);
index 5b1a43e1abd56d7be362451e23caef5e01dc6b5c..815b52c0cfb3f1a6fdf04468b6abda308e8101e5 100644 (file)
@@ -182,7 +182,7 @@ class workservice extends plugin
     /* Load hardware list */
     $ldap= $this->config->get_ldap_link();
     $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".$this->dn."))");
+    $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".LDAP::prepare4filter($this->dn)."))");
     if ($ldap->count() == 1){
       $map= array("gotoXResolution", "gotoXColordepth", "gotoXKbModel", "gotoXKbLayout",
                   "gotoXKbVariant", "gotoXMouseType", "gotoXMouseport");
index 97410c8dcf2afad83314ea30f618481ec3f38d0c..a63fdd3278576cddad550b17715a6f7e62bee0fc 100644 (file)
@@ -77,7 +77,7 @@ class workstartup extends plugin
     if(!isset($this->parent->by_object['ogroup'])){
       $ldap = $this->config->get_ldap_link();
       $ldap->cd ($this->config->current['BASE']);
-      $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".$this->dn."))",array("cn","dn"));
+      $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".LDAP::prepare4filter($this->dn)."))",array("cn","dn"));
       if($ldap->count()){
         $this->member_of_ogroup = TRUE;
         $attrs = $ldap->fetch();
index ed33bec45ca01f97cdd3fae9cf4103ae80016b9a..faac2d0d5f89dde9f72a5e99ce404f1db9e0e333 100644 (file)
@@ -83,7 +83,7 @@ class reference extends plugin
        $ldap= $this->config->get_ldap_link();
        $ldap->cd($this->config->current['BASE']);
 
-       $ldap->search("(|(member=".normalizeLdap(preg_replace('/\\\\/', '\\\\\\', LDAP::fix($this->dn))).")(memberUid=".$this->uid."))",array("memberUid","member","cn","description","objectClass"));
+       $ldap->search("(|(member=".LDAP::prepare4filter($this->dn).")(memberUid=".$this->uid."))",array("memberUid","member","cn","description","objectClass"));
        
        $cycle= array("F5F5F5", "ECECEC");
        $id= 0;
index 65fccd9b99001380315869f562eee0bc036d5154..50b4b241b32bbd3f7e4a0fb1cb832a752f6b9733 100644 (file)
@@ -451,7 +451,7 @@ class phoneConferenceManagment extends plugin
 
     /* Delete references to object groups */
     $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
     while ($ldap->fetch()){
       $og= new conftab($this->config, $ldap->getDN());
       unset($og->member[$this->dn]);
index f4ed4a8bae2c9074b178e52f2355397680da6e83..07e10f0aa3f8110a559b87359a49b168bc8b8f80 100644 (file)
@@ -492,7 +492,7 @@ class macro extends plugin
 
     /* Delete references to object groups */
     $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
     while ($ldap->fetch()){
       $og= new ogroup($this->config, $ldap->getDN());
       unset($og->member[$this->dn]);
index 035b557148090fffab8105c6e5ec02a4067b35d9..ee7da75d697bcadf7fedbdbb6a9a3611bcf25959 100644 (file)
@@ -661,7 +661,7 @@ class user extends plugin
 
     /* Delete references to object groups */
     $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::preapre4filter($this->dn)."))", array("cn"));
     while ($ldap->fetch()){
       $og= new ogroup($this->config, $ldap->getDN());
       unset($og->member[$this->dn]);
index 16dbf8a276157e022832ad8d7632131a2d506e95..f60281976eb0db009790ca3cbdc069d6f07a90a9 100644 (file)
@@ -1067,7 +1067,7 @@ class Step_Migrate extends setup_step
 
 
           /* Check if there are references to this object */
-          $ldap->search("(&(member=".$dn.")(|(objectClass=gosaGroupOfNames)(objectClass=groupOfNames)))",array('dn'));
+          $ldap->search("(&(member=".LDAP::prepare4filter($dn).")(|(objectClass=gosaGroupOfNames)(objectClass=groupOfNames)))",array('dn'));
           $refs = "";
           while($attrs = $ldap->fetch()){
             $ref_dn = $attrs['dn'];
@@ -1115,7 +1115,7 @@ class Step_Migrate extends setup_step
           $this->outside_groups[$b_dn]['ldif'] = _("Group will be moved from").":<br>\t".($ldap->fix($dn))."<br>"._("to").":<br>\t".($ldap->fix($d_dn));
 
           /* Check if there are references to this object */
-          $ldap->search("(&(member=".$dn.")(|(objectClass=gosaGroupOfNames)(objectClass=groupOfNames)))",array('dn'));
+          $ldap->search("(&(member=".LDAP::prepare4filter($dn).")(|(objectClass=gosaGroupOfNames)(objectClass=groupOfNames)))",array('dn'));
           $refs = "";
           while($attrs = $ldap->fetch()){
             $ref_dn = $attrs['dn'];
@@ -1162,7 +1162,7 @@ class Step_Migrate extends setup_step
           $this->outside_users[$b_dn]['ldif'] = _("User will be moved from").":<br>\t".($ldap->fix($dn))."<br>"._("to").":<br>\t".($ldap->fix($d_dn));
 
           /* Check if there are references to this object */
-          $ldap->search("(&(member=".$dn.")(|(objectClass=gosaGroupOfNames)(objectClass=groupOfNames)))",array('dn'));
+          $ldap->search("(&(member=".LDAP::prepare4filter($dn).")(|(objectClass=gosaGroupOfNames)(objectClass=groupOfNames)))",array('dn'));
           $refs = "";
           while($attrs = $ldap->fetch()){
             $ref_dn = $attrs['dn'];
@@ -1891,7 +1891,7 @@ class Step_Migrate extends setup_step
      /* Update object references in gosaGroupOfNames */
     $ogs_to_fix = array();
     $ldap->cd($cv['base']);
-    $ldap->search('(&(objectClass=gosaGroupOfNames)(member='.@LDAP::fix($source).'))', array('cn','member'));
+    $ldap->search('(&(objectClass=gosaGroupOfNames)(member='.@LDAP::prepare4filter($source).'))', array('cn','member'));
     while ($attrs= $ldap->fetch()){
       $dn = $attrs['dn'];
       $attrs = $this->cleanup_array($attrs);