[CalendarServer-changes] [2720] CalendarServer/trunk/twistedcaldav/directory/xmlaccountsparser.py
source_changes at macosforge.org
source_changes at macosforge.org
Thu Jul 17 17:57:09 PDT 2008
Revision: 2720
http://trac.macosforge.org/projects/calendarserver/changeset/2720
Author: wsanchez at apple.com
Date: 2008-07-17 17:57:08 -0700 (Thu, 17 Jul 2008)
Log Message:
-----------
Log an error when we see an invalid GUID in XML files.
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/directory/xmlaccountsparser.py
Modified: CalendarServer/trunk/twistedcaldav/directory/xmlaccountsparser.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/xmlaccountsparser.py 2008-07-17 23:01:38 UTC (rev 2719)
+++ CalendarServer/trunk/twistedcaldav/directory/xmlaccountsparser.py 2008-07-18 00:57:08 UTC (rev 2720)
@@ -23,12 +23,16 @@
"XMLAccountsParser",
]
+from uuid import UUID
import xml.dom.minidom
from twisted.python.filepath import FilePath
from twistedcaldav.directory.directory import DirectoryService
+from twistedcaldav.log import Logger
+log = Logger()
+
ELEMENT_ACCOUNTS = "accounts"
ELEMENT_USER = "user"
ELEMENT_GROUP = "group"
@@ -221,7 +225,12 @@
self.shortName = child.firstChild.data.encode("utf-8")
elif child_name == ELEMENT_GUID:
if child.firstChild is not None:
- self.guid = child.firstChild.data.encode("utf-8")
+ guid = child.firstChild.data.encode("utf-8")
+ try:
+ UUID(guid)
+ except:
+ log.error("Invalid GUID in accounts XML: %r" % (guid,))
+ self.guid = guid
elif child_name == ELEMENT_PASSWORD:
if child.firstChild is not None:
self.password = child.firstChild.data.encode("utf-8")
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080717/ed7ab3a4/attachment.html
More information about the calendarserver-changes
mailing list