summaryrefslogtreecommitdiffstats
path: root/apps/encryption/lib
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2021-06-29 20:44:07 +0200
committerVincent Petry <vincent@nextcloud.com>2021-06-29 20:44:07 +0200
commitd3eeecba54fc891da20093c88648e5f10ed0e706 (patch)
tree3e8a369aaebe8ed3524272660c32ed415773aaa6 /apps/encryption/lib
parent101c65a94981b1ac6b01166c5e5e3c0bbf6128a7 (diff)
downloadnextcloud-server-d3eeecba54fc891da20093c88648e5f10ed0e706.tar.gz
nextcloud-server-d3eeecba54fc891da20093c88648e5f10ed0e706.zip
Prevent running FixEncryptedVersion without master key
Return an error when running occ encryption:fix-encrypted-version when master key encryption is not enabled. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'apps/encryption/lib')
-rw-r--r--apps/encryption/lib/Command/FixEncryptedVersion.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/apps/encryption/lib/Command/FixEncryptedVersion.php b/apps/encryption/lib/Command/FixEncryptedVersion.php
index e2181f9a229..a85a96258fc 100644
--- a/apps/encryption/lib/Command/FixEncryptedVersion.php
+++ b/apps/encryption/lib/Command/FixEncryptedVersion.php
@@ -24,6 +24,7 @@ namespace OCA\Encryption\Command;
use OC\Files\View;
use OC\HintException;
+use OCA\Encryption\Util;
use OCP\Files\IRootFolder;
use OCP\IConfig;
use OCP\ILogger;
@@ -46,14 +47,25 @@ class FixEncryptedVersion extends Command {
/** @var IUserManager */
private $userManager;
+ /** @var Util */
+ private $util;
+
/** @var View */
private $view;
- public function __construct(IConfig $config, ILogger $logger, IRootFolder $rootFolder, IUserManager $userManager, View $view) {
+ public function __construct(
+ IConfig $config,
+ ILogger $logger,
+ IRootFolder $rootFolder,
+ IUserManager $userManager,
+ Util $util,
+ View $view
+ ) {
$this->config = $config;
$this->logger = $logger;
$this->rootFolder = $rootFolder;
$this->userManager = $userManager;
+ $this->util = $util;
$this->view = $view;
parent::__construct();
}
@@ -89,6 +101,11 @@ class FixEncryptedVersion extends Command {
return 1;
}
+ if (!$this->util->isMasterKeyEnabled()) {
+ $output->writeln("<error>Repairing only works with master key encryption.</error>\n");
+ return 1;
+ }
+
$user = (string)$input->getArgument('user');
$pathToWalk = "/$user/files";