summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
m---------3rdparty0
-rw-r--r--build/stubs/intl.php4
-rw-r--r--core/shipped.json3
-rw-r--r--lib/composer/composer/autoload_classmap.php3
-rw-r--r--lib/composer/composer/autoload_static.php3
-rw-r--r--lib/private/App/AppStore/Bundles/BundleFetcher.php28
-rw-r--r--lib/private/Http/Client/DnsPinMiddleware.php2
-rw-r--r--lib/private/Http/Client/LocalAddressChecker.php33
-rw-r--r--lib/private/Repair.php27
-rw-r--r--lib/private/Repair/ClearGeneratedAvatarCache.php9
-rw-r--r--lib/private/Repair/ClearGeneratedAvatarCacheJob.php (renamed from lib/private/App/AppStore/Bundles/CoreBundle.php)30
-rw-r--r--lib/private/Repair/Owncloud/InstallCoreBundle.php79
-rw-r--r--lib/private/Setup.php8
-rw-r--r--tests/Test/Repair/Owncloud/InstallCoreBundleTest.php142
-rw-r--r--tests/lib/App/AppStore/Bundles/BundleFetcherTest.php9
-rw-r--r--tests/lib/App/AppStore/Bundles/CoreBundleTest.php36
-rw-r--r--tests/lib/Http/Client/ClientTest.php1
-rw-r--r--tests/lib/Http/Client/LocalAddressCheckerTest.php23
-rw-r--r--tests/lib/Repair/ClearGeneratedAvatarCacheTest.php10
19 files changed, 89 insertions, 361 deletions
diff --git a/3rdparty b/3rdparty
-Subproject f143482ffb0b8dfdbc08cd848ce2e66f02a5d9b
+Subproject 3095d4062823f3f913d594f9ff313010ed55cd7
diff --git a/build/stubs/intl.php b/build/stubs/intl.php
index 201db9a33f4..08e0c719338 100644
--- a/build/stubs/intl.php
+++ b/build/stubs/intl.php
@@ -4622,7 +4622,7 @@ function idn_to_ascii($domain, $options = 0, $variant = INTL_IDNA_VARIANT_2003,
* @param int $variant [optional] <p>
* Either INTL_IDNA_VARIANT_2003 for IDNA 2003 or INTL_IDNA_VARIANT_UTS46 for UTS #46.
* </p>
- * @param int &$idna_info [optional] <p>
+ * @param array &$idna_info [optional] <p>
* This parameter can be used only if INTL_IDNA_VARIANT_UTS46 was used for variant.
* In that case, it will be filled with an array with the keys 'result',
* the possibly illegal result of the transformation, 'isTransitionalDifferent',
@@ -4634,7 +4634,7 @@ function idn_to_ascii($domain, $options = 0, $variant = INTL_IDNA_VARIANT_2003,
* RFC 3490 4.2 states though "ToUnicode never fails. If any step fails, then the original input
* sequence is returned immediately in that step."
*/
-function idn_to_utf8($domain, $options = 0, $variant = INTL_IDNA_VARIANT_2003, array &$idna_info) { }
+function idn_to_utf8($domain, $options = 0, $variant = INTL_IDNA_VARIANT_2003, array &$idna_info = null) { }
/**
* (PHP 5 &gt;=5.5.0 PECL intl &gt;= 3.0.0a1)<br/>
diff --git a/core/shipped.json b/core/shipped.json
index e1407798289..33125212d2b 100644
--- a/core/shipped.json
+++ b/core/shipped.json
@@ -2,6 +2,7 @@
"shippedApps": [
"activity",
"admin_audit",
+ "bruteforcesettings",
"circles",
"cloud_federation_api",
"comments",
@@ -36,10 +37,12 @@
"sharebymail",
"support",
"survey_client",
+ "suspicious_login",
"systemtags",
"text",
"theming",
"twofactor_backupcodes",
+ "twofactor_totp",
"updatenotification",
"user_ldap",
"user_status",
diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php
index 68d14852100..33467ad104a 100644
--- a/lib/composer/composer/autoload_classmap.php
+++ b/lib/composer/composer/autoload_classmap.php
@@ -720,7 +720,6 @@ return array(
'OC\\App\\AppManager' => $baseDir . '/lib/private/App/AppManager.php',
'OC\\App\\AppStore\\Bundles\\Bundle' => $baseDir . '/lib/private/App/AppStore/Bundles/Bundle.php',
'OC\\App\\AppStore\\Bundles\\BundleFetcher' => $baseDir . '/lib/private/App/AppStore/Bundles/BundleFetcher.php',
- 'OC\\App\\AppStore\\Bundles\\CoreBundle' => $baseDir . '/lib/private/App/AppStore/Bundles/CoreBundle.php',
'OC\\App\\AppStore\\Bundles\\EducationBundle' => $baseDir . '/lib/private/App/AppStore/Bundles/EducationBundle.php',
'OC\\App\\AppStore\\Bundles\\EnterpriseBundle' => $baseDir . '/lib/private/App/AppStore/Bundles/EnterpriseBundle.php',
'OC\\App\\AppStore\\Bundles\\GroupwareBundle' => $baseDir . '/lib/private/App/AppStore/Bundles/GroupwareBundle.php',
@@ -1434,6 +1433,7 @@ return array(
'OC\\Repair\\CleanTags' => $baseDir . '/lib/private/Repair/CleanTags.php',
'OC\\Repair\\ClearFrontendCaches' => $baseDir . '/lib/private/Repair/ClearFrontendCaches.php',
'OC\\Repair\\ClearGeneratedAvatarCache' => $baseDir . '/lib/private/Repair/ClearGeneratedAvatarCache.php',
+ 'OC\\Repair\\ClearGeneratedAvatarCacheJob' => $baseDir . '/lib/private/Repair/ClearGeneratedAvatarCacheJob.php',
'OC\\Repair\\Collation' => $baseDir . '/lib/private/Repair/Collation.php',
'OC\\Repair\\Events\\RepairAdvanceEvent' => $baseDir . '/lib/private/Repair/Events/RepairAdvanceEvent.php',
'OC\\Repair\\Events\\RepairErrorEvent' => $baseDir . '/lib/private/Repair/Events/RepairErrorEvent.php',
@@ -1461,7 +1461,6 @@ return array(
'OC\\Repair\\Owncloud\\CleanPreviews' => $baseDir . '/lib/private/Repair/Owncloud/CleanPreviews.php',
'OC\\Repair\\Owncloud\\CleanPreviewsBackgroundJob' => $baseDir . '/lib/private/Repair/Owncloud/CleanPreviewsBackgroundJob.php',
'OC\\Repair\\Owncloud\\DropAccountTermsTable' => $baseDir . '/lib/private/Repair/Owncloud/DropAccountTermsTable.php',
- 'OC\\Repair\\Owncloud\\InstallCoreBundle' => $baseDir . '/lib/private/Repair/Owncloud/InstallCoreBundle.php',
'OC\\Repair\\Owncloud\\MigrateOauthTables' => $baseDir . '/lib/private/Repair/Owncloud/MigrateOauthTables.php',
'OC\\Repair\\Owncloud\\MoveAvatars' => $baseDir . '/lib/private/Repair/Owncloud/MoveAvatars.php',
'OC\\Repair\\Owncloud\\MoveAvatarsBackgroundJob' => $baseDir . '/lib/private/Repair/Owncloud/MoveAvatarsBackgroundJob.php',
diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php
index 45c047bcdb1..ced12e586a4 100644
--- a/lib/composer/composer/autoload_static.php
+++ b/lib/composer/composer/autoload_static.php
@@ -753,7 +753,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OC\\App\\AppManager' => __DIR__ . '/../../..' . '/lib/private/App/AppManager.php',
'OC\\App\\AppStore\\Bundles\\Bundle' => __DIR__ . '/../../..' . '/lib/private/App/AppStore/Bundles/Bundle.php',
'OC\\App\\AppStore\\Bundles\\BundleFetcher' => __DIR__ . '/../../..' . '/lib/private/App/AppStore/Bundles/BundleFetcher.php',
- 'OC\\App\\AppStore\\Bundles\\CoreBundle' => __DIR__ . '/../../..' . '/lib/private/App/AppStore/Bundles/CoreBundle.php',
'OC\\App\\AppStore\\Bundles\\EducationBundle' => __DIR__ . '/../../..' . '/lib/private/App/AppStore/Bundles/EducationBundle.php',
'OC\\App\\AppStore\\Bundles\\EnterpriseBundle' => __DIR__ . '/../../..' . '/lib/private/App/AppStore/Bundles/EnterpriseBundle.php',
'OC\\App\\AppStore\\Bundles\\GroupwareBundle' => __DIR__ . '/../../..' . '/lib/private/App/AppStore/Bundles/GroupwareBundle.php',
@@ -1467,6 +1466,7 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OC\\Repair\\CleanTags' => __DIR__ . '/../../..' . '/lib/private/Repair/CleanTags.php',
'OC\\Repair\\ClearFrontendCaches' => __DIR__ . '/../../..' . '/lib/private/Repair/ClearFrontendCaches.php',
'OC\\Repair\\ClearGeneratedAvatarCache' => __DIR__ . '/../../..' . '/lib/private/Repair/ClearGeneratedAvatarCache.php',
+ 'OC\\Repair\\ClearGeneratedAvatarCacheJob' => __DIR__ . '/../../..' . '/lib/private/Repair/ClearGeneratedAvatarCacheJob.php',
'OC\\Repair\\Collation' => __DIR__ . '/../../..' . '/lib/private/Repair/Collation.php',
'OC\\Repair\\Events\\RepairAdvanceEvent' => __DIR__ . '/../../..' . '/lib/private/Repair/Events/RepairAdvanceEvent.php',
'OC\\Repair\\Events\\RepairErrorEvent' => __DIR__ . '/../../..' . '/lib/private/Repair/Events/RepairErrorEvent.php',
@@ -1494,7 +1494,6 @@ class ComposerStaticInit749170dad3f5e7f9ca158f5a9f04f6a2
'OC\\Repair\\Owncloud\\CleanPreviews' => __DIR__ . '/../../..' . '/lib/private/Repair/Owncloud/CleanPreviews.php',
'OC\\Repair\\Owncloud\\CleanPreviewsBackgroundJob' => __DIR__ . '/../../..' . '/lib/private/Repair/Owncloud/CleanPreviewsBackgroundJob.php',
'OC\\Repair\\Owncloud\\DropAccountTermsTable' => __DIR__ . '/../../..' . '/lib/private/Repair/Owncloud/DropAccountTermsTable.php',
- 'OC\\Repair\\Owncloud\\InstallCoreBundle' => __DIR__ . '/../../..' . '/lib/private/Repair/Owncloud/InstallCoreBundle.php',
'OC\\Repair\\Owncloud\\MigrateOauthTables' => __DIR__ . '/../../..' . '/lib/private/Repair/Owncloud/MigrateOauthTables.php',
'OC\\Repair\\Owncloud\\MoveAvatars' => __DIR__ . '/../../..' . '/lib/private/Repair/Owncloud/MoveAvatars.php',
'OC\\Repair\\Owncloud\\MoveAvatarsBackgroundJob' => __DIR__ . '/../../..' . '/lib/private/Repair/Owncloud/MoveAvatarsBackgroundJob.php',
diff --git a/lib/private/App/AppStore/Bundles/BundleFetcher.php b/lib/private/App/AppStore/Bundles/BundleFetcher.php
index 7ffe1fa17d7..0d2bb61495f 100644
--- a/lib/private/App/AppStore/Bundles/BundleFetcher.php
+++ b/lib/private/App/AppStore/Bundles/BundleFetcher.php
@@ -27,12 +27,8 @@ namespace OC\App\AppStore\Bundles;
use OCP\IL10N;
class BundleFetcher {
- /** @var IL10N */
- private $l10n;
+ private IL10N $l10n;
- /**
- * @param IL10N $l10n
- */
public function __construct(IL10N $l10n) {
$this->l10n = $l10n;
}
@@ -40,7 +36,7 @@ class BundleFetcher {
/**
* @return Bundle[]
*/
- public function getBundles() {
+ public function getBundles(): array {
return [
new EnterpriseBundle($this->l10n),
new HubBundle($this->l10n),
@@ -51,30 +47,14 @@ class BundleFetcher {
}
/**
- * Bundles that should be installed by default after installation
- *
- * @return Bundle[]
- */
- public function getDefaultInstallationBundle() {
- return [
- new CoreBundle($this->l10n),
- ];
- }
-
- /**
* Get the bundle with the specified identifier
*
* @param string $identifier
* @return Bundle
* @throws \BadMethodCallException If the bundle does not exist
*/
- public function getBundleByIdentifier($identifier) {
- /** @var Bundle[] $bundles */
- $bundles = array_merge(
- $this->getBundles(),
- $this->getDefaultInstallationBundle()
- );
- foreach ($bundles as $bundle) {
+ public function getBundleByIdentifier(string $identifier): Bundle {
+ foreach ($this->getBundles() as $bundle) {
if ($bundle->getIdentifier() === $identifier) {
return $bundle;
}
diff --git a/lib/private/Http/Client/DnsPinMiddleware.php b/lib/private/Http/Client/DnsPinMiddleware.php
index ee0ea053dcf..f5e6214a4ab 100644
--- a/lib/private/Http/Client/DnsPinMiddleware.php
+++ b/lib/private/Http/Client/DnsPinMiddleware.php
@@ -125,7 +125,7 @@ class DnsPinMiddleware {
$ports[] = (string)$port;
}
- $targetIps = $this->dnsResolve($hostName, 0);
+ $targetIps = $this->dnsResolve(idn_to_utf8($hostName), 0);
$curlResolves = [];
diff --git a/lib/private/Http/Client/LocalAddressChecker.php b/lib/private/Http/Client/LocalAddressChecker.php
index f4fea503ab9..13a7d062de3 100644
--- a/lib/private/Http/Client/LocalAddressChecker.php
+++ b/lib/private/Http/Client/LocalAddressChecker.php
@@ -25,6 +25,9 @@ declare(strict_types=1);
*/
namespace OC\Http\Client;
+use IPLib\Address\IPv6;
+use IPLib\Factory;
+use IPLib\ParseStringFlag;
use OCP\Http\Client\LocalServerException;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpFoundation\IpUtils;
@@ -37,6 +40,21 @@ class LocalAddressChecker {
}
public function ThrowIfLocalIp(string $ip) : void {
+ $parsedIp = Factory::parseAddressString(
+ $ip,
+ ParseStringFlag::IPV4_MAYBE_NON_DECIMAL | ParseStringFlag::IPV4ADDRESS_MAYBE_NON_QUAD_DOTTED
+ );
+ if ($parsedIp === null) {
+ /* Not an IP */
+ return;
+ }
+ /* Replace by normalized form */
+ if ($parsedIp instanceof IPv6) {
+ $ip = (string)($parsedIp->toIPv4() ?? $parsedIp);
+ } else {
+ $ip = (string)$parsedIp;
+ }
+
$localRanges = [
'100.64.0.0/10', // See RFC 6598
'192.0.0.0/24', // See RFC 6890
@@ -50,19 +68,6 @@ class LocalAddressChecker {
$this->logger->warning("Host $ip was not connected to because it violates local access rules");
throw new LocalServerException('Host violates local access rules');
}
-
- // Also check for IPv6 IPv4 nesting, because that's not covered by filter_var
- if ((bool)filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) && substr_count($ip, '.') > 0) {
- $delimiter = strrpos($ip, ':'); // Get last colon
- $ipv4Address = substr($ip, $delimiter + 1);
-
- if (
- !filter_var($ipv4Address, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) ||
- IpUtils::checkIp($ip, $localRanges)) {
- $this->logger->warning("Host $ip was not connected to because it violates local access rules");
- throw new LocalServerException('Host violates local access rules');
- }
- }
}
public function ThrowIfLocalAddress(string $uri) : void {
@@ -72,7 +77,7 @@ class LocalAddressChecker {
throw new LocalServerException('Could not detect any host');
}
- $host = strtolower($host);
+ $host = idn_to_utf8(strtolower(urldecode($host)));
// Remove brackets from IPv6 addresses
if (strpos($host, '[') === 0 && substr($host, -1) === ']') {
$host = substr($host, 1, -1);
diff --git a/lib/private/Repair.php b/lib/private/Repair.php
index e2e5da79216..57abb97f066 100644
--- a/lib/private/Repair.php
+++ b/lib/private/Repair.php
@@ -40,7 +40,6 @@ use OCP\Collaboration\Resources\IManager;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
-use OC\App\AppStore\Bundles\BundleFetcher;
use OC\Avatar\AvatarManager;
use OC\DB\Connection;
use OC\DB\ConnectionAdapter;
@@ -75,7 +74,6 @@ use OC\Repair\NC24\AddTokenCleanupJob;
use OC\Repair\OldGroupMembershipShares;
use OC\Repair\Owncloud\CleanPreviews;
use OC\Repair\Owncloud\DropAccountTermsTable;
-use OC\Repair\Owncloud\InstallCoreBundle;
use OC\Repair\Owncloud\MigrateOauthTables;
use OC\Repair\Owncloud\MoveAvatars;
use OC\Repair\Owncloud\SaveAccountsTableData;
@@ -193,29 +191,24 @@ class Repair implements IOutput {
new MigrateOauthTables(\OC::$server->get(Connection::class)),
new FixMountStorages(\OC::$server->getDatabaseConnection()),
new UpdateLanguageCodes(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig()),
- new InstallCoreBundle(
- \OC::$server->query(BundleFetcher::class),
- \OC::$server->getConfig(),
- \OC::$server->query(Installer::class)
- ),
new AddLogRotateJob(\OC::$server->getJobList()),
new ClearFrontendCaches(\OC::$server->getMemCacheFactory(), \OC::$server->query(JSCombiner::class)),
- new ClearGeneratedAvatarCache(\OC::$server->getConfig(), \OC::$server->query(AvatarManager::class)),
+ \OCP\Server::get(ClearGeneratedAvatarCache::class),
new AddPreviewBackgroundCleanupJob(\OC::$server->getJobList()),
new AddCleanupUpdaterBackupsJob(\OC::$server->getJobList()),
new CleanupCardDAVPhotoCache(\OC::$server->getConfig(), \OC::$server->getAppDataDir('dav-photocache'), \OC::$server->get(LoggerInterface::class)),
new AddClenupLoginFlowV2BackgroundJob(\OC::$server->getJobList()),
new RemoveLinkShares(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig(), \OC::$server->getGroupManager(), \OC::$server->getNotificationManager(), \OC::$server->query(ITimeFactory::class)),
new ClearCollectionsAccessCache(\OC::$server->getConfig(), \OC::$server->query(IManager::class)),
- \OC::$server->query(ResetGeneratedAvatarFlag::class),
- \OC::$server->query(EncryptionLegacyCipher::class),
- \OC::$server->query(EncryptionMigration::class),
- \OC::$server->get(ShippedDashboardEnable::class),
- \OC::$server->get(AddBruteForceCleanupJob::class),
- \OC::$server->get(AddCheckForUserCertificatesJob::class),
- \OC::$server->get(RepairDavShares::class),
- \OC::$server->get(LookupServerSendCheck::class),
- \OC::$server->get(AddTokenCleanupJob::class),
+ \OCP\Server::get(ResetGeneratedAvatarFlag::class),
+ \OCP\Server::get(EncryptionLegacyCipher::class),
+ \OCP\Server::get(EncryptionMigration::class),
+ \OCP\Server::get(ShippedDashboardEnable::class),
+ \OCP\Server::get(AddBruteForceCleanupJob::class),
+ \OCP\Server::get(AddCheckForUserCertificatesJob::class),
+ \OCP\Server::get(RepairDavShares::class),
+ \OCP\Server::get(LookupServerSendCheck::class),
+ \OCP\Server::get(AddTokenCleanupJob::class),
];
}
diff --git a/lib/private/Repair/ClearGeneratedAvatarCache.php b/lib/private/Repair/ClearGeneratedAvatarCache.php
index 1c1be4f7893..db86d92cd87 100644
--- a/lib/private/Repair/ClearGeneratedAvatarCache.php
+++ b/lib/private/Repair/ClearGeneratedAvatarCache.php
@@ -26,16 +26,19 @@ namespace OC\Repair;
use OC\Avatar\AvatarManager;
use OCP\IConfig;
+use OCP\BackgroundJob\IJobList;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
class ClearGeneratedAvatarCache implements IRepairStep {
protected AvatarManager $avatarManager;
private IConfig $config;
+ private IJobList $jobList;
- public function __construct(IConfig $config, AvatarManager $avatarManager) {
+ public function __construct(IConfig $config, AvatarManager $avatarManager, IJobList $jobList) {
$this->config = $config;
$this->avatarManager = $avatarManager;
+ $this->jobList = $jobList;
}
public function getName(): string {
@@ -55,8 +58,8 @@ class ClearGeneratedAvatarCache implements IRepairStep {
public function run(IOutput $output): void {
if ($this->shouldRun()) {
try {
- $this->avatarManager->clearCachedAvatars();
- $output->info('Avatar cache cleared');
+ $this->jobList->add(ClearGeneratedAvatarCacheJob::class, []);
+ $output->info('Avatar cache clearing job added');
} catch (\Exception $e) {
$output->warning('Unable to clear the avatar cache');
}
diff --git a/lib/private/App/AppStore/Bundles/CoreBundle.php b/lib/private/Repair/ClearGeneratedAvatarCacheJob.php
index b1b182fd1ac..e8513e7a933 100644
--- a/lib/private/App/AppStore/Bundles/CoreBundle.php
+++ b/lib/private/Repair/ClearGeneratedAvatarCacheJob.php
@@ -1,8 +1,6 @@
<?php
/**
- * @copyright Copyright (c) 2017 Lukas Reschke <lukas@statuscode.ch>
- *
- * @author Lukas Reschke <lukas@statuscode.ch>
+ * @copyright 2022 Carl Schwan <carl@carlschwan.eu>
*
* @license GNU AGPL version 3 or any later version
*
@@ -20,23 +18,21 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-namespace OC\App\AppStore\Bundles;
+namespace OC\Repair;
+
+use OCP\BackgroundJob\QueuedJob;
+use OCP\AppFramework\Utility\ITimeFactory;
+use OC\Avatar\AvatarManager;
-class CoreBundle extends Bundle {
+class ClearGeneratedAvatarCacheJob extends QueuedJob {
+ protected AvatarManager $avatarManager;
- /**
- * {@inheritDoc}
- */
- public function getName() {
- return 'Core bundle';
+ public function __construct(ITimeFactory $timeFactory, AvatarManager $avatarManager) {
+ parent::__construct($timeFactory);
+ $this->avatarManager = $avatarManager;
}
- /**
- * {@inheritDoc}
- */
- public function getAppIdentifiers() {
- return [
- 'bruteforcesettings',
- ];
+ public function run($argument) {
+ $this->avatarManager->clearCachedAvatars();
}
}
diff --git a/lib/private/Repair/Owncloud/InstallCoreBundle.php b/lib/private/Repair/Owncloud/InstallCoreBundle.php
deleted file mode 100644
index a733bc43923..00000000000
--- a/lib/private/Repair/Owncloud/InstallCoreBundle.php
+++ /dev/null
@@ -1,79 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2017 Lukas Reschke <lukas@statuscode.ch>
- *
- * @author Julius Härtl <jus@bitgrid.net>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-namespace OC\Repair\Owncloud;
-
-use OC\App\AppStore\Bundles\BundleFetcher;
-use OC\Installer;
-use OCP\IConfig;
-use OCP\Migration\IOutput;
-use OCP\Migration\IRepairStep;
-
-class InstallCoreBundle implements IRepairStep {
- /** @var BundleFetcher */
- private $bundleFetcher;
- /** @var IConfig */
- private $config;
- /** @var Installer */
- private $installer;
-
- /**
- * @param BundleFetcher $bundleFetcher
- * @param IConfig $config
- * @param Installer $installer
- */
- public function __construct(BundleFetcher $bundleFetcher,
- IConfig $config,
- Installer $installer) {
- $this->bundleFetcher = $bundleFetcher;
- $this->config = $config;
- $this->installer = $installer;
- }
-
- /**
- * {@inheritdoc}
- */
- public function getName() {
- return 'Install new core bundle components';
- }
-
- /**
- * {@inheritdoc}
- */
- public function run(IOutput $output) {
- $versionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0');
-
- if (version_compare($versionFromBeforeUpdate, '12.0.0.14', '>')) {
- return;
- }
-
- $defaultBundle = $this->bundleFetcher->getDefaultInstallationBundle();
- foreach ($defaultBundle as $bundle) {
- try {
- $this->installer->installAppBundle($bundle);
- $output->info('Successfully installed core app bundle.');
- } catch (\Exception $e) {
- $output->warning('Could not install core app bundle: ' . $e->getMessage());
- }
- }
- }
-}
diff --git a/lib/private/Setup.php b/lib/private/Setup.php
index edbb9b33275..a14d43a65f0 100644
--- a/lib/private/Setup.php
+++ b/lib/private/Setup.php
@@ -403,14 +403,6 @@ class Setup {
// Install shipped apps and specified app bundles
Installer::installShippedApps();
- $bundleFetcher = new BundleFetcher(\OC::$server->getL10N('lib'));
- $defaultInstallationBundles = $bundleFetcher->getDefaultInstallationBundle();
- foreach ($defaultInstallationBundles as $bundle) {
- try {
- $this->installer->installAppBundle($bundle);
- } catch (Exception $e) {
- }
- }
// create empty file in data dir, so we can later find
// out that this is indeed an ownCloud data directory
diff --git a/tests/Test/Repair/Owncloud/InstallCoreBundleTest.php b/tests/Test/Repair/Owncloud/InstallCoreBundleTest.php
deleted file mode 100644
index 61be5006c41..00000000000
--- a/tests/Test/Repair/Owncloud/InstallCoreBundleTest.php
+++ /dev/null
@@ -1,142 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2017 Lukas Reschke <lukas@statuscode.ch>
- *
- * @author Lukas Reschke <lukas@statuscode.ch>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace Test\Repair\Owncloud;
-
-use OC\App\AppStore\Bundles\Bundle;
-use OC\App\AppStore\Bundles\BundleFetcher;
-use OC\Installer;
-use OC\Repair\Owncloud\InstallCoreBundle;
-use OCP\IConfig;
-use OCP\Migration\IOutput;
-use Test\TestCase;
-
-class InstallCoreBundleTest extends TestCase {
- /** @var BundleFetcher|\PHPUnit_Framework_MockObject_MockObject */
- private $bundleFetcher;
- /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */
- private $config;
- /** @var Installer|\PHPUnit_Framework_MockObject_MockObject */
- private $installer;
- /** @var InstallCoreBundle */
- private $installCoreBundle;
-
- public function setUp(): void {
- parent::setUp();
- $this->bundleFetcher = $this->createMock(BundleFetcher::class);
- $this->config = $this->createMock(IConfig::class);
- $this->installer = $this->createMock(Installer::class);
-
- $this->installCoreBundle = new InstallCoreBundle(
- $this->bundleFetcher,
- $this->config,
- $this->installer
- );
- }
-
- public function testGetName() {
- $this->assertSame('Install new core bundle components', $this->installCoreBundle->getName());
- }
-
- public function testRunOlder() {
- $this->config
- ->expects($this->once())
- ->method('getSystemValue')
- ->with('version', '0.0.0')
- ->willReturn('12.0.0.15');
- $this->bundleFetcher
- ->expects($this->never())
- ->method('getDefaultInstallationBundle');
- /** @var IOutput|\PHPUnit_Framework_MockObject_MockObject $output */
- $output = $this->createMock(IOutput::class);
- $output
- ->expects($this->never())
- ->method('info');
- $output
- ->expects($this->never())
- ->method('warning');
-
- $this->installCoreBundle->run($output);
- }
-
- public function testRunWithException() {
- $this->config
- ->expects($this->once())
- ->method('getSystemValue')
- ->with('version', '0.0.0')
- ->willReturn('12.0.0.14');
- $bundle = $this->createMock(Bundle::class);
- $this->bundleFetcher
- ->expects($this->once())
- ->method('getDefaultInstallationBundle')
- ->willReturn([
- $bundle,
- ]);
- $this->installer
- ->expects($this->once())
- ->method('installAppBundle')
- ->with($bundle)
- ->willThrowException(new \Exception('ExceptionText'));
- /** @var IOutput|\PHPUnit_Framework_MockObject_MockObject $output */
- $output = $this->createMock(IOutput::class);
- $output
- ->expects($this->never())
- ->method('info');
- $output
- ->expects($this->once())
- ->method('warning')
- ->with('Could not install core app bundle: ExceptionText');
-
- $this->installCoreBundle->run($output);
- }
-
- public function testRun() {
- $this->config
- ->expects($this->once())
- ->method('getSystemValue')
- ->with('version', '0.0.0')
- ->willReturn('12.0.0.14');
- $bundle = $this->createMock(Bundle::class);
- $this->bundleFetcher
- ->expects($this->once())
- ->method('getDefaultInstallationBundle')
- ->willReturn([
- $bundle,
- ]);
- $this->installer
- ->expects($this->once())
- ->method('installAppBundle')
- ->with($bundle);
- /** @var IOutput|\PHPUnit_Framework_MockObject_MockObject $output */
- $output = $this->createMock(IOutput::class);
- $output
- ->expects($this->once())
- ->method('info')
- ->with('Successfully installed core app bundle.');
- $output
- ->expects($this->never())
- ->method('warning');
-
- $this->installCoreBundle->run($output);
- }
-}
diff --git a/tests/lib/App/AppStore/Bundles/BundleFetcherTest.php b/tests/lib/App/AppStore/Bundles/BundleFetcherTest.php
index 55534cae699..c1fe5ef328a 100644
--- a/tests/lib/App/AppStore/Bundles/BundleFetcherTest.php
+++ b/tests/lib/App/AppStore/Bundles/BundleFetcherTest.php
@@ -22,7 +22,6 @@
namespace Test\App\AppStore\Bundles;
use OC\App\AppStore\Bundles\BundleFetcher;
-use OC\App\AppStore\Bundles\CoreBundle;
use OC\App\AppStore\Bundles\EducationBundle;
use OC\App\AppStore\Bundles\EnterpriseBundle;
use OC\App\AppStore\Bundles\GroupwareBundle;
@@ -58,16 +57,8 @@ class BundleFetcherTest extends TestCase {
$this->assertEquals($expected, $this->bundleFetcher->getBundles());
}
- public function testGetDefaultInstallationBundle() {
- $expected = [
- new CoreBundle($this->l10n),
- ];
- $this->assertEquals($expected, $this->bundleFetcher->getDefaultInstallationBundle());
- }
-
public function testGetBundleByIdentifier() {
$this->assertEquals(new EnterpriseBundle($this->l10n), $this->bundleFetcher->getBundleByIdentifier('EnterpriseBundle'));
- $this->assertEquals(new CoreBundle($this->l10n), $this->bundleFetcher->getBundleByIdentifier('CoreBundle'));
$this->assertEquals(new GroupwareBundle($this->l10n), $this->bundleFetcher->getBundleByIdentifier('GroupwareBundle'));
}
diff --git a/tests/lib/App/AppStore/Bundles/CoreBundleTest.php b/tests/lib/App/AppStore/Bundles/CoreBundleTest.php
deleted file mode 100644
index 2ace537b938..00000000000
--- a/tests/lib/App/AppStore/Bundles/CoreBundleTest.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2017 Lukas Reschke <lukas@statuscode.ch>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace Test\App\AppStore\Bundles;
-
-use OC\App\AppStore\Bundles\CoreBundle;
-
-class CoreBundleTest extends BundleBase {
- protected function setUp(): void {
- parent::setUp();
- $this->bundle = new CoreBundle($this->l10n);
- $this->bundleIdentifier = 'CoreBundle';
- $this->bundleName = 'Core bundle';
- $this->bundleAppIds = [
- 'bruteforcesettings',
- ];
- }
-}
diff --git a/tests/lib/Http/Client/ClientTest.php b/tests/lib/Http/Client/ClientTest.php
index 141c6190cd9..25d4749df57 100644
--- a/tests/lib/Http/Client/ClientTest.php
+++ b/tests/lib/Http/Client/ClientTest.php
@@ -161,6 +161,7 @@ class ClientTest extends \Test\TestCase {
['another-host.local'],
['service.localhost'],
['!@#$'], // test invalid url
+ ['normal.host.com'],
];
}
diff --git a/tests/lib/Http/Client/LocalAddressCheckerTest.php b/tests/lib/Http/Client/LocalAddressCheckerTest.php
index 9f2f6c72993..8c8e64eddf9 100644
--- a/tests/lib/Http/Client/LocalAddressCheckerTest.php
+++ b/tests/lib/Http/Client/LocalAddressCheckerTest.php
@@ -91,7 +91,7 @@ class LocalAddressCheckerTest extends \Test\TestCase {
return [
['192.168.0.1'],
['fe80::200:5aee:feaa:20a2'],
- ['0:0:0:0:0:0:10.0.0.1'],
+ ['0:0:0:0:0:ffff:10.0.0.1'],
['0:0:0:0:0:ffff:127.0.0.0'],
['10.0.0.1'],
['::'],
@@ -112,7 +112,7 @@ class LocalAddressCheckerTest extends \Test\TestCase {
['172.16.42.1'],
['[fdf8:f53b:82e4::53]/secret.ics'],
['[fe80::200:5aee:feaa:20a2]/secret.ics'],
- ['[0:0:0:0:0:0:10.0.0.1]/secret.ics'],
+ ['[0:0:0:0:0:ffff:10.0.0.1]/secret.ics'],
['[0:0:0:0:0:ffff:127.0.0.0]/secret.ics'],
['10.0.0.1'],
['another-host.local'],
@@ -121,6 +121,25 @@ class LocalAddressCheckerTest extends \Test\TestCase {
['100.100.100.200'],
['192.0.0.1'],
['randomdomain.internal'],
+ ['0177.0.0.9'],
+ ['⑯⑨。②⑤④。⑯⑨。②⑤④'],
+ ['127。②⑤④。⑯⑨.②⑤④'],
+ ['127.0.00000000000000000000000000000000001'],
+ ['127.1'],
+ ['127.000.001'],
+ ['0177.0.0.01'],
+ ['0x7f.0x0.0x0.0x1'],
+ ['0x7f000001'],
+ ['2130706433'],
+ ['00000000000000000000000000000000000000000000000000177.1'],
+ ['0x7f.1'],
+ ['127.0x1'],
+ ['[0000:0000:0000:0000:0000:0000:0000:0001]'],
+ ['[0:0:0:0:0:0:0:1]'],
+ ['[0:0:0:0::0:0:1]'],
+ ['%31%32%37%2E%30%2E%30%2E%31'],
+ ['%31%32%37%2E%30%2E%30.%31'],
+ ['[%3A%3A%31]'],
];
}
diff --git a/tests/lib/Repair/ClearGeneratedAvatarCacheTest.php b/tests/lib/Repair/ClearGeneratedAvatarCacheTest.php
index de4c6179610..71842547462 100644
--- a/tests/lib/Repair/ClearGeneratedAvatarCacheTest.php
+++ b/tests/lib/Repair/ClearGeneratedAvatarCacheTest.php
@@ -25,6 +25,7 @@ namespace Test\Repair;
use OC\Avatar\AvatarManager;
use OC\Repair\ClearGeneratedAvatarCache;
+use OCP\BackgroundJob\IJobList;
use OCP\IConfig;
use OCP\Migration\IOutput;
@@ -39,8 +40,10 @@ class ClearGeneratedAvatarCacheTest extends \Test\TestCase {
/** @var IConfig */
private $config;
- /** @var ClearGeneratedAvatarCache */
- protected $repair;
+ /** @var IJobList */
+ private $jobList;
+
+ protected ClearGeneratedAvatarCache $repair;
protected function setUp(): void {
parent::setUp();
@@ -48,8 +51,9 @@ class ClearGeneratedAvatarCacheTest extends \Test\TestCase {
$this->outputMock = $this->createMock(IOutput::class);
$this->avatarManager = $this->createMock(AvatarManager::class);
$this->config = $this->createMock(IConfig::class);
+ $this->jobList = $this->createMock(IJobList::class);
- $this->repair = new ClearGeneratedAvatarCache($this->config, $this->avatarManager);
+ $this->repair = new ClearGeneratedAvatarCache($this->config, $this->avatarManager, $this->jobList);
}
public function shouldRunDataProvider() {