From 1d956b1faf2545908753198587d38c23df9d4a37 Mon Sep 17 00:00:00 2001 From: Florin Peter Date: Thu, 13 Jun 2013 20:51:22 +0200 Subject: [PATCH] fix memory problems as reported at #3620 --- apps/files_encryption/lib/crypt.php | 6 +++--- apps/files_encryption/lib/util.php | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/apps/files_encryption/lib/crypt.php b/apps/files_encryption/lib/crypt.php index cd41390d1c5..945b342a316 100755 --- a/apps/files_encryption/lib/crypt.php +++ b/apps/files_encryption/lib/crypt.php @@ -168,7 +168,7 @@ class Crypt { * e.g. filename or /Docs/filename, NOT admin/files/filename * @return boolean */ - public static function isLegacyEncryptedContent($data, $relPath) { + public static function isLegacyEncryptedContent($isCatFileContent, $relPath) { // Fetch all file metadata from DB $metadata = \OC\Files\Filesystem::getFileInfo($relPath, ''); @@ -178,7 +178,7 @@ class Crypt { // legacy encryption system if (isset($metadata['encrypted']) && $metadata['encrypted'] === true - && !self::isCatfileContent($data) + && $isCatFileContent === false ) { return true; @@ -480,7 +480,7 @@ class Crypt { } else { - \OCP\Util::writeLog('Encryption library', 'Decryption (asymmetric) of sealed content failed', \OCP\Util::ERROR); + \OCP\Util::writeLog('Encryption library', 'Decryption (asymmetric) of sealed content with share-key "'.$shareKey.'" failed', \OCP\Util::ERROR); return false; diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php index f274ae1d863..a6fd2e8b377 100644 --- a/apps/files_encryption/lib/util.php +++ b/apps/files_encryption/lib/util.php @@ -424,8 +424,7 @@ class Util { // where they got re-enabled :/ \OC_FileProxy::$enabled = false; - $data = $this->view->file_get_contents($filePath); - + $isEncryptedPath = $this->isEncryptedPath($filePath); // If the file is encrypted // NOTE: If the userId is // empty or not set, file will @@ -435,7 +434,7 @@ class Util { // will eat server resources :( if ( Keymanager::getFileKey($this->view, $this->userId, $relPath) - && Crypt::isCatfileContent($data) + && $isEncryptedPath ) { $found['encrypted'][] = array( @@ -445,7 +444,7 @@ class Util { // If the file uses old // encryption system - } elseif (Crypt::isLegacyEncryptedContent($data, $relPath)) { + } elseif (Crypt::isLegacyEncryptedContent($isEncryptedPath, $relPath)) { $found['legacy'][] = array( 'name' => $file, -- 2.39.5