aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2022-12-06 15:04:25 +0100
committerGitHub <noreply@github.com>2022-12-06 15:04:25 +0100
commit5bc2154bf0acf3d49a31ea979f3fe707cf7395b5 (patch)
tree3d013c0aa9d6d1c60065b21bcaa6708884c3be58
parent987b59b006c9a718fae8e5682134d53016abe53b (diff)
parent1c558d2f1541776bf30a8d79fe42389bd0c8c964 (diff)
downloadnextcloud-server-5bc2154bf0acf3d49a31ea979f3fe707cf7395b5.tar.gz
nextcloud-server-5bc2154bf0acf3d49a31ea979f3fe707cf7395b5.zip
Merge pull request #35616 from nextcloud/backport/fix/empty-secret-migration-files-external
[stable25] 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);
}