]> source.dussan.org Git - nextcloud-server.git/commitdiff
do onetime user setup before getting any mount from providers 37394/head
authorRobin Appelman <robin@icewind.nl>
Wed, 22 Feb 2023 17:03:38 +0000 (18:03 +0100)
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>
Fri, 24 Mar 2023 16:10:29 +0000 (16:10 +0000)
this fixes a race condition where wrappers weren't properly applied if when a mount provider creates the storage instance one mountpoint creation instead of lazily

Signed-off-by: Robin Appelman <robin@icewind.nl>
lib/private/Files/SetupManager.php

index 4cbd0328d769351d16180ed953ad43a76b273aba..01ce4a1cc59923c44c4d9ab8630b494443bb956f 100644 (file)
@@ -235,11 +235,13 @@ class SetupManager {
         * part of the user setup that is run only once per user
         */
        private function oneTimeUserSetup(IUser $user) {
-               if (in_array($user->getUID(), $this->setupUsers, true)) {
+               if ($this->isSetupStarted($user)) {
                        return;
                }
                $this->setupUsers[] = $user->getUID();
 
+               $this->setupRoot();
+
                $this->eventLogger->start('fs:setup:user:onetime', 'Onetime filesystem for user');
 
                $this->setupBuiltinWrappers();
@@ -319,11 +321,7 @@ class SetupManager {
         * @throws \OC\ServerNotAvailableException
         */
        private function setupForUserWith(IUser $user, callable $mountCallback): void {
-               $this->setupRoot();
-
-               if (!$this->isSetupStarted($user)) {
-                       $this->oneTimeUserSetup($user);
-               }
+               $this->oneTimeUserSetup($user);
 
                if ($this->lockdownManager->canAccessFilesystem()) {
                        $mountCallback();
@@ -422,9 +420,7 @@ class SetupManager {
                        return;
                }
 
-               if (!$this->isSetupStarted($user)) {
-                       $this->oneTimeUserSetup($user);
-               }
+               $this->oneTimeUserSetup($user);
 
                $this->eventLogger->start('fs:setup:user:path', "Setup $path filesystem for user");
                $this->eventLogger->start('fs:setup:user:path:find', "Find mountpoint for $path");
@@ -513,6 +509,8 @@ class SetupManager {
 
                $this->eventLogger->start('fs:setup:user:providers', "Setup filesystem for " . implode(', ', $providers));
 
+               $this->oneTimeUserSetup($user);
+
                // home providers are always used
                $providers = array_filter($providers, function (string $provider) {
                        return !is_subclass_of($provider, IHomeMountProvider::class);