summaryrefslogtreecommitdiffstats
path: root/lib/SimpleSAML
diff options
context:
space:
mode:
authorJaime Pérez <jaime.perez@uninett.no>2016-06-27 17:45:53 +0200
committerJaime Pérez <jaime.perez@uninett.no>2016-06-27 17:45:53 +0200
commitc72b62038e3687b78ac2b4ef76aa4a3f262beeda (patch)
treeb4ae81d06da0c4b4da3caaf6a0f48d610ee77072 /lib/SimpleSAML
parent9ff8b6f7e64a72b9f2681b81e957b6feb9d697e6 (diff)
downloadsimplesamlphp-c72b62038e3687b78ac2b4ef76aa4a3f262beeda.zip
simplesamlphp-c72b62038e3687b78ac2b4ef76aa4a3f262beeda.tar.gz
simplesamlphp-c72b62038e3687b78ac2b4ef76aa4a3f262beeda.tar.bz2
bugfix: Resolve issue with incorrect self URL when using symlinks.
Recent commits have introduced a new way to obtain the self URL, honouring whatever is specified in 'baseurlpath'. However, this new code breaks when accessing SimpleSAMLphp through a path containing symbolic links in the file system, since the base directory refers always to the real path while the $_SERVER contents reflect what the web server sees (symlinks included). We use realpath() to convert a path with symlinks to a canonical path that we can compare.
Diffstat (limited to 'lib/SimpleSAML')
-rw-r--r--lib/SimpleSAML/Utils/HTTP.php2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/SimpleSAML/Utils/HTTP.php b/lib/SimpleSAML/Utils/HTTP.php
index 9de34eb..4030478 100644
--- a/lib/SimpleSAML/Utils/HTTP.php
+++ b/lib/SimpleSAML/Utils/HTTP.php
@@ -722,7 +722,7 @@ class HTTP
$url = self::getBaseURL();
$cfg = \SimpleSAML_Configuration::getInstance();
$baseDir = $cfg->getBaseDir();
- $rel_path = str_replace($baseDir.'www/', '', $_SERVER['SCRIPT_FILENAME']);
+ $rel_path = str_replace($baseDir.'www/', '', realpath($_SERVER['SCRIPT_FILENAME']));
$pos = strpos($_SERVER['REQUEST_URI'], $rel_path) + strlen($rel_path);
return $url.$rel_path.substr($_SERVER['REQUEST_URI'], $pos);
}