From ffb55d5a17dc3a72b33d9ad2cedc0682e1caa567 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 Conflicts: apps/files_sharing/sharedstorage.php --- 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 8b19338283..a2dfe34402 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); } -- GitLab