diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-12-05 11:28:52 +0100 |
---|---|---|
committer | Carl Schwan <carl@carlschwan.eu> | 2022-12-06 09:00:45 +0100 |
commit | 40f01de4561fff4c2d913643e671644c07c298b8 (patch) | |
tree | 77bf3bc4ae2c086d72de709810712f2f4247f775 | |
parent | 987b59b006c9a718fae8e5682134d53016abe53b (diff) | |
download | nextcloud-server-40f01de4561fff4c2d913643e671644c07c298b8.tar.gz nextcloud-server-40f01de4561fff4c2d913643e671644c07c298b8.zip |
Fix migration to non-empty secret
Add a fallback for empty keys
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
(cherry picked from commit 754cb58b1259a58f626d47c2193b92c651d3b2d8)
-rw-r--r-- | apps/files_external/lib/Lib/Auth/PublicKey/RSA.php | 5 | ||||
-rw-r--r-- | apps/files_external/lib/Lib/Auth/PublicKey/RSAPrivateKey.php | 5 |
2 files changed, 8 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..199fdfcc6d6 100644 --- a/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php +++ b/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php @@ -60,7 +60,10 @@ 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'); + $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..26cf0501eb6 100644 --- a/apps/files_external/lib/Lib/Auth/PublicKey/RSAPrivateKey.php +++ b/apps/files_external/lib/Lib/Auth/PublicKey/RSAPrivateKey.php @@ -58,7 +58,10 @@ 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'); + $auth->setPassword(''); + if (!$auth->loadKey($storage->getBackendOption('private_key'))) { + throw new \RuntimeException('unable to load private key'); + } } $storage->setBackendOption('public_key_auth', $auth); } |