Code

Updated a bunch of files for broken dn sensitivity
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 6 Nov 2009 17:00:59 +0000 (17:00 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 6 Nov 2009 17:00:59 +0000 (17:00 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14789 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/mimetypes/class_mimetypeGeneric.inc
gosa-plugins/goto/admin/mimetypes/class_mimetypeManagement.inc
gosa-plugins/goto/admin/systems/goto/class_printGeneric.inc
gosa-plugins/goto/admin/systems/goto/class_terminalGeneric.inc
gosa-plugins/goto/admin/systems/goto/class_workstationGeneric.inc
gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc
gosa-plugins/systems/admin/systems/class_servGeneric.inc
gosa-plugins/systems/admin/systems/class_systemManagement.inc

index 2e266a903c1e7c0fa4dbd2239c976fc60821ca4c..62d3ff86838edb883c9084e8368c3dd6437417e9 100644 (file)
@@ -129,7 +129,7 @@ class mimetype extends plugin
         $this->base= dn2base($ui->dn);
       }
     } else {
-      $this->base= preg_replace ("/^.*,".preg_quote(get_ou("mimetypeRDN"), '/')."/", "", $this->dn);
+      $this->base= preg_replace ("/^.*,".preg_quote(get_ou("mimetypeRDN"), '/')."/i", "", $this->dn);
     }
 
     /* Get icon data */
index f7be97b7e4aebb8e8f6bb4ccf5b0d660aadfa7ea..5074c325f97ea9c41dc0c1b80cff5ba80e785629 100644 (file)
@@ -593,7 +593,7 @@ class mimetypeManagement extends plugin
     if(!$this->IsReleaseManagementActivated()){
       $use_base = $this->mime_base;
       if($SubSearch){
-        $use_base = preg_replace("/^".preg_quote(get_ou("mimeou"), '/')."/","",$use_base);
+        $use_base = preg_replace("/^".preg_quote(get_ou("mimeou"), '/')."/i","",$use_base);
       }
     }else{
       $use_base = $this->mime_release;
@@ -690,7 +690,7 @@ class mimetypeManagement extends plugin
     if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
 
       /* Get dialog */
-      $this->CopyPasteHandler->SetVar("base",preg_replace("/^".preg_quote(get_ou("mimetypeRDN"), '/')."/","",$this->mime_base));
+      $this->CopyPasteHandler->SetVar("base",preg_replace("/^".preg_quote(get_ou("mimetypeRDN"), '/')."/i","",$this->mime_base));
       $this->CopyPasteHandler->SetVar("parent",$this);
       $data = $this->CopyPasteHandler->execute();
 
index 9473158f32063f23800ca56d54e9ac7478edce18..809cd7292845a80ab061329f0271b5af768cd31f 100644 (file)
@@ -65,11 +65,11 @@ class printgeneric extends plugin
 
     /* Update dn, to ensure storing as printer instead of WS / terminal */
     if(preg_match("/Terminal/i",$this->BelongsTo) || preg_match("/TerminalTemplate/i",$this->BelongsTo)){
-      $this->dn= preg_replace("/".preg_quote(get_ou('terminalRDN'), '/')."/",get_ou('printerRDN'),$this->dn);
+      $this->dn= preg_replace("/".preg_quote(get_ou('terminalRDN'), '/')."/i",get_ou('printerRDN'),$this->dn);
     }
 
     if(preg_match("/Workstation/i",$this->BelongsTo) || preg_match("/WorkstationTemplate/i",$this->BelongsTo)){
-      $this->dn= preg_replace("/".preg_quote(get_ou('workstationRDN'), '/')."/",get_ou('printerRDN'),$this->dn);
+      $this->dn= preg_replace("/".preg_quote(get_ou('workstationRDN'), '/')."/i",get_ou('printerRDN'),$this->dn);
     }
 
     $this->orig_dn = $this->dn;
@@ -98,10 +98,10 @@ class printgeneric extends plugin
     } else {
     
       /* Set base and check if the extracted base exists */
-      if(preg_match("/".preg_quote(get_ou('systemIncomingRDN'), '/')."/",$this->dn)){
-        $this->base= preg_replace("/".preg_quote(get_ou('systemIncomingRDN'), '/')."/","",dn2base($this->dn));
+      if(preg_match("/".preg_quote(get_ou('systemIncomingRDN'), '/')."/i",$this->dn)){
+        $this->base= preg_replace("/".preg_quote(get_ou('systemIncomingRDN'), '/')."/i","",dn2base($this->dn));
       }else{
-        $this->base= preg_replace("/".preg_quote(get_ou('printerRDN'), '/')."/","",dn2base($this->dn));
+        $this->base= preg_replace("/".preg_quote(get_ou('printerRDN'), '/')."/i","",dn2base($this->dn));
       }
 
       if(!isset($this->config->idepartments[$this->base])){
@@ -244,11 +244,11 @@ class printgeneric extends plugin
       /* Update dn, to ensure storing as printer instead of WS / terminal
        */
       if(preg_match("/terminal/i",$this->BelongsTo)){
-        $this->dn= preg_replace("/".preg_quote(get_ou('terminalRDN'), '/')."/",get_ou('printerRDN'),$this->dn);
+        $this->dn= preg_replace("/".preg_quote(get_ou('terminalRDN'), '/')."/i",get_ou('printerRDN'),$this->dn);
       }
 
       if(preg_match("/workstation/i",$this->BelongsTo)){
-        $this->dn= preg_replace("/".preg_quote(get_ou('workstationRDN'), '/')."/",get_ou('printerRDN'),$this->dn);
+        $this->dn= preg_replace("/".preg_quote(get_ou('workstationRDN'), '/')."/i",get_ou('printerRDN'),$this->dn);
       }
 
       /* Detect if this is a valid printer account;
@@ -628,11 +628,11 @@ class printgeneric extends plugin
       /* Update dn, to ensure storing as printer instead of WS / terminal
        */
       if(preg_match("/terminal/i",$this->BelongsTo)){
-        $this->dn= preg_replace("/".preg_quote(get_ou('terminalRDN'), '/').",/",get_ou('printerRDN'),$this->dn);
+        $this->dn= preg_replace("/".preg_quote(get_ou('terminalRDN'), '/').",/i",get_ou('printerRDN'),$this->dn);
       }
 
       if(preg_match("/workstation/i",$this->BelongsTo)){
-        $this->dn= preg_replace("/".preg_quote(get_ou('workstationRDN'), '/')."/",get_ou('printerRDN'),$this->dn);
+        $this->dn= preg_replace("/".preg_quote(get_ou('workstationRDN'), '/')."/i",get_ou('printerRDN'),$this->dn);
       }
 
       /* Check if this dn points to a printer, to avoid deleting something else */
@@ -779,11 +779,11 @@ class printgeneric extends plugin
     /* Update dn, to ensure storing as printer instead of WS / terminal
      */
     if(preg_match("/terminal/i",$this->BelongsTo)){
-      $this->dn= preg_replace("/".preg_quote(get_ou('terminalRDN'), '/')."/",get_ou('printerRDN'),$this->dn);
+      $this->dn= preg_replace("/".preg_quote(get_ou('terminalRDN'), '/')."/i",get_ou('printerRDN'),$this->dn);
     }
 
     if(preg_match("/workstation/i",$this->BelongsTo)){
-      $this->dn= preg_replace("/".preg_quote(get_ou('workstationRDN'), '/')."/",get_ou('printerRDN'),$this->dn);
+      $this->dn= preg_replace("/".preg_quote(get_ou('workstationRDN'), '/')."/i",get_ou('printerRDN'),$this->dn);
     }
     
     if(!$this->is_account) return;
@@ -915,7 +915,7 @@ class printgeneric extends plugin
     }
 
     /* Ensure to create a new object */
-    if(preg_match("/".preg_quote(get_ou('systemIncomingRDN'), '/')."/",$this->orig_dn)){
+    if(preg_match("/".preg_quote(get_ou('systemIncomingRDN'), '/')."/i",$this->orig_dn)){
       $this->orig_dn = "new";
     }
 
index 766eb1fe7dc51809cb0e1e9a71d2bfff8ab1ec43..8ad176317100d74e563ecff88a75258d63f6f23e 100644 (file)
@@ -128,7 +128,7 @@ class termgeneric extends plugin
       $ui= get_userinfo();
       $this->base= dn2base($ui->dn);
     } else {
-      $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("terminalRDN"), '/')."/", "", $this->dn);
+      $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("terminalRDN"), '/')."/i", "", $this->dn);
     }
 
     /* Create an array of all Syslog servers */
@@ -465,7 +465,7 @@ class termgeneric extends plugin
       }
       if ($ldap->count() != 0){
         while ($attrs= $ldap->fetch()){
-          if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".preg_quote(get_ou('systemIncomingRDN'), '/')."/", $ldap->getDN())){
+          if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".preg_quote(get_ou('systemIncomingRDN'), '/')."/i", $ldap->getDN())){
             continue;
           } else {
             if ($attrs['dn'] != $this->orig_dn){
@@ -510,7 +510,7 @@ class termgeneric extends plugin
       $ldap= $this->config->get_ldap_link();
 
       /* Strip relevant part from dn, keep trailing ',' */
-      $tmp= preg_replace("/^cn=[^,]+,".get_ou('terminalRDN')."/i", "", $this->dn);
+      $tmp= preg_replace("/^cn=[^,]+,".preg_quote(get_ou('terminalRDN'), '/')."/i", "", $this->dn);
       $tmp= preg_replace("/".$this->config->current['BASE']."$/i", "", $tmp);
 
       /* Walk from top to base and try to load default values for
index b45deb6a5ce10569b35e09c583e6603cfaa7ef89..dd6a3837ef715ace015411585905a38d9e5d4670 100644 (file)
@@ -473,7 +473,7 @@ class workgeneric extends plugin
       }
       if ($ldap->count() != 0){
         while ($attrs= $ldap->fetch()){
-          if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".get_ou('systemIncomingRDN')."/", $ldap->getDN())){
+          if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".preg_quote(get_ou('systemIncomingRDN'), '/')."/i", $ldap->getDN())){
             continue;
           } else {
             if ($attrs['dn'] != $this->orig_dn){
@@ -503,7 +503,7 @@ class workgeneric extends plugin
     }else{
       /* Warn the user, that this host is currently installing */
       if($this->currently_installing && !$this->currently_installing_warned && 
-          !preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/",$this->orig_dn)){
+          !preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/i",$this->orig_dn)){
       
         /* Force aborting without message dialog */
         $message[] = "";
index 94aec44278f2a4c457d8f0e97d94e784d033a039..be726ecb4b9f7695ad93bc0b60c1eac33d431499 100644 (file)
@@ -777,7 +777,7 @@ class workstartup extends plugin
       $ldap= $this->config->get_ldap_link();
 
       /* Strip relevant part from dn, keep trailing ',' */
-      $tmp= preg_replace("/^cn=[^,]+,".get_ou('terminalRDN')."/i", "", $this->dn);
+      $tmp= preg_replace("/^cn=[^,]+,".preg_quote(get_ou('terminalRDN'), '/')."/i", "", $this->dn);
       $tmp= preg_replace("/".$this->config->current['BASE']."$/i", "", $tmp);
 
       /* Walk from top to base and try to load default values for
@@ -1327,7 +1327,7 @@ class workstartup extends plugin
    */
   function dn_to_release_name($dn)
   {
-    $relevant = preg_replace("/,".preg_quote(get_ou("faiBaseRDN"), '/').".*$/","",$dn);
+    $relevant = preg_replace("/,".preg_quote(get_ou("faiBaseRDN"), '/').".*$/i","",$dn);
     $parts    = array_reverse(split("\,",$relevant));
     $str ="";
     foreach($parts as $part){
index acbdf87ed035567d14de2df5e07c6e3d513f1402..cf5ca5f88f9aab357117b9f1d325191462581357 100644 (file)
@@ -77,11 +77,7 @@ class servgeneric extends plugin
 
     plugin::plugin ($config, $dn, $parent);
 
-    /* Initialize kerberos host key plugin */
-    if(class_available("krbHostKeys")){
-      $this->kerberos_key_service = new krbHostKeys($this->config,$this);
-    }
-
+    /* Initialize */
     $this->ui = get_userinfo();
     $this->modes["active"]= _("Activated");
     $this->modes["locked"]= _("Locked");
@@ -92,13 +88,18 @@ class servgeneric extends plugin
       $this->base= dn2base($ui->dn);
       $this->cn= "";
     } else {
-      $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("serverRDN"), '/')."/", "", $this->dn);
+      $this->base= preg_replace ("/^[^,]+,".preg_quote(get_ou("serverRDN"), '/')."/i", "", $this->dn);
     }
     $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses);
     $this->netConfigDNS->set_acl_category("server");
     $this->netConfigDNS->set_acl_base($this->base);
     $this->netConfigDNS->MACisMust =TRUE;
 
+    /* Initialize kerberos host key plugin */
+    if(class_available("krbHostKeys")){
+      $this->kerberos_key_service = new krbHostKeys($this->config,$this);
+    }
+
     /* Check if this host is currently in installation process*/
     if($this->dn != "new" && class_available("gosaSupportDaemon") && class_available("DaemonEvent")){
       $o = new gosaSupportDaemon();
@@ -352,7 +353,7 @@ class servgeneric extends plugin
       if ($ldap->count() != 0){
         while ($attrs= $ldap->fetch()){
           if ($attrs['dn'] != $this->orig_dn){
-            if(!preg_match("/cn=dhcp,/",$attrs['dn']) && !preg_match("/,".get_ou('systemIncomingRDN')."/",$attrs['dn']) && preg_match("/,".get_ou('serverRDN')."/",$attrs['dn'])){
+            if(!preg_match("/cn=dhcp,/",$attrs['dn']) && !preg_match("/,".preg_quote(get_ou('systemIncomingRDN'), '/')."/i",$attrs['dn']) && preg_match("/,".preg_quote(get_ou('serverRDN'), '/')."/i",$attrs['dn'])){
               $message[]= msgPool::duplicated(_("Server name"));
               break;
             }
@@ -362,7 +363,7 @@ class servgeneric extends plugin
     }
 
     /* Warn the user, that this host is currently installing */
-    if($this->currently_installing && !$this->currently_installing_warned && !preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/",$this->orig_dn)){
+    if($this->currently_installing && !$this->currently_installing_warned && !preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/i",$this->orig_dn)){
 
       /* Force aborting without message dialog */
       $message[] = "";
index 84bd5b2b59ea8ac4a49a7405d20fd79b875b0e09..9caaffdcf557651f865ac4f4ab4e12c09e51ac4f 100644 (file)
@@ -388,7 +388,7 @@ class systems extends plugin
               $this->systab= new $tabclass($this->config, $this->config->data['TABS'][$class], $this->dn, $selected_system);
               $this->systab->set_acl_base($this->DivListSystem->selectedBase);
               if($selected_group != "none"){
-                $this->systab->base = preg_replace("/^[^,]+,".get_ou('ogroupRDN')."/", "", $selected_group);
+                $this->systab->base = preg_replace("/^[^,]+,".preg_quote(get_ou('ogroupRDN'), '/')."/i", "", $selected_group);
                 $this->systab->by_object[$tabname]->base = $this->systab->base;
               } else {
                 $this->systab->by_object[$tabname]->base = $this->DivListSystem->selectedBase;
@@ -1101,7 +1101,7 @@ class systems extends plugin
 
       $dialog     = FALSE;
       $hide_apply = $this->dn == "new";
-      $hide_apply = ($this->dn == "new") || (preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/",$this->dn));
+      $hide_apply = ($this->dn == "new") || (preg_match("/".preg_quote(get_ou("systemIncomingRDN"), '/')."/i",$this->dn));
       if(is_object($this->systab) && !isset($this->systab->by_object)){
         $dialog = TRUE;
         $hide_apply = TRUE;