summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-08-08 11:25:24 -0400
committerJörn Friedrich Dreyer <jfd@butonic.de>2012-08-24 14:58:48 +0200
commitffb55d5a17dc3a72b33d9ad2cedc0682e1caa567 (patch)
tree8ef27638d9a989e29d9acc603b4f07ea9e70022a /apps/files_sharing
parent360c22fd2821ed440089d7899d4c6680a0676410 (diff)
downloadnextcloud-server-ffb55d5a17dc3a72b33d9ad2cedc0682e1caa567.tar.gz
nextcloud-server-ffb55d5a17dc3a72b33d9ad2cedc0682e1caa567.zip
Don't return file handle if the mode supports writing and the file is not writable
Conflicts: apps/files_sharing/sharedstorage.php
Diffstat (limited to 'apps/files_sharing')
-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 8b193382838..a2dfe34402f 100644
--- a/apps/files_sharing/sharedstorage.php
+++ b/apps/files_sharing/sharedstorage.php
@@ -416,6 +416,25 @@ class OC_Filestorage_Shared extends OC_Filestorage {
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;
+ }
+ }
$storage = OC_Filesystem::getStorage($source);
return $storage->fopen($this->getInternalPath($source), $mode);
}