Skip to content

Commit f148689

Browse files
committed
only use nextcloud bundle when explicitly enabled
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent bffa67c commit f148689

2 files changed

Lines changed: 15 additions & 10 deletions

File tree

lib/private/Files/ObjectStore/S3ConnectionTrait.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2929
*
3030
*/
31+
3132
namespace OC\Files\ObjectStore;
3233

3334
use Aws\ClientResolver;
@@ -143,7 +144,7 @@ public function getConnection() {
143144
if (!$this->connection::isBucketDnsCompatible($this->bucket)) {
144145
$logger = \OC::$server->get(LoggerInterface::class);
145146
$logger->debug('Bucket "' . $this->bucket . '" This bucket name is not dns compatible, it may contain invalid characters.',
146-
['app' => 'objectstore']);
147+
['app' => 'objectstore']);
147148
}
148149

149150
if ($this->params['verify_bucket_exists'] && !$this->connection->doesBucketExist($this->bucket)) {
@@ -194,7 +195,7 @@ public static function legacySignatureProvider($version, $service, $region) {
194195
/**
195196
* This function creates a credential provider based on user parameter file
196197
*/
197-
protected function paramCredentialProvider() : callable {
198+
protected function paramCredentialProvider(): callable {
198199
return function () {
199200
$key = empty($this->params['key']) ? null : $this->params['key'];
200201
$secret = empty($this->params['secret']) ? null : $this->params['secret'];
@@ -210,14 +211,18 @@ protected function paramCredentialProvider() : callable {
210211
};
211212
}
212213

213-
protected function getCertificateBundlePath(): string {
214-
// since we store the certificate bundles on the primary storage, we can't get the bundle while setting up the primary storage
215-
if (!isset($this->params['primary_storage'])) {
216-
/** @var ICertificateManager $certManager */
217-
$certManager = \OC::$server->get(ICertificateManager::class);
218-
return $certManager->getAbsoluteBundlePath();
214+
protected function getCertificateBundlePath(): ?string {
215+
if ((int)($this->params['use_nextcloud_bundle'] ?? "0")) {
216+
// since we store the certificate bundles on the primary storage, we can't get the bundle while setting up the primary storage
217+
if (!isset($this->params['primary_storage'])) {
218+
/** @var ICertificateManager $certManager */
219+
$certManager = \OC::$server->get(ICertificateManager::class);
220+
return $certManager->getAbsoluteBundlePath();
221+
} else {
222+
return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt';
223+
}
219224
} else {
220-
return \OC::$SERVERROOT . '/resources/config/ca-bundle.crt';
225+
return null;
221226
}
222227
}
223228
}

lib/private/Files/ObjectStore/S3ObjectTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ trait S3ObjectTrait {
4343
*/
4444
abstract protected function getConnection();
4545

46-
abstract protected function getCertificateBundlePath(): string;
46+
abstract protected function getCertificateBundlePath(): ?string;
4747

4848
/**
4949
* @param string $urn the unified resource name used to identify the object

0 commit comments

Comments
 (0)