summaryrefslogtreecommitdiffstats
path: root/lib/private/config.php
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2015-01-27 00:45:37 +0100
committerLukas Reschke <lukas@owncloud.com>2015-01-27 00:50:14 +0100
commit17f2cfbb9c6edeeab3e29718209eb88946335d55 (patch)
tree6fc00f473007f7877dfe558ad2693fbfa97bdff0 /lib/private/config.php
parent5da4071c4553b5ee64799856e4db58e9484d9839 (diff)
downloadnextcloud-server-17f2cfbb9c6edeeab3e29718209eb88946335d55.tar.gz
nextcloud-server-17f2cfbb9c6edeeab3e29718209eb88946335d55.zip
Use `file_exists` to verify that config file exists
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
Diffstat (limited to 'lib/private/config.php')
-rw-r--r--lib/private/config.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/private/config.php b/lib/private/config.php
index 586e8c20587..31e536221dd 100644
--- a/lib/private/config.php
+++ b/lib/private/config.php
@@ -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;