]> source.dussan.org Git - nextcloud-server.git/commitdiff
Added debugging output relating to recrypting legacy files
authorSam Tuke <samtuke@owncloud.com>
Fri, 1 Feb 2013 19:31:15 +0000 (19:31 +0000)
committerSam Tuke <samtuke@owncloud.com>
Fri, 1 Feb 2013 19:31:15 +0000 (19:31 +0000)
apps/files_encryption/lib/crypt.php
apps/files_encryption/lib/util.php

index 6fbbd412b898a26c5c7875c397bcdd682cbd947c..231bfd9826b3a415f042cd19c37ede7fc4cc0445 100755 (executable)
@@ -186,8 +186,14 @@ class Crypt {
          */\r
        public static function isLegacyEncryptedContent( $data, $path ) {\r
        \r
+               $trimmed = ltrim( $path, '/' );\r
+               \r
+//             trigger_error( "DATA = ".var_export($data, 1). "   CATFILE?: ".var_export( self::isCatfile( $data ), 1));\r
+       \r
                // Fetch all file metadata from DB\r
-               $metadata = \OC\Files\Filesystem::getFileInfo( $path, '' );\r
+               $metadata = \OC\Files\Filesystem::getFileInfo( $trimmed, '' );\r
+               \r
+               trigger_error("PATH = ". var_export($trimmed, 1)."   METADATA = ".var_export($metadata['encrypted'], 1));\r
                \r
                // If a file is flagged with encryption in DB, but isn't a \r
                // valid content + IV combination, it's probably using the \r
index b1c128cf8c4dd17fabfef97ce2706865e2ad6aed..7e396a9145b8375785ad940565570c3b5bf48ebf 100644 (file)
@@ -268,10 +268,15 @@ class Util {
                                                
                                                $data = $this->view->file_get_contents( $filePath );
                                                
+//                                             trigger_error("HAKE \n".var_export($this->view->file_get_contents( $filePath ), 1)." \nfilepath = ".var_export($filePath, 1 ));
+                                               
                                                // If the file is encrypted
                                                // NOTE: If the userId is 
                                                // empty or not set, file will 
                                                // detected as plain
+                                               // NOTE: This is inefficient;
+                                               // scanning every file like this
+                                               // will eat server resources :(
                                                if ( 
                                                        Keymanager::getFileKey( $this->view, $this->userId, $file ) 
                                                        && Crypt::isCatfile( $filePath )
@@ -346,6 +351,8 @@ class Util {
        
                if ( $found = $this->findFiles( $dirPath ) ) {
                
+//             trigger_error("FOUND = ".print_r($found, 1));
+               
                        // Disable proxy to prevent file being encrypted twice
                        \OC_FileProxy::$enabled = false;
                
@@ -384,13 +391,13 @@ class Util {
                                && ! empty( $newPassphrase ) 
                        ) {
                        
-                               trigger_error("LEGACY FOUND");
-                       
                                foreach ( $found['legacy'] as $legacyFilePath ) {
                                
                                        // Fetch data from file
                                        $legacyData = $this->view->file_get_contents( $legacyFilePath );
                                
+                                       trigger_error("\n\nlegdata = ".var_export($legacyData).' \n\npassphrase = '.var_export($legacyPassphrase).' \n\npublickey = '.var_export($publicKey).' \n\nnewpass = '.var_export($newPassphrase));
+                               
                                        // Recrypt data, generate catfile
                                        $recrypted = Crypt::legacyKeyRecryptKeyfile( $legacyData, $legacyPassphrase, $publicKey, $newPassphrase );