aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2021-06-24 09:31:52 +0200
committerVincent Petry <vincent@nextcloud.com>2021-06-29 14:39:51 +0200
commit4e9241c706a9faf9c677439931c0d191f38ad4dc (patch)
tree52e4291b03aa110cb0ca9fe8c2eec5434863f214 /apps
parent43a0016aa7f09e55c0b828f9f21c7c6a68526b29 (diff)
downloadnextcloud-server-4e9241c706a9faf9c677439931c0d191f38ad4dc.tar.gz
nextcloud-server-4e9241c706a9faf9c677439931c0d191f38ad4dc.zip
Detect disabled signature check when reparing
When running occ encryption:fix-encrypted-version, detect whether the setting 'encryption_skip_signature_check' is set and abort if it is, because the repair cannot detect version mismatch errors with it enabled. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'apps')
-rw-r--r--apps/encryption/lib/Command/FixEncryptedVersion.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/apps/encryption/lib/Command/FixEncryptedVersion.php b/apps/encryption/lib/Command/FixEncryptedVersion.php
index 534ddc4c689..39239925850 100644
--- a/apps/encryption/lib/Command/FixEncryptedVersion.php
+++ b/apps/encryption/lib/Command/FixEncryptedVersion.php
@@ -25,6 +25,7 @@ namespace OCA\Encryption\Command;
use OC\Files\View;
use OC\HintException;
use OCP\Files\IRootFolder;
+use OCP\IConfig;
use OCP\IUserManager;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
@@ -32,6 +33,9 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class FixEncryptedVersion extends Command {
+ /** @var IConfig */
+ private $config;
+
/** @var IRootFolder */
private $rootFolder;
@@ -41,7 +45,8 @@ class FixEncryptedVersion extends Command {
/** @var View */
private $view;
- public function __construct(IRootFolder $rootFolder, IUserManager $userManager, View $view) {
+ public function __construct(IConfig $config, IRootFolder $rootFolder, IUserManager $userManager, View $view) {
+ $this->config = $config;
$this->rootFolder = $rootFolder;
$this->userManager = $userManager;
$this->view = $view;
@@ -72,6 +77,13 @@ class FixEncryptedVersion extends Command {
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output) {
+ $skipSignatureCheck = $this->config->getSystemValue('encryption_skip_signature_check', false);
+
+ if ($skipSignatureCheck) {
+ $output->writeln("<error>Repairing is not possible when \"encryption_skip_signature_check\" is set. Please disable this flag in the configuration.</error>\n");
+ return 1;
+ }
+
$user = $input->getArgument('user');
$pathToWalk = "/$user/files";