]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fixed bug causing encrypted files to be doubly encrypted at login
authorSam Tuke <samtuke@owncloud.com>
Wed, 6 Feb 2013 14:30:40 +0000 (14:30 +0000)
committerSam Tuke <samtuke@owncloud.com>
Wed, 6 Feb 2013 14:30:40 +0000 (14:30 +0000)
Added comments and docblocks

apps/files_encryption/hooks/hooks.php
apps/files_encryption/lib/crypt.php
apps/files_encryption/lib/util.php

index 065ef9d24107a30c3a0fe0a9acada0046ff308d1..2d7bd73487ed6cf14e458efc0d05fdf436aeeb25 100644 (file)
@@ -38,12 +38,15 @@ class Hooks {
         */\r
        public static function login( $params ) {\r
        \r
+               // Manually initialise Filesystem{} singleton with correct \r
+               // fake root path, in order to avoid fatal webdav errors\r
                \OC\Files\Filesystem::init( $params['uid'] . '/' . 'files' . '/' );\r
        \r
                $view = new \OC_FilesystemView( '/' );\r
 \r
                $util = new Util( $view, $params['uid'] );\r
                \r
+               // Check files_encryption infrastructure is ready for action\r
                if ( ! $util->ready() ) {\r
                        \r
                        \OC_Log::write( 'Encryption library', 'User account "' . $params['uid'] . '" is not ready for encryption; configuration started', \OC_Log::DEBUG );\r
index e3ffacabc9a829176cbcf746889e61414e9cd90e..136c776045c30809eae544afdb7ab6c432830afc 100755 (executable)
@@ -133,12 +133,6 @@ class Crypt {
          * @note see also OCA\Encryption\Util->isEncryptedPath()\r
          */\r
        public static function isCatfile( $content ) {\r
-       \r
-               if ( !$content ) {\r
-               \r
-                       return false;\r
-                       \r
-               }\r
                \r
                $noPadding = self::removePadding( $content );\r
                \r
index 355ffb90ef0ea4a81ab5ac95b1fd13f59e67a0c8..52bc74db27a61ee0c26af4e2b2cffdca8b2df419 100644 (file)
@@ -69,11 +69,6 @@ class Util {
        //// DONE: add method to fetch legacy key
        //// DONE: add method to decrypt legacy encrypted data
        
-       //// TODO: add method to encrypt all user files using new system
-       //// TODO: add method to decrypt all user files using new system
-       //// TODO: add method to encrypt all user files using old system
-       //// TODO: add method to decrypt all user files using old system
-       
        
        // Admin UI:
        
@@ -93,7 +88,6 @@ class Util {
        
        // Integration testing:
        
-       //// TODO: test new encryption with webdav
        //// TODO: test new encryption with versioning
        //// TODO: test new encryption with sharing
        //// TODO: test new encryption with proxies
@@ -278,7 +272,7 @@ class Util {
                                                // will eat server resources :(
                                                if ( 
                                                        Keymanager::getFileKey( $this->view, $this->userId, $file ) 
-                                                       && Crypt::isCatfile( $filePath )
+                                                       && Crypt::isCatfile( $data )
                                                ) {
                                                
                                                        $found['encrypted'][] = array( 'name' => $file, 'path' => $filePath );
@@ -391,7 +385,6 @@ class Util {
                        
                        }
                        
-                       // FIXME: Legacy recrypting here isn't finished yet
                        // Encrypt legacy encrypted files
                        if ( 
                                ! empty( $legacyPassphrase ) 
@@ -437,6 +430,11 @@ class Util {
                
        }
        
+       /**
+        * @brief Return important encryption related paths
+        * @param string $pathName Name of the directory to return the path of
+        * @return string path
+        */
        public function getPath( $pathName ) {
        
                switch ( $pathName ) {