]> source.dussan.org Git - nextcloud-server.git/commitdiff
Don't return file handle if the mode supports writing and the file is not writable
authorMichael Gapczynski <mtgap@owncloud.com>
Wed, 8 Aug 2012 15:25:24 +0000 (11:25 -0400)
committerMichael Gapczynski <mtgap@owncloud.com>
Wed, 8 Aug 2012 15:25:24 +0000 (11:25 -0400)
apps/files_sharing/sharedstorage.php

index fc0d272b54e7147e4cfad46d90920b7a9c01e1f4..05df275ca9fd112948acaeb1a2334f400a4c0148 100644 (file)
@@ -367,6 +367,25 @@ class OC_Filestorage_Shared extends OC_Filestorage_Common {
        public function fopen($path, $mode) {
                $source = $this->getSource($path);
                if ($source) {
+                       switch ($mode) {
+                               case 'r+':
+                               case 'rb+':
+                               case 'w+':
+                               case 'wb+':
+                               case 'x+':
+                               case 'xb+':
+                               case 'a+':
+                               case 'ab+':
+                               case 'w':
+                               case 'wb':
+                               case 'x':
+                               case 'xb':
+                               case 'a':
+                               case 'ab':
+                                       if (!$this->is_writable($path)) {
+                                               return false;
+                                       }
+                       }
                        $info = array(
                                'target' => $this->datadir.$path,
                                'source' => $source,