Skip to content
Snippets Groups Projects
Unverified Commit 54b9f639 authored by Roeland Jago Douma's avatar Roeland Jago Douma Committed by Morris Jobke
Browse files

Always return the default path if we can


Just check in the certifcate manager. So every part of the system that
request the certificatebundle gets the defaullt one (the 99% case) if we
can.

Signed-off-by: default avatarRoeland Jago Douma <roeland@famdouma.nl>
parent dc479aae
No related branches found
No related tags found
No related merge requests found
...@@ -105,10 +105,6 @@ class Client implements IClient { ...@@ -105,10 +105,6 @@ class Client implements IClient {
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(); return $this->certificateManager->getAbsoluteBundlePath();
} }
......
...@@ -104,6 +104,29 @@ class CertificateManager implements ICertificateManager { ...@@ -104,6 +104,29 @@ class CertificateManager implements ICertificateManager {
return $result; return $result;
} }
private function hasCertificates(): bool {
if (!$this->config->getSystemValue('installed', false)) {
return false;
}
$path = $this->getPathToCertificates() . 'uploads/';
if (!$this->view->is_dir($path)) {
return false;
}
$result = [];
$handle = $this->view->opendir($path);
if (!is_resource($handle)) {
return false;
}
while (false !== ($file = readdir($handle))) {
if ($file !== '.' && $file !== '..') {
return true;
}
}
closedir($handle);
return false;
}
/** /**
* create the certificate bundle of all trusted certificated * create the certificate bundle of all trusted certificated
*/ */
...@@ -213,9 +236,14 @@ class CertificateManager implements ICertificateManager { ...@@ -213,9 +236,14 @@ class CertificateManager implements ICertificateManager {
* @return string * @return string
*/ */
public function getAbsoluteBundlePath() { public function getAbsoluteBundlePath() {
if (!$this->hasCertificates()) {
return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt';
}
if ($this->needsRebundling()) { if ($this->needsRebundling()) {
$this->createCertificateBundle(); $this->createCertificateBundle();
} }
return $this->view->getLocalFile($this->getCertificateBundle()); return $this->view->getLocalFile($this->getCertificateBundle());
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment