From dbdd754c3fc37dc3100a9741f956d913e6d64576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Mon, 30 Mar 2015 22:36:48 +0200 Subject: [PATCH] Further cleanup of files_encryption --- apps/encryption/lib/crypto/crypt.php | 10 +--------- build/license.php | 2 +- lib/base.php | 3 --- lib/private/app.php | 2 +- lib/private/connector/sabre/file.php | 4 +++- lib/private/encryption/keys/storage.php | 6 +++--- tests/enable_all.php | 1 - 7 files changed, 9 insertions(+), 19 deletions(-) diff --git a/apps/encryption/lib/crypto/crypt.php b/apps/encryption/lib/crypto/crypt.php index c9f02bfa1c..ea7f9e1cdf 100644 --- a/apps/encryption/lib/crypto/crypt.php +++ b/apps/encryption/lib/crypto/crypt.php @@ -25,9 +25,6 @@ namespace OCA\Encryption\Crypto; use OC\Encryption\Exceptions\DecryptionFailedException; use OC\Encryption\Exceptions\EncryptionFailedException; use OC\Encryption\Exceptions\GenericEncryptionException; -use OCA\Encryption\KeyManager; -use OCA\Files_Encryption\Exception\MultiKeyDecryptException; -use OCA\Files_Encryption\Exception\MultiKeyEncryptException; use OCP\IConfig; use OCP\ILogger; use OCP\IUser; @@ -35,11 +32,6 @@ use OCP\IUserSession; class Crypt { - const ENCRYPTION_UKNOWN_ERROR = -1; - const ENCRYPTION_NOT_INIALIZED_ERROR = 1; - const ENCRYPTIION_PRIVATE_KEY_NOT_VALID_ERROR = 2; - const ENCRYPTION_NO_SHARE_KEY_FOUND = 3; - const BLOCKSIZE = 8192; const DEFAULT_CIPHER = 'AES-256-CFB'; @@ -97,7 +89,7 @@ class Crypt { 'privateKey' => $privateKey ]; } - $log->error('Encryption library couldn\'t export users private key, please check your servers openSSL configuration.' . $user->getUID(), + $log->error('Encryption library couldn\'t export users private key, please check your servers openSSL configuration.' . $this->user->getUID(), ['app' => 'encryption']); if (openssl_error_string()) { $log->error('Encryption Library:' . openssl_error_string(), diff --git a/build/license.php b/build/license.php index a8d82b084e..6e3806e146 100644 --- a/build/license.php +++ b/build/license.php @@ -166,7 +166,7 @@ if (isset($argv[1])) { } else { $licenses->exec([ '../apps/files', - '../apps/files_encryption', + '../apps/encryption', '../apps/files_external', '../apps/files_sharing', '../apps/files_trashbin', diff --git a/lib/base.php b/lib/base.php index 5d1e16296c..44395be627 100644 --- a/lib/base.php +++ b/lib/base.php @@ -743,9 +743,6 @@ class OC { ); \OCP\Util::connectHook('OCP\Share', 'post_shared', $updater, 'postShared'); \OCP\Util::connectHook('OCP\Share', 'post_unshare', $updater, 'postUnshared'); - - //\OCP\Util::connectHook('OC_Filesystem', 'post_umount', 'OCA\Files_Encryption\Hooks', 'postUnmount'); - //\OCP\Util::connectHook('OC_Filesystem', 'umount', 'OCA\Files_Encryption\Hooks', 'preUnmount'); } } diff --git a/lib/private/app.php b/lib/private/app.php index 84bc23608f..4b3d4b82b8 100644 --- a/lib/private/app.php +++ b/lib/private/app.php @@ -207,7 +207,7 @@ class OC_App { self::$shippedApps = json_decode(file_get_contents($shippedJson), true); self::$shippedApps = self::$shippedApps['shippedApps']; } else { - self::$shippedApps = ['files', 'files_encryption', 'files_external', + self::$shippedApps = ['files', 'encryption', 'files_external', 'files_sharing', 'files_trashbin', 'files_versions', 'provisioning_api', 'user_ldap', 'user_webdavauth']; } diff --git a/lib/private/connector/sabre/file.php b/lib/private/connector/sabre/file.php index 5b8cb17a81..58579f42df 100644 --- a/lib/private/connector/sabre/file.php +++ b/lib/private/connector/sabre/file.php @@ -35,6 +35,8 @@ namespace OC\Connector\Sabre; +use OC\Encryption\Exceptions\GenericEncryptionException; + class File extends \OC\Connector\Sabre\Node implements \Sabre\DAV\IFile { /** @@ -125,7 +127,7 @@ class File extends \OC\Connector\Sabre\Node implements \Sabre\DAV\IFile { } catch (\OCP\Files\LockNotAcquiredException $e) { // the file is currently being written to by another process throw new \OC\Connector\Sabre\Exception\FileLocked($e->getMessage(), $e->getCode(), $e); - } catch (\OCA\Files_Encryption\Exception\EncryptionException $e) { + } catch (GenericEncryptionException $e) { throw new \Sabre\DAV\Exception\Forbidden($e->getMessage()); } catch (\OCP\Files\StorageNotAvailableException $e) { throw new \Sabre\DAV\Exception\ServiceUnavailable("Failed to write file contents: ".$e->getMessage()); diff --git a/lib/private/encryption/keys/storage.php b/lib/private/encryption/keys/storage.php index 041db2a2cb..82753df1dc 100644 --- a/lib/private/encryption/keys/storage.php +++ b/lib/private/encryption/keys/storage.php @@ -23,9 +23,9 @@ namespace OC\Encryption\Keys; +use OC\Encryption\Exceptions\GenericEncryptionException; use OC\Encryption\Util; use OC\Files\View; -use OCA\Files_Encryption\Exception\EncryptionException; class Storage implements \OCP\Encryption\Keys\IStorage { @@ -253,13 +253,13 @@ class Storage implements \OCP\Encryption\Keys\IStorage { * * @param string $path path to the file, relative to data/ * @return string - * @throws EncryptionException + * @throws GenericEncryptionException * @internal param string $keyId */ private function getFileKeyDir($path) { if ($this->view->is_dir($path)) { - throw new EncryptionException('file was expected but directory was given', EncryptionException::GENERIC); + throw new GenericEncryptionException('file was expected but directory was given'); } list($owner, $filename) = $this->util->getUidAndFilename($path); diff --git a/tests/enable_all.php b/tests/enable_all.php index 61c94e6eff..464155b1f3 100644 --- a/tests/enable_all.php +++ b/tests/enable_all.php @@ -18,7 +18,6 @@ function enableApp($app) { enableApp('files_sharing'); enableApp('files_trashbin'); -enableApp('files_encryption'); enableApp('encryption'); enableApp('user_ldap'); enableApp('files_versions');