summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption
diff options
context:
space:
mode:
authorBjörn Schießle <bjoern@schiessle.org>2013-06-14 01:38:15 -0700
committerBjörn Schießle <bjoern@schiessle.org>2013-06-14 01:38:15 -0700
commita8a60d761b12d59923e70da06f0b84954c2e3ec7 (patch)
treea9df8fedf0a0198e0884dd7c598de38e797a3e83 /apps/files_encryption
parent6c534c8165d3c3fba64e3cf5c05993a84733eef7 (diff)
parent62f4ed7009de70a62466a004ff7602e7a149fc7f (diff)
downloadnextcloud-server-a8a60d761b12d59923e70da06f0b84954c2e3ec7.tar.gz
nextcloud-server-a8a60d761b12d59923e70da06f0b84954c2e3ec7.zip
Merge pull request #3715 from owncloud/fixes_for_3641_3620
files_encryption: bug fixes for reported problems.
Diffstat (limited to 'apps/files_encryption')
-rwxr-xr-xapps/files_encryption/lib/crypt.php6
-rw-r--r--apps/files_encryption/lib/util.php11
2 files changed, 8 insertions, 9 deletions
diff --git a/apps/files_encryption/lib/crypt.php b/apps/files_encryption/lib/crypt.php
index cd41390d1c5..945b342a316 100755
--- a/apps/files_encryption/lib/crypt.php
+++ b/apps/files_encryption/lib/crypt.php
@@ -168,7 +168,7 @@ class Crypt {
* e.g. filename or /Docs/filename, NOT admin/files/filename
* @return boolean
*/
- public static function isLegacyEncryptedContent($data, $relPath) {
+ public static function isLegacyEncryptedContent($isCatFileContent, $relPath) {
// Fetch all file metadata from DB
$metadata = \OC\Files\Filesystem::getFileInfo($relPath, '');
@@ -178,7 +178,7 @@ class Crypt {
// legacy encryption system
if (isset($metadata['encrypted'])
&& $metadata['encrypted'] === true
- && !self::isCatfileContent($data)
+ && $isCatFileContent === false
) {
return true;
@@ -480,7 +480,7 @@ class Crypt {
} else {
- \OCP\Util::writeLog('Encryption library', 'Decryption (asymmetric) of sealed content failed', \OCP\Util::ERROR);
+ \OCP\Util::writeLog('Encryption library', 'Decryption (asymmetric) of sealed content with share-key "'.$shareKey.'" failed', \OCP\Util::ERROR);
return false;
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php
index 94defa726a9..b4b3923a799 100644
--- a/apps/files_encryption/lib/util.php
+++ b/apps/files_encryption/lib/util.php
@@ -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,
@@ -698,7 +697,7 @@ class Util {
$plainHandle = $this->view->fopen($rawPath, 'rb');
// Open enc file handle for binary writing, with same filename as original plain file
- $encHandle = fopen('crypt://' . $relPath . '.tmp', 'wb');
+ $encHandle = fopen('crypt://' . $relPath . '.part', 'wb');
// Move plain file to a temporary location
$size = stream_copy_to_stream($plainHandle, $encHandle);
@@ -708,7 +707,7 @@ class Util {
$fakeRoot = $this->view->getRoot();
$this->view->chroot('/' . $this->userId . '/files');
- $this->view->rename($relPath . '.tmp', $relPath);
+ $this->view->rename($relPath . '.part', $relPath);
$this->view->chroot($fakeRoot);