From 05648dac619942dfccc76180d30fcd79364355ec Mon Sep 17 00:00:00 2001 From: Michael Gapczynski <mtgap@owncloud.com> Date: Wed, 8 Aug 2012 11:25:24 -0400 Subject: [PATCH] Don't return file handle if the mode supports writing and the file is not writable --- apps/files_sharing/sharedstorage.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/apps/files_sharing/sharedstorage.php b/apps/files_sharing/sharedstorage.php index fc0d272b54..05df275ca9 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, -- GitLab