[evolution-patches] Fix for crash with Apple CalendarServer and CalDAV (bug #354855)



The attached patch fixes http://bugzilla.gnome.org/354855 , a crash when trying to use Apple's CalDAV server with the CalDAV support in evolution-data-server. The problem is present both in CVS HEAD and in the 1.8 series of e-d-s, so if the patch is OK then I think this should be applied to the stable branch as well.

The problem this patch fixes is this:
Apple's server returns a listing with URLs for calendar entries. The entries are just the path on the server, but Evolution implicitly expects a full URL. This URL is used to create a new SoapMessage, which fails if the parameter is not a full URL.
Thus the patch creates a full URL if anything else is returned from the remote server, and checks that the new SoapMessage was created successfully.

The attached patch is the same as in bug #354855, except that this patch includes a changelog entry. Anyone care to comment?
I don't have CVS write access, so if the patch is OK someone will have to commit it for me.

--
Håvard Wigtil || http://wigtil.net
? backends/caldav/.deps
? backends/caldav/.libs
? backends/caldav/e-cal-backend-caldav-factory.lo
? backends/caldav/e-cal-backend-caldav.lo
? backends/caldav/libecalbackendcaldav.la
? backends/contacts/.deps
? backends/contacts/.libs
? backends/contacts/e-cal-backend-contacts-factory.lo
? backends/contacts/e-cal-backend-contacts.lo
? backends/contacts/libecalbackendcontacts.la
? backends/file/.deps
? backends/file/.libs
? backends/file/e-cal-backend-file-events.lo
? backends/file/e-cal-backend-file-factory.lo
? backends/file/e-cal-backend-file-journal.lo
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.620
diff -u -r1.620 ChangeLog
--- ChangeLog	15 Nov 2006 07:07:59 -0000	1.620
+++ ChangeLog	15 Nov 2006 19:52:22 -0000
@@ -1,3 +1,12 @@
+2006-11-15 Håvard Wigtil <havardw pvv org>
+
+	Fixes #354855
+	* backends/caldav/e-cal-backend-caldav.c:
+	(parse_report_response): Create a full URI if a partial URI is returned
+	from the CalDAV server.
+	(caldav_server_get_object): Check that SoupMessage is created 
+	successfully.
+
 2006-11-15  Chenthill Palanisamy  <pchenthill novell com>
 
 	* libecal/e-cal-listener.c: (convert_status): Map the
Index: backends/caldav/e-cal-backend-caldav.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/caldav/e-cal-backend-caldav.c,v
retrieving revision 1.9
diff -u -r1.9 e-cal-backend-caldav.c
--- backends/caldav/e-cal-backend-caldav.c	24 Jul 2006 13:09:12 -0000	1.9
+++ backends/caldav/e-cal-backend-caldav.c	15 Nov 2006 19:52:23 -0000
@@ -625,6 +625,8 @@
 	xmlDocPtr          doc;
 	int                i, n;
 	gboolean           res;
+	char*              strtmp;
+	SoupUri*           uritmp;
 
 	g_return_val_if_fail (soup_message != NULL, FALSE);
 	g_return_val_if_fail (objs != NULL || len != NULL, FALSE);
@@ -671,6 +673,16 @@
 		xpres = xpath_eval (xpctx, XPATH_HREF, i + 1);
 		object->href = xp_object_get_string (xpres);
 
+		/* Make sure that href is an complete, absolute URI */
+		strtmp = strstr(object->href, "://");
+		if (strtmp == NULL) {
+			uritmp = soup_uri_new_with_base (soup_message_get_uri (soup_message), object->href);
+			strtmp = soup_uri_to_string (uritmp, FALSE);
+			soup_uri_free (uritmp);
+			g_free (object->href);
+			object->href = strtmp;
+		}
+
 		xpres = xpath_eval (xpctx,XPATH_STATUS , i + 1);
 		object->status = xp_object_get_status (xpres);
 
@@ -920,6 +932,11 @@
 	g_assert (object != NULL && object->href != NULL);
 	
 	message = soup_message_new (SOUP_METHOD_GET, object->href);
+
+	if (message == NULL) {
+		g_warning ("Can't create request SOUP message\n");
+		return GNOME_Evolution_Calendar_OtherError;
+	}
 	
 	soup_message_add_header (message->request_headers, 
 				 "User-Agent", "Evolution/" VERSION);

Attachment: signature.asc
Description: Dette er en digitalt signert meldingsdel



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]