diff options
author | Björn Schießle <schiessle@owncloud.com> | 2014-03-05 18:13:31 +0100 |
---|---|---|
committer | Björn Schießle <schiessle@owncloud.com> | 2014-03-05 18:13:31 +0100 |
commit | 9111af04780b547918a8661579d330d8d41c3e98 (patch) | |
tree | f0567dbdbf9a351af2da5321a895152c31d106d5 /lib | |
parent | 36fcb0fb4efd2897c1f286a04c2f46691f8ddc08 (diff) | |
parent | 2e73c957e5b3ae4030e41520088fb078354ae8b1 (diff) | |
download | nextcloud-server-9111af04780b547918a8661579d330d8d41c3e98.tar.gz nextcloud-server-9111af04780b547918a8661579d330d8d41c3e98.zip |
Merge pull request #7531 from owncloud/dont_create_shared_folder
don't allow to create a file or folder named 'Shared' in the root folder
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/connector/sabre/directory.php | 4 | ||||
-rw-r--r-- | lib/private/connector/sabre/objecttree.php | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/private/connector/sabre/directory.php b/lib/private/connector/sabre/directory.php index 02d1a9f4ba2..3ed9e94d69b 100644 --- a/lib/private/connector/sabre/directory.php +++ b/lib/private/connector/sabre/directory.php @@ -50,7 +50,7 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa */ public function createFile($name, $data = null) { - if ($name === 'Shared' && empty($this->path)) { + if (strtolower($name) === 'shared' && empty($this->path)) { throw new \Sabre_DAV_Exception_Forbidden(); } @@ -86,7 +86,7 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa */ public function createDirectory($name) { - if ($name === 'Shared' && empty($this->path)) { + if (strtolower($name) === 'shared' && empty($this->path)) { throw new \Sabre_DAV_Exception_Forbidden(); } diff --git a/lib/private/connector/sabre/objecttree.php b/lib/private/connector/sabre/objecttree.php index d2fa425b22c..accf020daa2 100644 --- a/lib/private/connector/sabre/objecttree.php +++ b/lib/private/connector/sabre/objecttree.php @@ -94,6 +94,9 @@ class ObjectTree extends \Sabre_DAV_ObjectTree { } if ($sourceDir !== $destinationDir) { // for a full move we need update privileges on sourcePath and sourceDir as well as destinationDir + if (ltrim($destinationDir, '/') === '' && strtolower($sourceNode->getName()) === 'shared') { + throw new \Sabre_DAV_Exception_Forbidden(); + } if (!$fs->isUpdatable($sourceDir)) { throw new \Sabre_DAV_Exception_Forbidden(); } |