summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Peter <github@florin-peter.de>2013-05-20 21:22:03 +0200
committerFlorin Peter <github@florin-peter.de>2013-05-20 21:22:03 +0200
commit8e0540d0e45db9470ff0d17869bab6df41bd389a (patch)
tree67fd454975bccd9fd7d30b80946834cfc08a53aa
parent171b9a4702efb6e413e13e705bb903772950c488 (diff)
downloadnextcloud-server-8e0540d0e45db9470ff0d17869bab6df41bd389a.tar.gz
nextcloud-server-8e0540d0e45db9470ff0d17869bab6df41bd389a.zip
key creation should never override a private or public key
-rw-r--r--apps/files_encryption/lib/util.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php
index 9ba7b3b3a31..8147982d483 100644
--- a/apps/files_encryption/lib/util.php
+++ b/apps/files_encryption/lib/util.php
@@ -212,9 +212,10 @@ class Util
}
// Create user keypair
+ // we should never override a keyfile
if (
!$this->view->file_exists($this->publicKeyPath)
- or !$this->view->file_exists($this->privateKeyPath)
+ && !$this->view->file_exists($this->privateKeyPath)
) {
// Generate keypair
@@ -233,6 +234,15 @@ class Util
\OC_FileProxy::$enabled = true;
+ } else {
+ // check if public-key exists but private-key is missing
+ if($this->view->file_exists($this->publicKeyPath) && !$this->view->file_exists($this->privateKeyPath)) {
+ \OC_Log::write('Encryption library', 'public key exists but private key is missing for "' . $this->userId . '"', \OC_Log::FATAL);
+ return false;
+ } else if(!$this->view->file_exists($this->publicKeyPath) && $this->view->file_exists($this->privateKeyPath)) {
+ \OC_Log::write('Encryption library', 'private key exists but public key is missing for "' . $this->userId . '"', \OC_Log::FATAL);
+ return false;
+ }
}
// If there's no record for this user's encryption preferences