[Pkg-owncloud-commits] [owncloud] 32/50: first check if a private key exists, if not it is always a recovery szenario
David Prévot
taffit at moszumanska.debian.org
Fri Oct 17 03:12:14 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag v6.0.6RC1
in repository owncloud.
commit 5de19f38c4120dbf63ffd135721443633ed7dfa1
Author: Bjoern Schiessle <schiessle at owncloud.com>
Date: Mon Sep 22 15:04:55 2014 +0200
first check if a private key exists, if not it is always a recovery szenario
---
apps/files_encryption/hooks/hooks.php | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php
index 894ad31..f843d8a 100644
--- a/apps/files_encryption/hooks/hooks.php
+++ b/apps/files_encryption/hooks/hooks.php
@@ -195,19 +195,22 @@ class Hooks {
if (Crypt::mode() === 'server') {
$view = new \OC_FilesystemView('/');
+ $session = new \OCA\Encryption\Session($view);
- if ($params['uid'] === \OCP\User::getUser()) {
+ // Get existing decrypted private key
+ $privateKey = $session->getPrivateKey();
- $session = new \OCA\Encryption\Session($view);
-
- // Get existing decrypted private key
- $privateKey = $session->getPrivateKey();
+ if ($params['uid'] === \OCP\User::getUser() && $privateKey) {
// Encrypt private key with new user pwd as passphrase
$encryptedPrivateKey = Crypt::symmetricEncryptFileContent($privateKey, $params['password']);
// Save private key
- Keymanager::setPrivateKey($encryptedPrivateKey);
+ if ($encryptedPrivateKey) {
+ Keymanager::setPrivateKey($encryptedPrivateKey);
+ } else {
+ \OCP\Util::writeLog('files_encryption', 'Could not update users encryption password', \OCP\Util::ERROR);
+ }
// NOTE: Session does not need to be updated as the
// private key has not changed, only the passphrase
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list