diff options
author | Bjoern Schiessle <bjoern@schiessle.org> | 2017-07-06 11:06:48 +0200 |
---|---|---|
committer | Bjoern Schiessle <bjoern@schiessle.org> | 2017-07-20 11:40:14 +0200 |
commit | 20a6b22db6d5751ebb11ad30cfd29498ef04a9fa (patch) | |
tree | 43b4a1abb1ecfadd4ef6ec085ce7a9de1611e182 /apps | |
parent | 5e468c0bbaf6b9838a1b92bcb04836dccff7b532 (diff) | |
download | nextcloud-server-20a6b22db6d5751ebb11ad30cfd29498ef04a9fa.tar.gz nextcloud-server-20a6b22db6d5751ebb11ad30cfd29498ef04a9fa.zip |
Add recovery key on public upload
In order to decide if a recovery key needs to be added we always
need to check the files owner settings and not the settings of
the currently logged in user.
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/encryption/lib/Crypto/Encryption.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/apps/encryption/lib/Crypto/Encryption.php b/apps/encryption/lib/Crypto/Encryption.php index 6869177ac31..d62235a4528 100644 --- a/apps/encryption/lib/Crypto/Encryption.php +++ b/apps/encryption/lib/Crypto/Encryption.php @@ -60,6 +60,9 @@ class Encryption implements IEncryptionModule { /** @var string */ private $user; + /** @var string */ + private $owner; + /** @var string */ private $fileKey; @@ -174,6 +177,7 @@ class Encryption implements IEncryptionModule { $this->path = $this->getPathToRealFile($path); $this->accessList = $accessList; $this->user = $user; + $this->owner = $this->util->getOwner($path); $this->isWriteOperation = false; $this->writeCache = ''; @@ -280,13 +284,15 @@ class Encryption implements IEncryptionModule { } } - $publicKeys = $this->keyManager->addSystemKeys($this->accessList, $publicKeys, $this->user); + $publicKeys = $this->keyManager->addSystemKeys($this->accessList, $publicKeys, $this->owner); $encryptedKeyfiles = $this->crypt->multiKeyEncrypt($this->fileKey, $publicKeys); $this->keyManager->setAllFileKeys($this->path, $encryptedKeyfiles); } return $result; } + + /** * encrypt data * @@ -407,7 +413,7 @@ class Encryption implements IEncryptionModule { } } - $publicKeys = $this->keyManager->addSystemKeys($accessList, $publicKeys, $uid); + $publicKeys = $this->keyManager->addSystemKeys($accessList, $publicKeys, $this->owner); $encryptedFileKey = $this->crypt->multiKeyEncrypt($fileKey, $publicKeys); |