[CalendarServer-changes] [8766] CalendarServer/trunk/calendarserver/tools/calverify.py
source_changes at macosforge.org
source_changes at macosforge.org
Mon Feb 27 18:12:51 PST 2012
Revision: 8766
http://trac.macosforge.org/projects/calendarserver/changeset/8766
Author: cdaboo at apple.com
Date: 2012-02-27 18:12:51 -0800 (Mon, 27 Feb 2012)
Log Message:
-----------
Detect calendar users addresses using http URLs. Allow part uuid's to be used to match a range.
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tools/calverify.py
Modified: CalendarServer/trunk/calendarserver/tools/calverify.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/calverify.py 2012-02-24 18:48:52 UTC (rev 8765)
+++ CalendarServer/trunk/calendarserver/tools/calverify.py 2012-02-28 02:12:51 UTC (rev 8766)
@@ -53,7 +53,8 @@
from twisted.python.text import wordWrap
from twisted.python.usage import Options
from twistedcaldav.dateops import pyCalendarTodatetime
-from twistedcaldav.ical import Component
+from twistedcaldav.ical import Component, ignoredComponents,\
+ InvalidICalendarDataError
from twistedcaldav.stdconfig import DEFAULT_CONFIG_FILE
from txdav.common.datastore.sql_tables import schema, _BIND_MODE_OWN
from txdav.common.icommondatastore import InternalDataStoreError
@@ -350,6 +351,10 @@
cb = schema.CALENDAR_BIND
ch = schema.CALENDAR_HOME
kwds = {"uuid": uuid}
+ if len(uuid) != 36:
+ where = (ch.OWNER_UID.StartsWith(Parameter("uuid")))
+ else:
+ where = (ch.OWNER_UID == Parameter("uuid"))
rows = (yield Select(
[ch.OWNER_UID, co.RESOURCE_ID, co.ICALENDAR_UID, co.MD5, co.ORGANIZER,],
From=ch.join(
@@ -357,7 +362,7 @@
co, type="inner", on=(cb.CALENDAR_RESOURCE_ID == co.CALENDAR_RESOURCE_ID).And(
cb.BIND_MODE == _BIND_MODE_OWN).And(
cb.CALENDAR_RESOURCE_NAME != "inbox")),
- Where=(ch.OWNER_UID == Parameter("uuid")),
+ Where=where,
GroupBy=(ch.OWNER_UID, co.RESOURCE_ID, co.ICALENDAR_UID, co.MD5, co.ORGANIZER,),
).on(self.txn, **kwds))
returnValue(tuple(rows))
@@ -485,6 +490,7 @@
component.validCalendarData(doFix=False, validateRecurrences=True)
component.validCalendarForCalDAV(methodAllowed=False)
component.validOrganizerForScheduling(doFix=False)
+ self.noPrincipalPathCUAddresses(component, doFix=False)
except ValueError, e:
result = False
message = str(e)
@@ -502,6 +508,18 @@
returnValue((result, message,))
+ def noPrincipalPathCUAddresses(self, component, doFix):
+
+ for subcomponent in component.subcomponents():
+ if subcomponent.name() in ignoredComponents:
+ continue
+ organizer = subcomponent.getProperty("ORGANIZER")
+ if organizer and organizer.value().startswith("http"):
+ raise InvalidICalendarDataError("iCalendar ORGANIZER starts with 'http(s)'")
+ for attendee in subcomponent.properties("ATTENDEE"):
+ if attendee.value().startswith("http"):
+ raise InvalidICalendarDataError("iCalendar ATTENDEE starts with 'http(s)'")
+
@inlineCallbacks
def fixCalendarData(self, resid):
"""
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120227/8e83361d/attachment.html>
More information about the calendarserver-changes
mailing list