diff options
author | Lukas Reschke <lukas@owncloud.com> | 2015-12-09 08:54:11 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2015-12-09 08:54:11 +0100 |
commit | b50987165e8be87dacee4715f8548cb8fcde84b7 (patch) | |
tree | a1c1117dac1c0c29c2c67226f13546656feffae1 /lib/private/util.php | |
parent | dda9525c4be9f04fd2869b78ff0612c2f57f4e56 (diff) | |
download | nextcloud-server-b50987165e8be87dacee4715f8548cb8fcde84b7.tar.gz nextcloud-server-b50987165e8be87dacee4715f8548cb8fcde84b7.zip |
Add support for read only config dir
We already support the `config_is_read_only` for the config file itself. However not for the whole directory (which is a bug).
This unifies the check in the checkServer routine with the one in base.php. Now one can enable a read only config folder so that ownCloud is not allowed to overwrite it's own source code.
To test this set the whole config folder to read only, clear your session, refresh, see it fails, add the new code, refresh, see it works. Also verify that setup still works fine. (obviously setup does not work with a read only config Also verify that setup still works fine. (obviously setup does not work with a read only config))
Fixes https://github.com/owncloud/core/issues/14455
Diffstat (limited to 'lib/private/util.php')
-rw-r--r-- | lib/private/util.php | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/private/util.php b/lib/private/util.php index eb188b649e8..9016dc59751 100644 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -642,13 +642,15 @@ class OC_Util { } // Check if config folder is writable. - if (!is_writable(OC::$configDir) or !is_readable(OC::$configDir)) { - $errors[] = array( - 'error' => $l->t('Cannot write into "config" directory'), - 'hint' => $l->t('This can usually be fixed by ' - . '%sgiving the webserver write access to the config directory%s.', - array('<a href="' . $urlGenerator->linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>')) - ); + if(!OC_Helper::isReadOnlyConfigEnabled()) { + if (!is_writable(OC::$configDir) or !is_readable(OC::$configDir)) { + $errors[] = array( + 'error' => $l->t('Cannot write into "config" directory'), + 'hint' => $l->t('This can usually be fixed by ' + . '%sgiving the webserver write access to the config directory%s.', + array('<a href="' . $urlGenerator->linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>')) + ); + } } // Check if there is a writable install folder. |