diff options
-rw-r--r-- | .drone.yml | 15 | ||||
-rw-r--r-- | core/templates/loginflow/authpicker.php | 2 | ||||
-rw-r--r-- | core/templates/loginflowv2/authpicker.php | 2 | ||||
-rw-r--r-- | lib/private/Http/Client/DnsPinMiddleware.php | 17 | ||||
-rw-r--r-- | lib/private/Setup.php | 5 | ||||
-rwxr-xr-x | tests/drone-wait-objectstore.sh | 6 | ||||
-rw-r--r-- | tests/lib/Files/ObjectStore/S3Test.php | 7 | ||||
-rw-r--r-- | tests/preseed-config.php | 8 |
8 files changed, 40 insertions, 22 deletions
diff --git a/.drone.yml b/.drone.yml index 8217524fbb5..e5ef78f3d18 100644 --- a/.drone.yml +++ b/.drone.yml @@ -2117,6 +2117,15 @@ kind: pipeline name: object-store-s3 steps: +- name: minio + image: ghcr.io/nextcloud/continuous-integration-minio:latest + detach: true + commands: + - mkdir /s3data + - minio server /s3data + environment: + MINIO_ROOT_USER: nextcloud + MINIO_ROOT_PASSWORD: nextcloud - name: submodules image: ghcr.io/nextcloud/continuous-integration-alpine-git:latest commands: @@ -2124,6 +2133,7 @@ steps: - name: object-store image: ghcr.io/nextcloud/continuous-integration-php7.4:php7.4-3 environment: + OBJECT_STORE: s3 CODECOV_TOKEN: from_secret: CODECOV_TOKEN commands: @@ -2133,10 +2143,6 @@ steps: - wget https://codecov.io/bash -O codecov.sh - bash codecov.sh -C $DRONE_COMMIT -f tests/autotest-clover-sqlite.xml -services: -- name: fake-s3 - image: ghcr.io/nextcloud/continuous-integration-fake-s3:latest - trigger: branch: - master @@ -2157,6 +2163,7 @@ steps: - name: object-store image: ghcr.io/nextcloud/continuous-integration-php7.4:php7.4-3 environment: + OBJECT_STORE: azure CODECOV_TOKEN: from_secret: CODECOV_TOKEN commands: diff --git a/core/templates/loginflow/authpicker.php b/core/templates/loginflow/authpicker.php index b36fbb1d2f3..02b4b9cc003 100644 --- a/core/templates/loginflow/authpicker.php +++ b/core/templates/loginflow/authpicker.php @@ -37,7 +37,7 @@ $urlGenerator = $_['urlGenerator']; </p> <span class="warning"> - <h3><?php p('Security warning') ?></h3> + <h3><?php p($l->t('Security warning')) ?></h3> <p> <?php p($l->t('If you are not trying to set up a new device or app, someone is trying to trick you into granting them access to your data. In this case do not proceed and instead contact your system administrator.')) ?> </p> diff --git a/core/templates/loginflowv2/authpicker.php b/core/templates/loginflowv2/authpicker.php index 06ed0b0f4e5..ce993ea2092 100644 --- a/core/templates/loginflowv2/authpicker.php +++ b/core/templates/loginflowv2/authpicker.php @@ -36,7 +36,7 @@ $urlGenerator = $_['urlGenerator']; </p> <span class="warning"> - <h3><?php p('Security warning') ?></h3> + <h3><?php p($l->t('Security warning')) ?></h3> <p> <?php p($l->t('If you are not trying to set up a new device or app, someone is trying to trick you into granting them access to your data. In this case do not proceed and instead contact your system administrator.')) ?> </p> diff --git a/lib/private/Http/Client/DnsPinMiddleware.php b/lib/private/Http/Client/DnsPinMiddleware.php index 019fde23723..900173bb506 100644 --- a/lib/private/Http/Client/DnsPinMiddleware.php +++ b/lib/private/Http/Client/DnsPinMiddleware.php @@ -112,15 +112,22 @@ class DnsPinMiddleware { $targetIps = $this->dnsResolve($hostName, 0); - foreach ($targetIps as $ip) { - $this->localAddressChecker->ThrowIfLocalIp($ip); + $curlResolves = []; - foreach ($ports as $port) { - $curlEntry = $hostName . ':' . $port . ':' . $ip; - $options['curl'][CURLOPT_RESOLVE][] = $curlEntry; + foreach ($ports as $port) { + $curlResolves["$hostName:$port"] = []; + + foreach ($targetIps as $ip) { + $this->localAddressChecker->ThrowIfLocalIp($ip); + $curlResolves["$hostName:$port"][] = $ip; } } + // Coalesce the per-host:port ips back into a comma separated list + foreach ($curlResolves as $hostport => $ips) { + $options['curl'][CURLOPT_RESOLVE][] = "$hostport:" . implode(',', $ips); + } + return $handler($request, $options); }; }; diff --git a/lib/private/Setup.php b/lib/private/Setup.php index d39fa069286..a4873e63aa9 100644 --- a/lib/private/Setup.php +++ b/lib/private/Setup.php @@ -131,7 +131,10 @@ class Setup { * @return array */ protected function getAvailableDbDriversForPdo() { - return \PDO::getAvailableDrivers(); + if (class_exists(\PDO::class)) { + return \PDO::getAvailableDrivers(); + } + return []; } /** diff --git a/tests/drone-wait-objectstore.sh b/tests/drone-wait-objectstore.sh index 7914d45bed1..7817d946682 100755 --- a/tests/drone-wait-objectstore.sh +++ b/tests/drone-wait-objectstore.sh @@ -12,6 +12,12 @@ function get_swift_token() { fi } +if [ "$OBJECT_STORE" == "s3" ]; then + echo "Waiting for minio to be ready" + timeout 60 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://minio:9000)" != "403" ]]; do sleep 5; done' || ( + echo "Failed to wait for minio to be ready" && exit 1 + ) +fi if [ "$OBJECT_STORE" == "swift" ]; then echo "waiting for keystone" until get_swift_token diff --git a/tests/lib/Files/ObjectStore/S3Test.php b/tests/lib/Files/ObjectStore/S3Test.php index 97814212382..25bee9cbdd8 100644 --- a/tests/lib/Files/ObjectStore/S3Test.php +++ b/tests/lib/Files/ObjectStore/S3Test.php @@ -62,7 +62,7 @@ class NonSeekableStream extends Wrapper { class S3Test extends ObjectStoreTest { protected function getInstance() { $config = \OC::$server->getConfig()->getSystemValue('objectstore'); - if (!is_array($config) || $config['class'] !== 'OC\\Files\\ObjectStore\\S3') { + if (!is_array($config) || $config['class'] !== S3::class) { $this->markTestSkipped('objectstore not configured for s3'); } @@ -70,11 +70,6 @@ class S3Test extends ObjectStoreTest { } public function testUploadNonSeekable() { - $config = \OC::$server->getConfig()->getSystemValue('objectstore'); - if (!is_array($config) || $config['class'] !== 'OC\\Files\\ObjectStore\\S3') { - $this->markTestSkipped('objectstore not configured for s3'); - } - $s3 = $this->getInstance(); $s3->writeObject('multiparttest', NonSeekableStream::wrap(fopen(__FILE__, 'r'))); diff --git a/tests/preseed-config.php b/tests/preseed-config.php index 97c8a1d11a8..16aea87c8a7 100644 --- a/tests/preseed-config.php +++ b/tests/preseed-config.php @@ -25,10 +25,10 @@ if (getenv('OBJECT_STORE') === 's3') { 'arguments' => [ 'bucket' => 'nextcloud', 'autocreate' => true, - 'key' => 'dummy', - 'secret' => 'dummy', - 'hostname' => getenv('DRONE') === 'true' ? 'fake-s3' : 'localhost', - 'port' => 4569, + 'key' => 'nextcloud', + 'secret' => 'nextcloud', + 'hostname' => getenv('DRONE') === 'true' ? 'minio' : 'localhost', + 'port' => 9000, 'use_ssl' => false, // required for some non amazon s3 implementations 'use_path_style' => true |