[icinga-checkins] icinga.org: icinga-web/master: * Fixed dirname() creating invalid basepaths

git at icinga.org git at icinga.org
Tue Apr 24 15:01:14 CEST 2012


Module: icinga-web
Branch: master
Commit: 0250892ef87fe836524f25ffa4012e599b6d0d96
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=0250892ef87fe836524f25ffa4012e599b6d0d96

Author: Jannis Mosshammer <jannis.mosshammer at netways.de>
Date:   Tue Mar 13 16:14:37 2012 +0100

* Fixed dirname() creating invalid basepaths

---

 app/modules/Api/lib/config/AccessConfig.class.php |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/app/modules/Api/lib/config/AccessConfig.class.php b/app/modules/Api/lib/config/AccessConfig.class.php
index b9f0208..e05eed9 100644
--- a/app/modules/Api/lib/config/AccessConfig.class.php
+++ b/app/modules/Api/lib/config/AccessConfig.class.php
@@ -68,8 +68,9 @@ final class AccessConfig {
         foreach($hosts as $host) {
             if(isset($host["r"][$file]) || isset($host["rw"][$file]))
                 continue;
+            $basedir = preg_replace("/([^\\\]) .*/","$1",$file);
             if(in_array($file,$host["r"]) || in_array($file,$host["rw"])
-                || in_array(dirname($file)."/*",$host["r"]) || in_array(dirname($file)."/*",$host["rw"]))
+                || in_array(dirname($basedir)."/*",$host["r"]) || in_array(dirname($basedir)."/*",$host["rw"]))
                 continue;
             return false;
         }
@@ -84,8 +85,9 @@ final class AccessConfig {
         foreach($hosts as $host) {
             if(isset($host["w"][$file]) || isset($host["rw"][$file]))
                 continue;
+            $basedir = preg_replace("/([^\\\]) .*/","$1",$file);
             if (in_array($file,$host["w"]) || in_array($file,$host["rw"])
-                || in_array(dirname($file)."/*",$host["w"]) || in_array(dirname($file)."/*",$host["rw"]))
+                || in_array(dirname($basedir)."/*",$host["w"]) || in_array(dirname($basedir)."/*",$host["rw"]))
                 continue;
             return false;
         }
@@ -99,7 +101,8 @@ final class AccessConfig {
         foreach($hosts as $host) {
             if(isset($host["x"][$file]))
                 continue;
-            if(in_array($file,$host["x"]) || in_array(dirname($file)."/*",$host["x"]))
+            $basedir = preg_replace("/([^\\\]) .*/","$1",$file);            
+            if(in_array($file,$host["x"]) || in_array(dirname($basedir)."/*",$host["x"]))
                 continue;
             return false;
         }





More information about the icinga-checkins mailing list