diff options
author | Lukas Reschke <lukas@owncloud.com> | 2014-09-05 17:39:37 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2014-09-05 17:39:37 +0200 |
commit | f5951b2254ba49a1f52a699941928b210c063c64 (patch) | |
tree | 3a42a2d57bb86f25bf21e3b181d3555157fcd609 /lib | |
parent | d15c3e4030d1ed6fad6e258b758a79c520d6bd39 (diff) | |
parent | c9afa60f6281dbaa2c5b0624ec818fc944c921e0 (diff) | |
download | nextcloud-server-f5951b2254ba49a1f52a699941928b210c063c64.tar.gz nextcloud-server-f5951b2254ba49a1f52a699941928b210c063c64.zip |
Merge pull request #10889 from owncloud/moveTrustedDomainCheck
Move trusted domain check to init()
Diffstat (limited to 'lib')
-rw-r--r-- | lib/base.php | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/base.php b/lib/base.php index 18331dd86aa..fb445124011 100644 --- a/lib/base.php +++ b/lib/base.php @@ -583,6 +583,21 @@ class OC { ); return; } + + $host = OC_Request::insecureServerHost(); + // if the host passed in headers isn't trusted + if (!OC::$CLI + // overwritehost is always trusted + && OC_Request::getOverwriteHost() === null + && !OC_Request::isTrustedDomain($host) + ) { + header('HTTP/1.1 400 Bad Request'); + header('Status: 400 Bad Request'); + $tmpl = new OCP\Template('core', 'untrustedDomain', 'guest'); + $tmpl->assign('domain', $_SERVER['SERVER_NAME']); + $tmpl->printPage(); + return; + } } private static function registerLocalAddressBook() { @@ -683,21 +698,6 @@ class OC { exit(); } - $host = OC_Request::insecureServerHost(); - // if the host passed in headers isn't trusted - if (!OC::$CLI - // overwritehost is always trusted - && OC_Request::getOverwriteHost() === null - && !OC_Request::isTrustedDomain($host) - ) { - header('HTTP/1.1 400 Bad Request'); - header('Status: 400 Bad Request'); - $tmpl = new OCP\Template('core', 'untrustedDomain', 'guest'); - $tmpl->assign('domain', $_SERVER['SERVER_NAME']); - $tmpl->printPage(); - return; - } - $request = OC_Request::getPathInfo(); if (substr($request, -3) !== '.js') { // we need these files during the upgrade self::checkMaintenanceMode(); |