]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix memory problems as reported at #3620
authorFlorin Peter <github@florin-peter.de>
Thu, 13 Jun 2013 18:51:22 +0000 (20:51 +0200)
committerBjörn Schießle <schiessle@owncloud.com>
Fri, 14 Jun 2013 08:40:33 +0000 (10:40 +0200)
apps/files_encryption/lib/crypt.php
apps/files_encryption/lib/util.php

index cd41390d1c56f21cefc9eda88c13ca91ed3dafb1..945b342a3163b36a7194b60938150e2f7aebfad4 100755 (executable)
@@ -168,7 +168,7 @@ class Crypt {
         *        e.g. filename or /Docs/filename, NOT admin/files/filename\r
         * @return boolean\r
         */\r
-       public static function isLegacyEncryptedContent($data, $relPath) {\r
+       public static function isLegacyEncryptedContent($isCatFileContent, $relPath) {\r
 \r
                // Fetch all file metadata from DB\r
                $metadata = \OC\Files\Filesystem::getFileInfo($relPath, '');\r
@@ -178,7 +178,7 @@ class Crypt {
                // legacy encryption system\r
                if (isset($metadata['encrypted'])\r
                        && $metadata['encrypted'] === true\r
-                       && !self::isCatfileContent($data)\r
+                       && $isCatFileContent === false\r
                ) {\r
 \r
                        return true;\r
@@ -480,7 +480,7 @@ class Crypt {
 \r
                } else {\r
 \r
-                       \OCP\Util::writeLog('Encryption library', 'Decryption (asymmetric) of sealed content failed', \OCP\Util::ERROR);\r
+                       \OCP\Util::writeLog('Encryption library', 'Decryption (asymmetric) of sealed content with share-key "'.$shareKey.'" failed', \OCP\Util::ERROR);\r
 \r
                        return false;\r
 \r
index f274ae1d863f0ee36b39e482508cc3f8ff2a092b..a6fd2e8b377e1293fcdfa368307b5b892fe7b44b 100644 (file)
@@ -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,