From b50987165e8be87dacee4715f8548cb8fcde84b7 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Wed, 9 Dec 2015 08:54:11 +0100 Subject: 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 --- lib/private/util.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'lib/private') 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('', '')) - ); + 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('', '')) + ); + } } // Check if there is a writable install folder. -- cgit v1.2.3