summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2014-08-25 14:06:48 +0200
committerLukas Reschke <lukas@owncloud.com>2014-09-17 11:35:16 +0200
commitd25a9a118f7824a72f193d57373355e51323f118 (patch)
tree4606bdc2487dac92c30ad117755c89cc13f91b6b
parentab79caf29bf4173e15f9dad00a206c6bb1f3999c (diff)
downloadnextcloud-server-d25a9a118f7824a72f193d57373355e51323f118.tar.gz
nextcloud-server-d25a9a118f7824a72f193d57373355e51323f118.zip
Check if a folder is deletable before we try to recursively delete it
-rw-r--r--apps/files_external/lib/google.php3
-rw-r--r--apps/files_external/lib/streamwrapper.php2
-rw-r--r--apps/files_external/lib/swift.php2
-rw-r--r--lib/private/files/storage/local.php3
-rw-r--r--lib/private/files/storage/mappedlocal.php3
5 files changed, 11 insertions, 2 deletions
diff --git a/apps/files_external/lib/google.php b/apps/files_external/lib/google.php
index 88d82d51e2e..5d238a363de 100644
--- a/apps/files_external/lib/google.php
+++ b/apps/files_external/lib/google.php
@@ -204,6 +204,9 @@ class Google extends \OC\Files\Storage\Common {
}
public function rmdir($path) {
+ if (!$this->isDeletable($path)) {
+ return false;
+ }
if (trim($path, '/') === '') {
$dir = $this->opendir($path);
if(is_resource($dir)) {
diff --git a/apps/files_external/lib/streamwrapper.php b/apps/files_external/lib/streamwrapper.php
index 44bd9a0161a..adccb2919e3 100644
--- a/apps/files_external/lib/streamwrapper.php
+++ b/apps/files_external/lib/streamwrapper.php
@@ -21,7 +21,7 @@ abstract class StreamWrapper extends Common {
}
public function rmdir($path) {
- if ($this->file_exists($path)) {
+ if ($this->file_exists($path) and $this->isDeletable($path)) {
$dh = $this->opendir($path);
while (($file = readdir($dh)) !== false) {
if ($this->is_dir($path . '/' . $file)) {
diff --git a/apps/files_external/lib/swift.php b/apps/files_external/lib/swift.php
index 1c56d180e2f..11186a9f394 100644
--- a/apps/files_external/lib/swift.php
+++ b/apps/files_external/lib/swift.php
@@ -187,7 +187,7 @@ class Swift extends \OC\Files\Storage\Common {
public function rmdir($path) {
$path = $this->normalizePath($path);
- if (!$this->is_dir($path)) {
+ if (!$this->is_dir($path) or !$this->isDeletable($path)) {
return false;
}
diff --git a/lib/private/files/storage/local.php b/lib/private/files/storage/local.php
index 9df6cdef2af..0a612ae505b 100644
--- a/lib/private/files/storage/local.php
+++ b/lib/private/files/storage/local.php
@@ -39,6 +39,9 @@ if (\OC_Util::runningOnWindows()) {
}
public function rmdir($path) {
+ if (!$this->isDeletable($path)) {
+ return false;
+ }
try {
$it = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator($this->datadir . $path),
diff --git a/lib/private/files/storage/mappedlocal.php b/lib/private/files/storage/mappedlocal.php
index 0760d842eaf..0a21d2938b7 100644
--- a/lib/private/files/storage/mappedlocal.php
+++ b/lib/private/files/storage/mappedlocal.php
@@ -38,6 +38,9 @@ class MappedLocal extends \OC\Files\Storage\Common {
}
public function rmdir($path) {
+ if (!$this->isDeletable($path)) {
+ return false;
+ }
try {
$it = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator($this->buildPath($path)),