From 2f38cf077b42675931b421425d3306745146a58b Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sun, 27 Jun 2010 18:56:17 +1200 Subject: [PATCH] Don't allow PUT of non-calendar/address resources into calendars/addressbooks. --- inc/caldav-PUT-default.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/inc/caldav-PUT-default.php b/inc/caldav-PUT-default.php index f18bade1..536dabb4 100644 --- a/inc/caldav-PUT-default.php +++ b/inc/caldav-PUT-default.php @@ -25,6 +25,12 @@ $lock_opener = $request->FailIfLocked(); $dest = new DAVResource($request->path); $container = $dest->FetchParentContainer(); +if ( $container->IsCalendar() ) { + $request->DoResponse( 409, translate('Incorrect content type for calendar: ') . $request->content_type ); +} +else if ( $container->IsAddressbook() ) { + $request->DoResponse( 409, translate('Incorrect content type for addressbook: ') . $request->content_type ); +} if ( ! $dest->Exists() ) { if ( $container->IsPrincipal() ) { $request->DoResponse(403,translate('A DAViCal principal collection may only contain collections'));