summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-04-16 17:37:31 +0200
committerJoas Schilling <nickvergessen@owncloud.com>2015-04-27 11:03:50 +0200
commita09df6d4538d1fb62992fb8a84219bf9a42c6257 (patch)
tree05c5909b6e724188d552dede46360a0e13cbe363
parente58029f8ad9ed4ddb1a68ea91e76e6a8d749fe27 (diff)
downloadnextcloud-server-a09df6d4538d1fb62992fb8a84219bf9a42c6257.tar.gz
nextcloud-server-a09df6d4538d1fb62992fb8a84219bf9a42c6257.zip
Verify that the encryption module exists before setting it
-rw-r--r--lib/private/encryption/manager.php13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/private/encryption/manager.php b/lib/private/encryption/manager.php
index 8e080507c81..c10867c3da8 100644
--- a/lib/private/encryption/manager.php
+++ b/lib/private/encryption/manager.php
@@ -101,17 +101,17 @@ class Manager implements IManager {
throw new Exceptions\ModuleAlreadyExistsException($id, $displayName);
}
- $defaultEncryptionModuleId = $this->getDefaultEncryptionModuleId();
-
- if (empty($defaultEncryptionModuleId)) {
- $this->setDefaultEncryptionModule($id);
- }
-
$this->encryptionModules[$id] = [
'id' => $id,
'displayName' => $displayName,
'callback' => $callback,
];
+
+ $defaultEncryptionModuleId = $this->getDefaultEncryptionModuleId();
+
+ if (empty($defaultEncryptionModuleId)) {
+ $this->setDefaultEncryptionModule($id);
+ }
}
/**
@@ -182,6 +182,7 @@ class Manager implements IManager {
*/
public function setDefaultEncryptionModule($moduleId) {
try {
+ $this->getEncryptionModule($moduleId);
$this->config->setAppValue('core', 'default_encryption_module', $moduleId);
return true;
} catch (\Exception $e) {