Merge pull request #21095 from nextcloud/backport/21090/stable19

[stable19] Do not read certificate bundle from data dir by default
This commit is contained in:
Roeland Jago Douma 2020-05-26 11:43:46 +02:00 committed by GitHub
commit 24e97c1a7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 10 deletions

View File

@ -93,18 +93,18 @@ class Client implements IClient {
} }
private function getCertBundle(): string { 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 // If the instance is not yet setup we need to use the static path as
// $this->certificateManager->getAbsoluteBundlePath() tries to instantiiate // $this->certificateManager->getAbsoluteBundlePath() tries to instantiiate
// a view // a view
if ($this->config->getSystemValue('installed', false)) { if ($this->config->getSystemValue('installed', false) === false) {
return $this->certificateManager->getAbsoluteBundlePath(null); return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt';
} }
return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt'; if ($this->certificateManager->listCertificates() === []) {
return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt';
}
return $this->certificateManager->getAbsoluteBundlePath();
} }
/** /**

View File

@ -460,9 +460,8 @@ class ClientTest extends \Test\TestCase {
->with('installed', false) ->with('installed', false)
->willReturn(false); ->willReturn(false);
$this->certificateManager $this->certificateManager
->expects($this->once()) ->expects($this->never())
->method('listCertificates') ->method('listCertificates');
->willReturn([]);
$this->assertEquals([ $this->assertEquals([
'verify' => \OC::$SERVERROOT . '/resources/config/ca-bundle.crt', 'verify' => \OC::$SERVERROOT . '/resources/config/ca-bundle.crt',