diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2019-02-13 12:21:51 +0100 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2019-02-14 15:22:22 +0100 |
commit | f8a133d39e50c47dcda5685857baf465dea30104 (patch) | |
tree | 2aa2769bd218ae1b961358ec47bd7363415a83ab /apps/files_external | |
parent | 792bcb82ae5149c86afcd4d550e3a22d60d330f7 (diff) | |
download | nextcloud-server-f8a133d39e50c47dcda5685857baf465dea30104.tar.gz nextcloud-server-f8a133d39e50c47dcda5685857baf465dea30104.zip |
reject mounts with unsubstituted placeholders as incompletely configured
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/files_external')
-rw-r--r-- | apps/files_external/lib/config.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php index 2078abc029e..86be517bf03 100644 --- a/apps/files_external/lib/config.php +++ b/apps/files_external/lib/config.php @@ -240,6 +240,20 @@ class OC_Mount_Config { } foreach ($options as &$option) { $option = self::substitutePlaceholdersInConfig($option); + if(!self::arePlaceholdersSubstituted($option)) { + \OC::$server->getLogger()->error( + 'A placeholder was not substituted: {option} for mount type {class}', + [ + 'app' => 'files_external', + 'option' => $option, + 'class' => $class, + ] + ); + throw new StorageNotAvailableException( + 'Mount configuration incomplete', + StorageNotAvailableException::STATUS_INCOMPLETE_CONF + ); + } } if (class_exists($class)) { try { @@ -264,6 +278,22 @@ class OC_Mount_Config { return StorageNotAvailableException::STATUS_ERROR; } + public static function arePlaceholdersSubstituted($option):bool { + $result = true; + if(is_array($option)) { + foreach ($option as $optionItem) { + if(is_array($optionItem)) { + $result = $result && self::arePlaceholdersSubstituted($option); + } + } + } else if (is_string($option)) { + if (strpos($option, '$') !== false) { + $result = false; + } + } + return $result; + } + /** * Read the mount points in the config file into an array * |