Deleting encrypted files with missing keyfiles/shareKeys now succeeds

remotes/origin/stable6
Sam Tuke 13 years ago
parent 14eae441eb
commit 69bc42f920
  1. 9
      apps/files_encryption/hooks/hooks.php
  2. 2
      apps/files_encryption/lib/crypt.php
  3. 27
      apps/files_encryption/lib/proxy.php
  4. 3
      apps/files_encryption/lib/util.php

@ -279,13 +279,8 @@ class Hooks {
*/
public static function postUnshareAll( $params ) {
// $view = new \OC_FilesystemView( '/' );
// $session = new Session();
// $userId = \OCP\User::getUser();
// $util = new Util( $view, $userId );
// $path = $util->fileIdToPath( $params['itemSource'] );
//
// return Crypt::updateKeyfile( $view, $util, $session, $userId, $path );
// NOTE: It appears that this is never called for files, so
// we may not need to implement it
}

@ -390,8 +390,6 @@ class Crypt {
$shareKeys = array();
if( openssl_seal( $plainContent, $sealed, $shareKeys, $publicKeys ) ) {
// trigger_error("SEALED = $sealed");
$i = 0;

@ -272,23 +272,38 @@ class Proxy extends \OC_FileProxy {
$split = explode( '/', $trimmed );
$sliced = array_slice( $split, 2 );
$relPath = implode( '/', $sliced );
$filePath = $userId . '/' . 'files_encryption' . '/' . 'keyfiles' . '/'. $relPath;
if ( $view->is_dir( $path ) ) {
// Dirs must be handled separately as deleteFileKey
// doesn't handle them
$view->unlink( $userId . '/' . 'files_encryption' . '/' . 'keyfiles' . '/'. $relPath );
$view->unlink( $filePath );
} else {
// Delete keyfile so it isn't orphaned
$result = Keymanager::deleteFileKey( $view, $userId, $relPath );
\OC_FileProxy::$enabled = true;
// Delete keyfile & shareKey so it isn't orphaned
if (
! (
Keymanager::deleteFileKey( $view, $userId, $relPath )
&& Keymanager::delShareKey( $view, $userId, $relPath )
)
) {
\OC_Log::write( 'Encryption library', 'Keyfile or shareKey could not be deleted for file "'.$filePath.'"', \OC_Log::ERROR );
}
return $result;
}
\OC_FileProxy::$enabled = true;
// If we don't return true then file delete will fail; better
// to leave orphaned keyfiles than to disallow file deletion
return true;
}

@ -24,15 +24,12 @@
# Bugs
# ----
# Sharing a file to a user without encryption set up will not provide them with access but won't notify the sharer
# Deleting files if keyfile is missing fails
# When encryption app is disabled files become unreadable
# Timeouts on first login due to encryption of very large files
# MultiKeyEncrypt() may be failing
# Missing features
# ----------------
# Unshare a file
# Re-use existing keyfiles so they don't need version control
# Make sure user knows if large files weren't encrypted
# Trashbin support

Loading…
Cancel
Save