diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-04-10 15:49:45 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-04-10 15:49:45 +0200 |
commit | 7b2d53603c4410ec9d66826caf3c49c53644dffc (patch) | |
tree | 9e7136d4a3c793de5bf6d3d76299b2966de3d098 /lib | |
parent | 20a1a110de2e4bf84f00a3bb65e266e24d0c2e28 (diff) | |
parent | 25dd4ec767080341bf87ed957cbfc86a0b5d78aa (diff) | |
download | nextcloud-server-7b2d53603c4410ec9d66826caf3c49c53644dffc.tar.gz nextcloud-server-7b2d53603c4410ec9d66826caf3c49c53644dffc.zip |
Merge pull request #15489 from owncloud/dont_hide_exceptions_master
Dont hide exceptions master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/base.php | 4 | ||||
-rw-r--r-- | lib/private/files/filesystem.php | 62 | ||||
-rw-r--r-- | lib/private/hook.php | 3 | ||||
-rw-r--r-- | lib/private/servernotavailableexception.php | 27 | ||||
-rw-r--r-- | lib/private/user/nouserexception.php | 14 |
5 files changed, 79 insertions, 31 deletions
diff --git a/lib/base.php b/lib/base.php index 74c1e8c0f42..f0c54640b17 100644 --- a/lib/base.php +++ b/lib/base.php @@ -967,6 +967,10 @@ class OC { } } catch (\OC\User\LoginException $e) { $messages[] = $e->getMessage(); + } catch (\Exception $ex) { + \OCP\Util::logException('handleLogin', $ex); + // do not disclose information. show generic error + $error[] = 'internalexception'; } OC_Util::displayLoginPage(array_unique($error), $messages); diff --git a/lib/private/files/filesystem.php b/lib/private/files/filesystem.php index 95e630b7765..10c64e1301a 100644 --- a/lib/private/files/filesystem.php +++ b/lib/private/files/filesystem.php @@ -373,42 +373,42 @@ class Filesystem { $userObject = \OC_User::getManager()->get($user); - if (!is_null($userObject)) { - $homeStorage = \OC_Config::getValue( 'objectstore' ); - if (!empty($homeStorage)) { - // sanity checks - if (empty($homeStorage['class'])) { - \OCP\Util::writeLog('files', 'No class given for objectstore', \OCP\Util::ERROR); - } - if (!isset($homeStorage['arguments'])) { - $homeStorage['arguments'] = array(); - } - // instantiate object store implementation - $homeStorage['arguments']['objectstore'] = new $homeStorage['class']($homeStorage['arguments']); - // mount with home object store implementation - $homeStorage['class'] = '\OC\Files\ObjectStore\HomeObjectStoreStorage'; - } else { - $homeStorage = array( - //default home storage configuration: - 'class' => '\OC\Files\Storage\Home', - 'arguments' => array() - ); - } - $homeStorage['arguments']['user'] = $userObject; + if (is_null($userObject)) { + \OCP\Util::writeLog('files', ' Backends provided no user object for '.$user, \OCP\Util::ERROR); + throw new \OC\User\NoUserException(); + } - // check for legacy home id (<= 5.0.12) - if (\OC\Files\Cache\Storage::exists('local::' . $root . '/')) { - $homeStorage['arguments']['legacy'] = true; + $homeStorage = \OC_Config::getValue( 'objectstore' ); + if (!empty($homeStorage)) { + // sanity checks + if (empty($homeStorage['class'])) { + \OCP\Util::writeLog('files', 'No class given for objectstore', \OCP\Util::ERROR); } - - self::mount($homeStorage['class'], $homeStorage['arguments'], $user); - - $home = \OC\Files\Filesystem::getStorage($user); + if (!isset($homeStorage['arguments'])) { + $homeStorage['arguments'] = array(); + } + // instantiate object store implementation + $homeStorage['arguments']['objectstore'] = new $homeStorage['class']($homeStorage['arguments']); + // mount with home object store implementation + $homeStorage['class'] = '\OC\Files\ObjectStore\HomeObjectStoreStorage'; + } else { + $homeStorage = array( + //default home storage configuration: + 'class' => '\OC\Files\Storage\Home', + 'arguments' => array() + ); } - else { - self::mount('\OC\Files\Storage\Local', array('datadir' => $root), $user); + $homeStorage['arguments']['user'] = $userObject; + + // check for legacy home id (<= 5.0.12) + if (\OC\Files\Cache\Storage::exists('local::' . $root . '/')) { + $homeStorage['arguments']['legacy'] = true; } + self::mount($homeStorage['class'], $homeStorage['arguments'], $user); + + $home = \OC\Files\Filesystem::getStorage($user); + self::mountCacheDir($user); // Chance to mount for other storages diff --git a/lib/private/hook.php b/lib/private/hook.php index c4ea1999b09..188c3d65acb 100644 --- a/lib/private/hook.php +++ b/lib/private/hook.php @@ -114,6 +114,9 @@ class OC_Hook{ OC_Log::write('hook', 'error while running hook (' . $class . '::' . $i["name"] . '): ' . $message, OC_Log::ERROR); + if($e instanceof \OC\ServerNotAvailableException) { + throw $e; + } } } diff --git a/lib/private/servernotavailableexception.php b/lib/private/servernotavailableexception.php new file mode 100644 index 00000000000..5a57917d23a --- /dev/null +++ b/lib/private/servernotavailableexception.php @@ -0,0 +1,27 @@ +<?php +/** + * @author Morris Jobke <hey@morrisjobke.de> + * + * @copyright Copyright (c) 2015, ownCloud, Inc. + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ + +namespace OC; + + +class ServerNotAvailableException extends \Exception { + +} diff --git a/lib/private/user/nouserexception.php b/lib/private/user/nouserexception.php new file mode 100644 index 00000000000..9452362b4e6 --- /dev/null +++ b/lib/private/user/nouserexception.php @@ -0,0 +1,14 @@ +<?php +/** + * ownCloud + * + * This file is licensed under the Affero General Public License version 3 or + * later. See the COPYING-AGPL file. + * + * @author Jörn Friedrich Dreyer <jfd@owncloud.com> + * @copyright Jörn Friedrich Dreyer 2015 + */ + +namespace OC\User; + +class NoUserException extends \Exception {}
\ No newline at end of file |