]> source.dussan.org Git - nextcloud-server.git/commitdiff
Use `file_exists` to verify that config file exists
authorLukas Reschke <lukas@owncloud.com>
Mon, 26 Jan 2015 23:45:37 +0000 (00:45 +0100)
committerLukas Reschke <lukas@owncloud.com>
Mon, 26 Jan 2015 23:50:14 +0000 (00:50 +0100)
There might be the case that `fopen($file, 'r')` returns false and thus ownCloud might believe that the config file is empty and thus potentially leading to an overwrite of the config file.

This changeset introduces `file_exists` again which was used in ownCloud 5 where no such problems where reported and should not be affected by such problems.

Ref https://github.com/owncloud/core/issues/12785#issuecomment-71548720

lib/private/config.php

index 586e8c20587d86679a6741bb1824533d6bb20353..31e536221ddaeff41a994ad42b4c2e255b7fea59 100644 (file)
@@ -166,7 +166,9 @@ class Config {
                // Include file and merge config
                foreach ($configFiles as $file) {
                        $filePointer = @fopen($file, 'r');
-                       if($file === $this->configFilePath && $filePointer === false) {
+                       if($file === $this->configFilePath &&
+                               $filePointer === false &&
+                               @!file_exists($this->configFilePath)) {
                                // Opening the main config might not be possible, e.g. if the wrong
                                // permissions are set (likely on a new installation)
                                continue;