summaryrefslogtreecommitdiffstats
path: root/apps/dav
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-03-09 13:36:27 +0100
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-03-09 13:36:39 +0100
commit827c0980d800ac88f79ea6f11c77dad5bc4ca170 (patch)
tree91182de8c04323c29cbfc36b187de6898772c61d /apps/dav
parentec245d5feccc63abae3944c2ed59c99fbad3e6d7 (diff)
downloadnextcloud-server-827c0980d800ac88f79ea6f11c77dad5bc4ca170.tar.gz
nextcloud-server-827c0980d800ac88f79ea6f11c77dad5bc4ca170.zip
Prevent creation of reserved address book name
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/dav')
-rw-r--r--apps/dav/lib/CardDAV/UserAddressBooks.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/apps/dav/lib/CardDAV/UserAddressBooks.php b/apps/dav/lib/CardDAV/UserAddressBooks.php
index f3803cf1692..8b9e22db5ac 100644
--- a/apps/dav/lib/CardDAV/UserAddressBooks.php
+++ b/apps/dav/lib/CardDAV/UserAddressBooks.php
@@ -28,9 +28,12 @@ declare(strict_types=1);
namespace OCA\DAV\CardDAV;
use OCA\DAV\AppInfo\PluginManager;
+use OCA\DAV\CardDAV\Integration\ExternalAddressBook;
use OCP\IConfig;
use OCP\IL10N;
use Sabre\CardDAV\Backend;
+use Sabre\DAV\Exception\MethodNotAllowed;
+use Sabre\DAV\MkCol;
class UserAddressBooks extends \Sabre\CardDAV\AddressBookHome {
@@ -78,6 +81,14 @@ class UserAddressBooks extends \Sabre\CardDAV\AddressBookHome {
}
+ public function createExtendedCollection($name, MkCol $mkCol) {
+ if (ExternalAddressBook::doesViolateReservedName($name)) {
+ throw new MethodNotAllowed('The resource you tried to create has a reserved name');
+ }
+
+ parent::createExtendedCollection($name, $mkCol);
+ }
+
/**
* Returns a list of ACE's for this node.
*