Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-08-08 19:25:24 +0400
committerMichael Gapczynski <mtgap@owncloud.com>2012-08-08 19:25:24 +0400
commit05648dac619942dfccc76180d30fcd79364355ec (patch)
tree8169006d47b2aefc91072314f8142404803985e3
parent0bf2a3e6d6a8059c6e3180fad2e9aa55438a9406 (diff)
Don't return file handle if the mode supports writing and the file is not writable
-rw-r--r--apps/files_sharing/sharedstorage.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/apps/files_sharing/sharedstorage.php b/apps/files_sharing/sharedstorage.php
index fc0d272b54e..05df275ca9f 100644
--- a/apps/files_sharing/sharedstorage.php
+++ b/apps/files_sharing/sharedstorage.php
@@ -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,