diff options
author | Florin Peter <github@florin-peter.de> | 2013-05-13 21:24:59 +0200 |
---|---|---|
committer | Florin Peter <github@florin-peter.de> | 2013-05-13 21:24:59 +0200 |
commit | 61ed347d26872bc62465be4df595da3391ea84bb (patch) | |
tree | ba1323c1451ba76d1ba23bba4de05c1208627ebd /apps/files_encryption/lib/session.php | |
parent | d92f6b887d99a24b2bda1503f328c698c682d60e (diff) | |
download | nextcloud-server-61ed347d26872bc62465be4df595da3391ea84bb.tar.gz nextcloud-server-61ed347d26872bc62465be4df595da3391ea84bb.zip |
added handling for public file access via files_sharing link
Diffstat (limited to 'apps/files_encryption/lib/session.php')
-rw-r--r-- | apps/files_encryption/lib/session.php | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/apps/files_encryption/lib/session.php b/apps/files_encryption/lib/session.php index 5444d0215ca..f02315f95df 100644 --- a/apps/files_encryption/lib/session.php +++ b/apps/files_encryption/lib/session.php @@ -59,9 +59,11 @@ class Session { ) { $keypair = Crypt::createKeypair(); - - \OC_FileProxy::$enabled = false; - + + // Disable encryption proxy to prevent recursive calls + $proxyStatus = \OC_FileProxy::$enabled; + \OC_FileProxy::$enabled = false; + // Save public key if (!$view->is_dir('/public-keys')) { @@ -76,9 +78,21 @@ class Session { // Save private key $this->view->file_put_contents( '/owncloud_private_key/'.$publicShareKeyId.'.private.key', $encryptedPrivateKey ); - \OC_FileProxy::$enabled = true; + \OC_FileProxy::$enabled = $proxyStatus; } + + if(\OCP\USER::getUser() === false) { + // Disable encryption proxy to prevent recursive calls + $proxyStatus = \OC_FileProxy::$enabled; + \OC_FileProxy::$enabled = false; + + $encryptedKey = $this->view->file_get_contents( '/owncloud_private_key/'.$publicShareKeyId.'.private.key' ); + $privateKey = Crypt::symmetricDecryptFileContent( $encryptedKey, '' ); + $this->setPrivateKey($privateKey); + + \OC_FileProxy::$enabled = $proxyStatus; + } } /** |