summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon L <szaimen@e.mail.de>2022-12-06 10:34:09 +0100
committerGitHub <noreply@github.com>2022-12-06 10:34:09 +0100
commit28358acdafa318d6b8482c5260525a31c279992d (patch)
tree10194936183f210328cd6f29ce1ba12d9dac853c
parentdecf2b4524db76597c1375ddbd9a4d5d8f2e445b (diff)
parent5e31ed4f526e943e695d994a6434ed71d1a45c1c (diff)
downloadnextcloud-server-28358acdafa318d6b8482c5260525a31c279992d.tar.gz
nextcloud-server-28358acdafa318d6b8482c5260525a31c279992d.zip
Merge pull request #35600 from nextcloud/fix/empty-secret-migration-files-external
Fix migration to non-empty secret
-rw-r--r--apps/files_external/lib/Lib/Auth/PublicKey/RSA.php6
-rw-r--r--apps/files_external/lib/Lib/Auth/PublicKey/RSAPrivateKey.php6
2 files changed, 10 insertions, 2 deletions
diff --git a/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php b/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php
index 2d17b4e9698..d45db03b2da 100644
--- a/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php
+++ b/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php
@@ -60,7 +60,11 @@ class RSA extends AuthMechanism {
$auth = new RSACrypt();
$auth->setPassword($this->config->getSystemValue('secret', ''));
if (!$auth->loadKey($storage->getBackendOption('private_key'))) {
- throw new \RuntimeException('unable to load private key');
+ // Add fallback routine for a time where secret was not enforced to be exists
+ $auth->setPassword('');
+ if (!$auth->loadKey($storage->getBackendOption('private_key'))) {
+ throw new \RuntimeException('unable to load private key');
+ }
}
$storage->setBackendOption('public_key_auth', $auth);
}
diff --git a/apps/files_external/lib/Lib/Auth/PublicKey/RSAPrivateKey.php b/apps/files_external/lib/Lib/Auth/PublicKey/RSAPrivateKey.php
index 886d16965f4..7d04aaaf057 100644
--- a/apps/files_external/lib/Lib/Auth/PublicKey/RSAPrivateKey.php
+++ b/apps/files_external/lib/Lib/Auth/PublicKey/RSAPrivateKey.php
@@ -58,7 +58,11 @@ class RSAPrivateKey extends AuthMechanism {
$auth = new RSACrypt();
$auth->setPassword($this->config->getSystemValue('secret', ''));
if (!$auth->loadKey($storage->getBackendOption('private_key'))) {
- throw new \RuntimeException('unable to load private key');
+ // Add fallback routine for a time where secret was not enforced to be exists
+ $auth->setPassword('');
+ if (!$auth->loadKey($storage->getBackendOption('private_key'))) {
+ throw new \RuntimeException('unable to load private key');
+ }
}
$storage->setBackendOption('public_key_auth', $auth);
}