]> source.dussan.org Git - nextcloud-server.git/commitdiff
only use nextcloud bundle when explicitly enabled 33253/head
authorRobin Appelman <robin@icewind.nl>
Tue, 5 Jul 2022 14:06:55 +0000 (16:06 +0200)
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>
Mon, 18 Jul 2022 07:57:48 +0000 (07:57 +0000)
Signed-off-by: Robin Appelman <robin@icewind.nl>
lib/private/Files/ObjectStore/S3ConnectionTrait.php
lib/private/Files/ObjectStore/S3ObjectTrait.php

index d38f553fdf67cc4f44201e11cd96213307db76f6..088e9aa8d3f1c5c730ef38528b666f5a39bdb4e2 100644 (file)
@@ -28,6 +28,7 @@
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  *
  */
+
 namespace OC\Files\ObjectStore;
 
 use Aws\ClientResolver;
@@ -144,7 +145,7 @@ trait S3ConnectionTrait {
                if (!$this->connection::isBucketDnsCompatible($this->bucket)) {
                        $logger = \OC::$server->getLogger();
                        $logger->debug('Bucket "' . $this->bucket . '" This bucket name is not dns compatible, it may contain invalid characters.',
-                                        ['app' => 'objectstore']);
+                               ['app' => 'objectstore']);
                }
 
                if ($this->params['verify_bucket_exists'] && !$this->connection->doesBucketExist($this->bucket)) {
@@ -196,7 +197,7 @@ trait S3ConnectionTrait {
        /**
         * This function creates a credential provider based on user parameter file
         */
-       protected function paramCredentialProvider() : callable {
+       protected function paramCredentialProvider(): callable {
                return function () {
                        $key = empty($this->params['key']) ? null : $this->params['key'];
                        $secret = empty($this->params['secret']) ? null : $this->params['secret'];
@@ -212,14 +213,18 @@ trait S3ConnectionTrait {
                };
        }
 
-       protected function getCertificateBundlePath(): string {
-               // since we store the certificate bundles on the primary storage, we can't get the bundle while setting up the primary storage
-               if (!isset($this->params['primary_storage'])) {
-                       /** @var ICertificateManager $certManager */
-                       $certManager = \OC::$server->get(ICertificateManager::class);
-                       return $certManager->getAbsoluteBundlePath();
+       protected function getCertificateBundlePath(): ?string {
+               if ((int)($this->params['use_nextcloud_bundle'] ?? "0")) {
+                       // since we store the certificate bundles on the primary storage, we can't get the bundle while setting up the primary storage
+                       if (!isset($this->params['primary_storage'])) {
+                               /** @var ICertificateManager $certManager */
+                               $certManager = \OC::$server->get(ICertificateManager::class);
+                               return $certManager->getAbsoluteBundlePath();
+                       } else {
+                               return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt';
+                       }
                } else {
-                       return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt';
+                       return null;
                }
        }
 }
index 9a2f5b2c6df55b9680fda1d88e03dc0afcdbd4e3..a92c5c139ea06a42340d9bae0820c9a199e9b15a 100644 (file)
@@ -43,7 +43,7 @@ trait S3ObjectTrait {
         */
        abstract protected function getConnection();
 
-       abstract protected function getCertificateBundlePath(): string;
+       abstract protected function getCertificateBundlePath(): ?string;
 
        /**
         * @param string $urn the unified resource name used to identify the object