summaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-03-04 16:42:40 +0100
committerBjoern Schiessle <schiessle@owncloud.com>2014-03-05 13:16:25 +0100
commit2e73c957e5b3ae4030e41520088fb078354ae8b1 (patch)
tree7c6243510a969fc370141f452f3e8575b09db316 /lib/private
parent79ae3c4527b492bee76b2951ca14e8259147b181 (diff)
downloadnextcloud-server-2e73c957e5b3ae4030e41520088fb078354ae8b1.tar.gz
nextcloud-server-2e73c957e5b3ae4030e41520088fb078354ae8b1.zip
don't allow to create a file or folder named 'Shared' in the root folder, also exclude all combinations of lower and upper case letters
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/connector/sabre/directory.php4
-rw-r--r--lib/private/connector/sabre/objecttree.php3
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();
}