From d24c0f4d42f679e9014e419d8d2bd5fe88ab7e42 Mon Sep 17 00:00:00 2001
From: Robin Appelman <icewind@owncloud.com>
Date: Fri, 20 Jun 2014 16:09:38 +0200
Subject: [PATCH] Dont allow opening writable streams on a read only dav mount

---
 apps/files_external/lib/webdav.php | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/apps/files_external/lib/webdav.php b/apps/files_external/lib/webdav.php
index c532c5eaa7..8536c65ace 100644
--- a/apps/files_external/lib/webdav.php
+++ b/apps/files_external/lib/webdav.php
@@ -209,8 +209,14 @@ class DAV extends \OC\Files\Storage\Common {
 					$ext = '';
 				}
 				if ($this->file_exists($path)) {
+					if (!$this->isUpdatable($path)) {
+						return false;
+					}
 					$tmpFile = $this->getCachedFile($path);
 				} else {
+					if (!$this->isCreatable(dirname($path))) {
+						return false;
+					}
 					$tmpFile = \OCP\Files::tmpFile($ext);
 				}
 				\OC\Files\Stream\Close::registerCallback($tmpFile, array($this, 'writeBack'));
-- 
GitLab