Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2020-05-25 16:03:52 +0300
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2020-05-25 20:53:23 +0300
commit64df6aaf854ca3ca1cb121cf4470d758f154d827 (patch)
treea055c44ce7457ea0ba6a2faea94bd5eacb5167b0
parent1d816add44fb0058d1fd927585a4e894c1d39132 (diff)
Do not read certificate bundle from data dir by default
Before the resources/config/ca-bundle.crt was only used when the list of custom certificates was empty and the instance was not installed. But it should also be used when the list is empty and the instance is installed. This is inverting the logic to stop if the instance is not installed to use the default bundle. And it also does this when the list is empty. Signed-off-by: Morris Jobke <hey@morrisjobke.de>
-rw-r--r--lib/private/Http/Client/Client.php14
-rw-r--r--tests/lib/Http/Client/ClientTest.php5
2 files changed, 9 insertions, 10 deletions
diff --git a/lib/private/Http/Client/Client.php b/lib/private/Http/Client/Client.php
index c52d90ff8ec..3e606caae19 100644
--- a/lib/private/Http/Client/Client.php
+++ b/lib/private/Http/Client/Client.php
@@ -81,18 +81,18 @@ class Client implements IClient {
}
private function getCertBundle(): string {
- if ($this->certificateManager->listCertificates() !== []) {
- return $this->certificateManager->getAbsoluteBundlePath();
- }
-
// If the instance is not yet setup we need to use the static path as
// $this->certificateManager->getAbsoluteBundlePath() tries to instantiiate
// a view
- if ($this->config->getSystemValue('installed', false)) {
- return $this->certificateManager->getAbsoluteBundlePath(null);
+ if ($this->config->getSystemValue('installed', false) === false) {
+ return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt';
+ }
+
+ if ($this->certificateManager->listCertificates() === []) {
+ return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt';
}
- return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt';
+ return $this->certificateManager->getAbsoluteBundlePath();
}
/**
diff --git a/tests/lib/Http/Client/ClientTest.php b/tests/lib/Http/Client/ClientTest.php
index 2a7bd6a185d..a9ab7d6046b 100644
--- a/tests/lib/Http/Client/ClientTest.php
+++ b/tests/lib/Http/Client/ClientTest.php
@@ -262,9 +262,8 @@ class ClientTest extends \Test\TestCase {
->with('installed', false)
->willReturn(false);
$this->certificateManager
- ->expects($this->once())
- ->method('listCertificates')
- ->willReturn([]);
+ ->expects($this->never())
+ ->method('listCertificates');
$this->assertEquals([
'verify' => \OC::$SERVERROOT . '/resources/config/ca-bundle.crt',