]> source.dussan.org Git - nextcloud-server.git/commitdiff
Check if a folder is deletable before we try to recursively delete it
authorRobin Appelman <icewind@owncloud.com>
Mon, 25 Aug 2014 12:06:48 +0000 (14:06 +0200)
committerLukas Reschke <lukas@owncloud.com>
Wed, 17 Sep 2014 09:35:16 +0000 (11:35 +0200)
apps/files_external/lib/google.php
apps/files_external/lib/streamwrapper.php
apps/files_external/lib/swift.php
lib/private/files/storage/local.php
lib/private/files/storage/mappedlocal.php

index 88d82d51e2e81b0169b7d9ee762e93205f0d223e..5d238a363de010140a837ce32b202d3b27264954 100644 (file)
@@ -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)) {
index 44bd9a0161a4cf14ae8d9179a1587dbe73f40f7d..adccb2919e3c9fadc4d08204ca7e6c5a5989a1af 100644 (file)
@@ -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)) {
index 1c56d180e2f21b7d1bbaa5ce8b194cb5eb3598e5..11186a9f394785da4df1c69f337a96d6a498087a 100644 (file)
@@ -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;
                }
 
index 9df6cdef2afcdb01fd4ec40d2e4e5991258f2b68..0a612ae505b87730406806a3667e28edaa23ee45 100644 (file)
@@ -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),
index 0760d842eafff51f1114c5c44560b9cebbc670be..0a21d2938b7343b72f6aa969375053e1efb0387f 100644 (file)
@@ -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)),