diff options
author | Robin McCorkell <rmccorkell@owncloud.com> | 2015-08-25 14:51:47 +0100 |
---|---|---|
committer | Robin McCorkell <rmccorkell@owncloud.com> | 2015-08-25 16:14:31 +0100 |
commit | 63218ec098655f9d7630b16394818746736d2f77 (patch) | |
tree | a8d30094e5fc26e5c23e3e48b811ad1266a0752b /apps | |
parent | 494c1d741798874c865b76fcf6918c978f944257 (diff) | |
download | nextcloud-server-63218ec098655f9d7630b16394818746736d2f77.tar.gz nextcloud-server-63218ec098655f9d7630b16394818746736d2f77.zip |
Prevent objectstore being set from client side
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_external/controller/storagescontroller.php | 10 | ||||
-rw-r--r-- | apps/files_external/service/storagesservice.php | 8 |
2 files changed, 16 insertions, 2 deletions
diff --git a/apps/files_external/controller/storagescontroller.php b/apps/files_external/controller/storagescontroller.php index 3d91af8bd8f..613f22c0331 100644 --- a/apps/files_external/controller/storagescontroller.php +++ b/apps/files_external/controller/storagescontroller.php @@ -138,6 +138,16 @@ abstract class StoragesController extends Controller { ); } + if ($storage->getBackendOption('objectstore')) { + // objectstore must not be sent from client side + return new DataResponse( + array( + 'message' => (string)$this->l10n->t('Objectstore forbidden') + ), + Http::STATUS_UNPROCESSABLE_ENTITY + ); + } + /** @var Backend */ $backend = $storage->getBackend(); /** @var AuthMechanism */ diff --git a/apps/files_external/service/storagesservice.php b/apps/files_external/service/storagesservice.php index 3e2152741e5..947e544d88f 100644 --- a/apps/files_external/service/storagesservice.php +++ b/apps/files_external/service/storagesservice.php @@ -472,10 +472,14 @@ abstract class StoragesService { if (!isset($allStorages[$id])) { throw new NotFoundException('Storage with id "' . $id . '" not found'); } - $oldStorage = $allStorages[$id]; - $allStorages[$id] = $updatedStorage; + // ensure objectstore is persistent + if ($objectstore = $oldStorage->getBackendOption('objectstore')) { + $updatedStorage->setBackendOption('objectstore', $objectstore); + } + + $allStorages[$id] = $updatedStorage; $this->writeConfig($allStorages); $this->triggerChangeHooks($oldStorage, $updatedStorage); |