Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Incorrect handling of double quotes and backslashes via CalDAV

23 views
Skip to first unread message

Simon

unread,
Oct 21, 2009, 11:40:22 AM10/21/09
to
Hello,

the following Problem shows up, when using Lightning together with
eGroupware and CalDAV:

Lightning is configured to use a network-calendar of egroupware via CalDAV.
When events are created in Lightning, which contain double quotes or
backslashes in their description field, these characters get
"escaped" with another backslash, before they are transmited to
eGroupware. i.e.:

" results to: \"
\ results to: \\

No, Problem so far, but when the mentioned event gets modified,
accepted, denied etc. newly added backslashes are escaped again, i.e.:

\" results to: \\"
\\ results to: \\\

After some more modifications of the even the problem get even worse:#

\\" -> \\\" -> \\\\" -> ... -> \\\\\\\\\\\\\\\\\\\\\\\\\\\"

\\\ -> \\\\ -> \\\\\ -> ... -> \\\\\\\\\\\\\\\\\\\\\\\\\\\\


At the end the bloating backslashes in the decription field caused
malfunctions of the eGroupware database restore mechanism.

Php magic_quotes are disabled on the egroupware server.

After having some dicussions in the egroupware support forum, the
egroupware developers assume that it's a client problem.
When using the eGroupware-Server with an iPhone as CalDAV-client
everything works fine, which seems to support the assumption.

Has anybody else noticed the described problem or is there any known
solution to it?

Regards,

Simon


Stefan Sitter

unread,
Oct 21, 2009, 1:04:43 PM10/21/09
to
What Lightning version did you used for testing?

You can set the advanced preferences "calendar.debug.log" (and maybe
"calendar.debug.log.verbose" too) to true and check the Error
Console. Maybe the logging of the event gives a hint when and where
the backslashes are added.

Stefan

D.Simon

unread,
Oct 22, 2009, 10:41:54 AM10/22/09
to
Stefan Sitter schrieb:

I was testing the offical Lightning 0.9 release, as well as a special
Lightning-version from the
"SOGo"-Groupware-Project(http://www.scalableogo.org/downloads/frontends.html)
and the offical Sunbird 0.9 release.
All 32-bit versions, from offical websites and tested under Ubuntu 9.04
32-bit and Windows XP (except Sunbird).


Debugging showed the following results:

Adding an event to the CalDAV-Calendar with the description field:

"
""
\
\\

caused the following Error Console messages:

CalDAV: send: BEGIN:VCALENDAR
PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN
VERSION:2.0
BEGIN:VTIMEZONE
TZID:Europe/Berlin
X-LIC-LOCATION:Europe/Berlin
BEGIN:DAYLIGHT
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
TZNAME:CEST
DTSTART:19700329T020000
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3
END:DAYLIGHT
BEGIN:STANDARD
ZOFFSETFROM:+0200
TZOFFSETTO:+0100
TZNAME:CET
DTSTART:19701025T030000
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
CREATED:20091021T175351Z
LAST-MODIFIED:20091021T175423Z
DTSTAMP:20091021T175423Z
UID:984271a2-254a-4e5f-90e9-f22520a6f5c0
SUMMARY:Test Event
DTSTART;TZID=Europe/Berlin:20091101T200000
DTEND;TZID=Europe/Berlin:20091101T210000
LOCATION:Initial
DESCRIPTION:\"\n\"\"\n\\\n\\\\
X-MOZ-GENERATION:1
END:VEVENT
END:VCALENDAR


CalDAV: recv:


CalDAV: Item added successfully


CalDAV: send: <calendar-multiget xmlns:D="DAV:"
xmlns="urn:ietf:params:xml:ns:caldav">
<D:prop>
<D:getetag/>
<calendar-data/>
</D:prop>

<D:href>/egroupware/groupdav.php/calendar/984271a2-254a-4e5f-90e9-f22520a6f5c0.ics</D:href>
</calendar-multiget>


CalDAV: send: <?xml version="1.0" encoding="UTF-8"?>
<calendar-multiget xmlns:D="DAV:" xmlns="urn:ietf:params:xml:ns:caldav">
<D:prop>
<D:getetag/>
<calendar-data/>
</D:prop>


<D:href>/egroupware/groupdav.php/calendar/984271a2-254a-4e5f-90e9-f22520a6f5c0.ics</D:href>
</calendar-multiget>


CalDAV: Status 207 fetching calendar-data for calendar eGW


CalDAV: recv: <?xml version="1.0" encoding="utf-8"?>
<D:multistatus xmlns:D="DAV:">
<D:response xmlns:ns0="urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/"
xmlns:ns1="urn:ietf:params:xml:ns:caldav">

<D:href>https://extmail.ppc-ag.de/egroupware/groupdav.php/calendar/4232.ics</D:href>
<D:propstat>
<D:prop>
<D:getetag>4232:0:c8ac859fad4a2ad802b94144eb7e79e7</D:getetag>
<ns1:calendar-data>BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//eGroupWare//NONSGML eGroupWare Calendar 1.6//DE
METHOD:PUBLISH
BEGIN:VEVENT
CLASS:PUBLIC
SUMMARY:Test Event
DESCRIPTION:\\&quot;\n\\&quot;\\&quot;\n\\\n\\\\
LOCATION:Initial
DTSTART:20091101T190000Z
DTEND:20091101T200000Z
PRIORITY:5
TRANSP:OPAQUE
UID:984271a2-254a-4e5f-90e9-f22520a6f5c0
CREATED:20091021T175418Z
LAST-MODIFIED:20091021T175418Z
DTSTAMP:20091021T175418Z
END:VEVENT
END:VCALENDAR
</ns1:calendar-data>
</D:prop>
<D:status>HTTP/1.1 200 OK</D:status>
</D:propstat>
</D:response>
</D:multistatus>


refresh completed with status 207 at
https://domain.tld/egroupware/groupdav.php/calendar/

So Lightning seems to send the description field with escaped double
quotes and backslashes.

The next time the event is edited (changed location field in this
example) Lightning sends the following description field:

CalDAV: send: BEGIN:VCALENDAR
...
DESCRIPTION:\\\"\n\\\"\\\"\n\\\n\\\\
...
END:VCALENDAR

and receives:

CalDAV: recv: <?xml version="1.0" encoding="utf-8"?>
...
DESCRIPTION:\\\\&quot;\n\\\\&quot;\\\\&quot;\n\\\n\\\\
...
END:VCALENDAR


Editing the event a second time resuls in:

CalDAV: send: BEGIN:VCALENDAR
...
DESCRIPTION:\\\\\"\n\\\\\"\\\\\"\n\\\n\\\\
...
END:VCALENDAR

and

CalDAV: recv: <?xml version="1.0" encoding="utf-8"?>
...
DESCRIPTION:\\\\\\&quot;\n\\\\\\&quot;\\\\\\&quot;\n\\\n\\\\
...
END:VCALENDAR


So every time the event is sent, it gets escaped one more time...

Any ideas how to change that behaviour?

Best regards,

Simon


Stefan Sitter

unread,
Oct 22, 2009, 12:45:13 PM10/22/09
to
D.Simon schrieb:

From a first look it seems the server sends the event already back
wrong?

1st send from Lightning, " and \ are encoded:

> DESCRIPTION:\"\n\"\"\n\\\n\\\\

I translate this to:
> "
> ""
> \
> \\

1st fetch from the server responds a double encoded string:

> DESCRIPTION:\\&quot;\n\\&quot;\\&quot;\n\\\n\\\\

I translate this to:
> \"
> \"\"
> \
> \\

Or do I understand it wrong?

Stefan

Stefan Sitter

unread,
Oct 22, 2009, 12:57:06 PM10/22/09
to
Stefan Sitter schrieb:

Looking at the iCalendar specification for TEXT data type it says
that \ should be encoded to \\:

http://tools.ietf.org/html/draft-ietf-calsify-rfc2445bis-10#section-3.3.11

> ESCAPED-CHAR = ("\\" / "\;" / "\," / "\N" / "\n")
> ; \\ encodes \, \N or \n encodes newline
> ; \; encodes ;, \, encodes ,

But given the example for DESCRIPTION property it seems that " must
not be encoded:

http://tools.ietf.org/html/draft-ietf-calsify-rfc2445bis-10#section-3.8.1.5

> Example: The following is an example of this property with formatted
> line breaks in the property value:
>
> DESCRIPTION:Meeting to provide technical review for "Phoenix"
> design.\nHappy Face Conference Room. Phoenix design team
> MUST attend this meeting.\nRSVP to team leader.

Stefan

gNeandr

unread,
Oct 22, 2009, 1:24:22 PM10/22/09
to
I remember we have had a discussion about this before. And AFAIR the
"SOGo"-Groupware was the cause of it all.
Maybe Daniel Boelzle can help here .. if he is available for a comment
Gᅵnter

Stefan Sitter

unread,
Oct 22, 2009, 2:07:55 PM10/22/09
to
gNeandr wrote:

> Stefan Sitter wrote:
>> But given the example for DESCRIPTION property it seems that "
>> must not be encoded:
> I remember we have had a discussion about this before. And AFAIR
> the "SOGo"-Groupware was the cause of it all. Maybe Daniel
> Boelzle can help here .. if he is available for a comment

I filed Bug 523860 for the double quote. Let's see what happens.
https://bugzilla.mozilla.org/show_bug.cgi?id=523860

0 new messages