aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-09-26 03:15:14 -0700
committerThomas Müller <thomas.mueller@tmit.eu>2013-09-26 03:15:14 -0700
commit2334f9690640ac01ea7403506f13cce8533cea37 (patch)
tree7c67c5bc0eb375ae571cfc49e16183c5b7cbf309
parent70dccd28ef2e2a374c0e5013d2569e4c3fc13852 (diff)
parent0b98427536d9ff951577273af096c0a4ab219a83 (diff)
downloadnextcloud-server-2334f9690640ac01ea7403506f13cce8533cea37.tar.gz
nextcloud-server-2334f9690640ac01ea7403506f13cce8533cea37.zip
Merge pull request #4991 from owncloud/enc_fix_warning
check if key exists before reading it
-rwxr-xr-xapps/files_encryption/lib/keymanager.php5
-rw-r--r--apps/files_encryption/lib/proxy.php7
2 files changed, 7 insertions, 5 deletions
diff --git a/apps/files_encryption/lib/keymanager.php b/apps/files_encryption/lib/keymanager.php
index 9be3dda7ce3..7143fcff0f6 100755
--- a/apps/files_encryption/lib/keymanager.php
+++ b/apps/files_encryption/lib/keymanager.php
@@ -40,11 +40,14 @@ class Keymanager {
public static function getPrivateKey(\OC_FilesystemView $view, $user) {
$path = '/' . $user . '/' . 'files_encryption' . '/' . $user . '.private.key';
+ $key = false;
$proxyStatus = \OC_FileProxy::$enabled;
\OC_FileProxy::$enabled = false;
- $key = $view->file_get_contents($path);
+ if ($view->file_exists($path)) {
+ $key = $view->file_get_contents($path);
+ }
\OC_FileProxy::$enabled = $proxyStatus;
diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php
index eb7ba60cb9d..4ec810a5199 100644
--- a/apps/files_encryption/lib/proxy.php
+++ b/apps/files_encryption/lib/proxy.php
@@ -50,9 +50,8 @@ class Proxy extends \OC_FileProxy {
private static function shouldEncrypt($path) {
if (is_null(self::$enableEncryption)) {
-
if (
- \OCP\Config::getAppValue('files_encryption', 'enable_encryption', 'true') === 'true'
+ \OCP\App::isEnabled('files_encryption') === true
&& Crypt::mode() === 'server'
) {
@@ -200,7 +199,7 @@ class Proxy extends \OC_FileProxy {
*/
public function preUnlink($path) {
- // let the trashbin handle this
+ // let the trashbin handle this
if (\OCP\App::isEnabled('files_trashbin')) {
return true;
}
@@ -291,7 +290,7 @@ class Proxy extends \OC_FileProxy {
// Close the original encrypted file
fclose($result);
- // Open the file using the crypto stream wrapper
+ // Open the file using the crypto stream wrapper
// protocol and let it do the decryption work instead
$result = fopen('crypt://' . $path, $meta['mode']);