diff options
author | Björn Schießle <bjoern@schiessle.org> | 2013-10-11 01:48:02 -0700 |
---|---|---|
committer | Björn Schießle <bjoern@schiessle.org> | 2013-10-11 01:48:02 -0700 |
commit | 4336d42ab095c304d0a46bb30c2d0203e606597e (patch) | |
tree | 2041ab6d89f4a9e29cb8d3cc815a0607df3a9ce3 /apps | |
parent | 44a5b0bad0e0dbcb0c11de663897ace69b4fd776 (diff) | |
parent | 909af2b62e75d1a5db866466074f2bcb95b864dc (diff) | |
download | nextcloud-server-4336d42ab095c304d0a46bb30c2d0203e606597e.tar.gz nextcloud-server-4336d42ab095c304d0a46bb30c2d0203e606597e.zip |
Merge pull request #5233 from owncloud/enc_filter_users
only encrypt file to users with encryption keys
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_encryption/hooks/hooks.php | 2 | ||||
-rw-r--r-- | apps/files_encryption/lib/proxy.php | 28 | ||||
-rw-r--r-- | apps/files_encryption/lib/stream.php | 3 | ||||
-rw-r--r-- | apps/files_sharing/tests/api.php | 7 |
4 files changed, 7 insertions, 33 deletions
diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php index 2df860a8e57..d9a76becf25 100644 --- a/apps/files_encryption/hooks/hooks.php +++ b/apps/files_encryption/hooks/hooks.php @@ -92,8 +92,6 @@ class Hooks { }
// Encrypt existing user files:
- // This serves to upgrade old versions of the encryption
- // app (see appinfo/spec.txt)
if (
$util->encryptAll('/' . $params['uid'] . '/' . 'files', $session->getLegacyKey(), $params['password'])
) {
diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php index 6f630c83a3f..8621c1ba51d 100644 --- a/apps/files_encryption/lib/proxy.php +++ b/apps/files_encryption/lib/proxy.php @@ -38,8 +38,6 @@ class Proxy extends \OC_FileProxy { private static $blackList = null; //mimetypes blacklisted from encryption - private static $enableEncryption = null; - /** * Check if a file requires encryption * @param string $path @@ -49,46 +47,22 @@ class Proxy extends \OC_FileProxy { */ private static function shouldEncrypt($path) { - if (is_null(self::$enableEncryption)) { - if ( - \OCP\App::isEnabled('files_encryption') === true - && Crypt::mode() === 'server' - ) { - - self::$enableEncryption = true; - - } else { - - self::$enableEncryption = false; - - } - - } - - if (!self::$enableEncryption) { - + if (\OCP\App::isEnabled('files_encryption') === false || Crypt::mode() !== 'server') { return false; - } if (is_null(self::$blackList)) { - self::$blackList = explode(',', \OCP\Config::getAppValue('files_encryption', 'type_blacklist', '')); - } if (Crypt::isCatfileContent($path)) { - return true; - } $extension = substr($path, strrpos($path, '.') + 1); if (array_search($extension, self::$blackList) === false) { - return true; - } return false; diff --git a/apps/files_encryption/lib/stream.php b/apps/files_encryption/lib/stream.php index 02955bb064e..b25ba7bb677 100644 --- a/apps/files_encryption/lib/stream.php +++ b/apps/files_encryption/lib/stream.php @@ -506,9 +506,10 @@ class Stream { // Get all users sharing the file includes current user $uniqueUserIds = $util->getSharingUsersArray($sharingEnabled, $this->relPath, $this->userId); + $checkedUserIds = $util->filterShareReadyUsers($uniqueUserIds); // Fetch public keys for all sharing users - $publicKeys = Keymanager::getPublicKeys($this->rootView, $uniqueUserIds); + $publicKeys = Keymanager::getPublicKeys($this->rootView, $checkedUserIds['ready']); // Encrypt enc key for all sharing users $this->encKeyfiles = Crypt::multiKeyEncrypt($this->plainKey, $publicKeys); diff --git a/apps/files_sharing/tests/api.php b/apps/files_sharing/tests/api.php index 63df0dd7dc3..9452dd37707 100644 --- a/apps/files_sharing/tests/api.php +++ b/apps/files_sharing/tests/api.php @@ -58,6 +58,10 @@ class Test_Files_Sharing_Api extends \PHPUnit_Framework_TestCase { } function setUp() { + + //login as user1 + \Test_Files_Sharing_Api::loginHelper(\Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER1); + $this->data = 'foobar'; $this->view = new \OC_FilesystemView('/' . \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER1 . '/files'); @@ -104,9 +108,6 @@ class Test_Files_Sharing_Api extends \PHPUnit_Framework_TestCase { */ function testCreateShare() { - //login as user1 - \Test_Files_Sharing_Api::loginHelper(\Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER1); - // share to user // simulate a post request |