[CalendarServer-changes] [14651] CalendarServer/trunk/txdav/caldav/datastore/scheduling
source_changes at macosforge.org
source_changes at macosforge.org
Thu Apr 2 13:29:04 PDT 2015
Revision: 14651
http://trac.calendarserver.org//changeset/14651
Author: cdaboo at apple.com
Date: 2015-04-02 13:29:03 -0700 (Thu, 02 Apr 2015)
Log Message:
-----------
Rename and change the UID of an unscheduled event, if a scheduled one with the same UID is delivered via iTIP.
Modified Paths:
--------------
CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py
CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_implicit.py
Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py 2015-04-02 20:28:05 UTC (rev 14650)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py 2015-04-02 20:29:03 UTC (rev 14651)
@@ -366,6 +366,24 @@
log.debug("ImplicitProcessing - originator '%s' to recipient '%s' ignoring UID: '%s' - organizer has no copy" % (self.originator.cuaddr, self.recipient.cuaddr, self.uid))
raise ImplicitProcessorException("5.3;Organizer change not allowed")
+ # For a missing existing organizer we don't know for sure that the existing event came from the originator - it could be spoofed
+ # by the originator to have the same UID as the existing event which it would overwrite. Instead what we will do is rename and
+ # change the UID of the original event to preserve it and let the user resolve the "duplicate" conflict that results.
+ if not existing_organizer:
+ # Copy the raw (including per-user) data of the original, change its UID and write out a new resource
+ changed_calendar = (yield self.recipient_calendar_resource.component()).duplicate()
+ changed_calendar.replacePropertyInAllComponents(Property("UID", str(uuid.uuid4())))
+ name = "%s-%s.ics" % (hashlib.md5(changed_calendar.resourceUID()).hexdigest(), str(uuid.uuid4())[:8],)
+ yield self.recipient_calendar_resource.parentCollection()._createCalendarObjectWithNameInternal(name, changed_calendar, ComponentUpdateState.RAW)
+
+ # Delete the original resource
+ yield self.recipient_calendar_resource.remove(implicitly=False, bypassTrash=True)
+
+ # Reset state to make it look like a new iTIP being processed
+ self.recipient_calendar = None
+ self.recipient_calendar_resource = None
+ self.new_resource = True
+
# Handle splitting of data early so we can preserve per-attendee data
if self.message.hasProperty("X-CALENDARSERVER-SPLIT-OLDER-UID"):
if config.Scheduling.Options.Splitting.Enabled:
Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_implicit.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_implicit.py 2015-04-02 20:28:05 UTC (rev 14650)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/test/test_implicit.py 2015-04-02 20:29:03 UTC (rev 14651)
@@ -2018,9 +2018,15 @@
yield cobj.setComponent(Component.fromString(self.organizer_update_data))
yield self.commit()
- cobj = yield self.calendarObjectUnderTest(home="user02", name="attendee2.ics")
- comp = yield cobj.component()
- self.assertTrue(comp.getOrganizer() is not None)
+ cal = yield self.calendarUnderTest(home="user02")
+ cobjs = yield cal.calendarObjects()
+ self.assertTrue(len(cobjs) == 2)
+ for cobj in cobjs:
+ comp = yield cobj.component()
+ if comp.resourceUID() == "event1 at ninevah.local":
+ self.assertTrue(comp.getOrganizer() is not None)
+ else:
+ self.assertTrue(comp.getOrganizer() is None)
inbox = yield self.calendarUnderTest(home="user02", name="inbox")
cobjs = yield inbox.calendarObjects()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150402/4b6b4d5f/attachment-0001.html>
More information about the calendarserver-changes
mailing list