Fixed bug causing encrypted files to be doubly encrypted at login
Added comments and docblocks
This commit is contained in:
parent
20b1d12cbf
commit
16a5ace434
|
@ -38,12 +38,15 @@ class Hooks {
|
|||
*/
|
||||
public static function login( $params ) {
|
||||
|
||||
// Manually initialise Filesystem{} singleton with correct
|
||||
// fake root path, in order to avoid fatal webdav errors
|
||||
\OC\Files\Filesystem::init( $params['uid'] . '/' . 'files' . '/' );
|
||||
|
||||
$view = new \OC_FilesystemView( '/' );
|
||||
|
||||
$util = new Util( $view, $params['uid'] );
|
||||
|
||||
// Check files_encryption infrastructure is ready for action
|
||||
if ( ! $util->ready() ) {
|
||||
|
||||
\OC_Log::write( 'Encryption library', 'User account "' . $params['uid'] . '" is not ready for encryption; configuration started', \OC_Log::DEBUG );
|
||||
|
|
|
@ -134,12 +134,6 @@ class Crypt {
|
|||
*/
|
||||
public static function isCatfile( $content ) {
|
||||
|
||||
if ( !$content ) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
$noPadding = self::removePadding( $content );
|
||||
|
||||
// Fetch encryption metadata from end of 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 ) {
|
||||
|
|
Loading…
Reference in New Issue