aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/encryption/util.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/encryption/util.php')
-rw-r--r--lib/private/encryption/util.php42
1 files changed, 36 insertions, 6 deletions
diff --git a/lib/private/encryption/util.php b/lib/private/encryption/util.php
index d0733941a35..90ae8259972 100644
--- a/lib/private/encryption/util.php
+++ b/lib/private/encryption/util.php
@@ -59,7 +59,7 @@ class Util {
protected $blockSize = 8192;
/** @var View */
- protected $view;
+ protected $rootView;
/** @var array */
protected $ocHeaderKeys;
@@ -78,13 +78,13 @@ class Util {
/**
*
- * @param \OC\Files\View $view
+ * @param View $rootView
* @param \OC\User\Manager $userManager
* @param \OC\Group\Manager $groupManager
* @param IConfig $config
*/
public function __construct(
- \OC\Files\View $view,
+ View $rootView,
\OC\User\Manager $userManager,
\OC\Group\Manager $groupManager,
IConfig $config) {
@@ -93,7 +93,7 @@ class Util {
self::HEADER_ENCRYPTION_MODULE_KEY
];
- $this->view = $view;
+ $this->rootView = $rootView;
$this->userManager = $userManager;
$this->groupManager = $groupManager;
$this->config = $config;
@@ -167,7 +167,7 @@ class Util {
while ($dirList) {
$dir = array_pop($dirList);
- $content = $this->view->getDirectoryContent($dir);
+ $content = $this->rootView->getDirectoryContent($dir);
foreach ($content as $c) {
if ($c->getType() === 'dir') {
@@ -332,10 +332,22 @@ class Util {
* @return boolean
*/
public function isExcluded($path) {
- $normalizedPath = \OC\Files\Filesystem::normalizePath($path);
+ $normalizedPath = Filesystem::normalizePath($path);
$root = explode('/', $normalizedPath, 4);
if (count($root) > 1) {
+ // detect alternative key storage root
+ $rootDir = $this->getKeyStorageRoot();
+ if ($rootDir !== '' &&
+ 0 === strpos(
+ Filesystem::normalizePath($path),
+ Filesystem::normalizePath($rootDir)
+ )
+ ) {
+ return true;
+ }
+
+
//detect system wide folders
if (in_array($root[1], $this->excludedPaths)) {
return true;
@@ -364,6 +376,24 @@ class Util {
}
/**
+ * set new key storage root
+ *
+ * @param string $root new key store root relative to the data folder
+ */
+ public function setKeyStorageRoot($root) {
+ $this->config->setAppValue('core', 'encryption_key_storage_root', $root);
+ }
+
+ /**
+ * get key storage root
+ *
+ * @return string key storage root
+ */
+ public function getKeyStorageRoot() {
+ return $this->config->getAppValue('core', 'encryption_key_storage_root', '');
+ }
+
+ /**
* Wraps the given storage when it is not a shared storage
*
* @param string $mountPoint