summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Kolab/DAV/Collection.php16
-rw-r--r--public_html/index.php8
2 files changed, 24 insertions, 0 deletions
diff --git a/lib/Kolab/DAV/Collection.php b/lib/Kolab/DAV/Collection.php
index e391162..1a08d1d 100644
--- a/lib/Kolab/DAV/Collection.php
+++ b/lib/Kolab/DAV/Collection.php
@@ -95,6 +95,11 @@ class Collection extends \Kolab\DAV\Node implements \Sabre\DAV\ICollection
*/
public function getChild($name)
{
+ // no support for hidden system files
+ if ($name[0] == '.') {
+ throw new \Sabre\DAV\Exception\NotFound('File not found: ' . $name);
+ }
+
// @TODO: optimise this?
foreach ($this->getChildren() as $child) {
if ($child->getName() == $name) {
@@ -150,6 +155,11 @@ class Collection extends \Kolab\DAV\Node implements \Sabre\DAV\ICollection
*/
public function createFile($name, $data = null)
{
+ // no support for hidden system files
+ if ($name[0] == '.') {
+ throw new \Sabre\DAV\Exception\Forbidden('Hidden files are not accepted');
+ }
+
$filename = $this->path . '/' . $name;
$filedata = $this->fileData($name, $data);
@@ -173,6 +183,11 @@ class Collection extends \Kolab\DAV\Node implements \Sabre\DAV\ICollection
*/
public function createDirectory($name)
{
+ // no support for hidden system files
+ if ($name[0] == '.') {
+ throw new \Sabre\DAV\Exception\Forbidden('Hidden files are not accepted');
+ }
+
$folder = $this->path . '/' . $name;
try {
@@ -185,4 +200,5 @@ class Collection extends \Kolab\DAV\Node implements \Sabre\DAV\ICollection
// reset cache
$this->children = null;
}
+
}
diff --git a/public_html/index.php b/public_html/index.php
index d201ed8..f9c86b4 100644
--- a/public_html/index.php
+++ b/public_html/index.php
@@ -129,6 +129,14 @@ $caldav_plugin = new \Kolab\CalDAV\Plugin();
$caldav_plugin->setIMipHandler(new \Kolab\CalDAV\IMip());
$server->addPlugin($caldav_plugin);
+// the lock manager is reponsible for making sure users don't overwrite each others changes.
+// TODO: replace this with a class that manages locks in the Kolab backend
+$locks_backend = new \Sabre\DAV\Locks\Backend\File(KOLAB_DAV_ROOT . '/temp/locks');
+$server->addPlugin(new \Sabre\DAV\Locks\Plugin($locks_backend));
+
+// intercept some of the garbage files operation systems tend to generate when mounting a WebDAV share
+$server->addPlugin(new \Sabre\DAV\TemporaryFileFilterPlugin(KOLAB_DAV_ROOT . '/temp'));
+
// HTML UI for browser-based access (recommended only for development)
$server->addPlugin(new \Sabre\DAV\Browser\Plugin());