[Pkg-owncloud-commits] [owncloud] 04/215: move creation of shared key to the login handler - fixes #15705

David Prévot taffit at moszumanska.debian.org
Tue May 5 01:01:11 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8
in repository owncloud.

commit c6e243928c1dca7995202178aaddc919fe4d40ed
Author: Thomas Müller <thomas.mueller at tmit.eu>
Date:   Fri Apr 17 17:51:18 2015 +0200

    move creation of shared key to the login handler - fixes #15705
---
 apps/encryption/lib/keymanager.php  | 8 +++++---
 apps/encryption/lib/users/setup.php | 1 +
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/apps/encryption/lib/keymanager.php b/apps/encryption/lib/keymanager.php
index b451b5c..0c6edd4 100644
--- a/apps/encryption/lib/keymanager.php
+++ b/apps/encryption/lib/keymanager.php
@@ -130,6 +130,11 @@ class KeyManager {
 			$this->config->setAppValue('encryption', 'publicShareKeyId', $this->publicShareKeyId);
 		}
 
+		$this->keyId = $userSession && $userSession->isLoggedIn() ? $userSession->getUser()->getUID() : false;
+		$this->log = $log;
+	}
+
+	public function validateShareKey() {
 		$shareKey = $this->getPublicShareKey();
 		if (empty($shareKey)) {
 			$keyPair = $this->crypt->createKeyPair();
@@ -143,9 +148,6 @@ class KeyManager {
 			$header = $this->crypt->generateHeader();
 			$this->setSystemPrivateKey($this->publicShareKeyId, $header . $encryptedKey);
 		}
-
-		$this->keyId = $userSession && $userSession->isLoggedIn() ? $userSession->getUser()->getUID() : false;
-		$this->log = $log;
 	}
 
 	/**
diff --git a/apps/encryption/lib/users/setup.php b/apps/encryption/lib/users/setup.php
index 2ec49b5..fd8261c 100644
--- a/apps/encryption/lib/users/setup.php
+++ b/apps/encryption/lib/users/setup.php
@@ -79,6 +79,7 @@ class Setup {
 	 * @return bool
 	 */
 	public function setupServerSide($uid, $password) {
+		$this->keyManager->validateShareKey();
 		// Check if user already has keys
 		if (!$this->keyManager->userHasKeys($uid)) {
 			return $this->keyManager->storeKeyPair($uid, $password,

-- 
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