summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Peter <github@florin-peter.de>2013-05-20 21:24:39 +0200
committerFlorin Peter <github@florin-peter.de>2013-05-20 21:24:39 +0200
commit1fa2f19ee44cc4a25bda784aee46ab2dac28e658 (patch)
tree8844d9e9e070dd6b1cbfa46c45e45a7a4213a75c
parent8e0540d0e45db9470ff0d17869bab6df41bd389a (diff)
downloadnextcloud-server-1fa2f19ee44cc4a25bda784aee46ab2dac28e658.tar.gz
nextcloud-server-1fa2f19ee44cc4a25bda784aee46ab2dac28e658.zip
removed dead code for delShareKey
-rw-r--r--apps/files_encryption/hooks/hooks.php26
-rwxr-xr-xapps/files_encryption/lib/keymanager.php26
2 files changed, 15 insertions, 37 deletions
diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php
index 087ba3d893c..90a93b4c52d 100644
--- a/apps/files_encryption/hooks/hooks.php
+++ b/apps/files_encryption/hooks/hooks.php
@@ -67,13 +67,13 @@ class Hooks {
// If migration not yet done
if ( ! $migrationCompleted ) {
- $view1 = new \OC_FilesystemView( '/' . $params['uid'] );
+ $userView = new \OC_FilesystemView( '/' . $params['uid'] );
// Set legacy encryption key if it exists, to support
// depreciated encryption system
- if (
- $view1->file_exists( 'encryption.key' )
- && $encLegacyKey = $view1->file_get_contents( 'encryption.key' )
+ if (
+ $userView->file_exists( 'encryption.key' )
+ && $encLegacyKey = $userView->file_get_contents( 'encryption.key' )
) {
$plainLegacyKey = Crypt::legacyDecrypt( $encLegacyKey, $params['password'] );
@@ -412,25 +412,11 @@ class Hooks {
// Unshare every user who no longer has access to the file
$delUsers = array_diff( $userIds, $sharingUsers);
-
- if ( !Keymanager::delShareKey( $view, $delUsers, $path ) ) {
-
- $failed[] = $path;
-
- }
+ // delete share key
+ Keymanager::delShareKey( $view, $delUsers, $path );
}
- // If no attempts to set keyfiles failed
- if ( empty( $failed ) ) {
-
- return true;
-
- } else {
-
- return false;
-
- }
}
}
diff --git a/apps/files_encryption/lib/keymanager.php b/apps/files_encryption/lib/keymanager.php
index 1bc334e7a17..542b1cf2876 100755
--- a/apps/files_encryption/lib/keymanager.php
+++ b/apps/files_encryption/lib/keymanager.php
@@ -540,32 +540,23 @@ class Keymanager
$shareKeyPath = '/' . $owner . '/files_encryption/share-keys/' . $filename;
- $result = false;
-
if ($view->is_dir($shareKeyPath)) {
- $localPath = \OC_Filesystem::normalizePath($view->getLocalFolder($shareKeyPath));
- $result = self::recursiveDelShareKeys($localPath, $userIds);
+ $localPath = \OC\Files\Filesystem::normalizePath($view->getLocalFolder($shareKeyPath));
+ self::recursiveDelShareKeys($localPath, $userIds);
} else {
foreach ($userIds as $userId) {
- $view->unlink($shareKeyPath . '.' . $userId . '.shareKey');
- }
-
- $result = true;
- }
-
- if (!$result) {
- \OC_Log::write('Encryption library', 'Could not delete shareKey; does not exist: "' . $shareKeyPath, \OC_Log::ERROR);
+ if (!$view->unlink($shareKeyPath . '.' . $userId . '.shareKey')) {
+ \OC_Log::write('Encryption library', 'Could not delete shareKey; does not exist: "' . $shareKeyPath . '.' . $userId . '.shareKey"', \OC_Log::ERROR);
+ }
+ }
}
\OC_FileProxy::$enabled = $proxyStatus;
-
- return $result;
-
}
/**
@@ -582,13 +573,14 @@ class Keymanager
}
/** @var $matches array */
foreach ($matches as $ma) {
- unlink($ma);
+ if (!unlink($ma)) {
+ \OC_Log::write('Encryption library', 'Could not delete shareKey; does not exist: "' . $ma . '"', \OC_Log::ERROR);
+ }
}
$subdirs = $directories = glob(preg_quote($dir) . '/*', GLOB_ONLYDIR);
foreach ($subdirs as $subdir) {
self::recursiveDelShareKeys($subdir, $userIds);
}
- return true;
}
/**