[evolution-data-server] Bug #644532 - Crash when opening ESource with local:/system URI



commit 1443076ae96133f7046f7ea96cb39352f0ca4508
Author: Milan Crha <mcrha redhat com>
Date:   Mon Mar 14 11:21:14 2011 +0100

    Bug #644532 - Crash when opening ESource with local:/system URI

 addressbook/libedata-book/e-data-book-factory.c |   12 ++++++++++++
 calendar/libedata-cal/e-data-cal-factory.c      |    5 ++++-
 libedataserver/e-source.c                       |    2 +-
 3 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/addressbook/libedata-book/e-data-book-factory.c b/addressbook/libedata-book/e-data-book-factory.c
index b034d87..b8aa145 100644
--- a/addressbook/libedata-book/e-data-book-factory.c
+++ b/addressbook/libedata-book/e-data-book-factory.c
@@ -326,6 +326,18 @@ impl_BookFactory_getBook (EGdbusBookFactory *object, GDBusMethodInvocation *invo
 
 	uri = e_source_get_uri (source);
 
+	if (!uri || !*uri) {
+		g_mutex_unlock (priv->backends_lock);
+		g_object_unref (source);
+		g_free (uri);
+
+		error = g_error_new (E_DATA_BOOK_ERROR, E_DATA_BOOK_STATUS_NO_SUCH_BOOK, _("Empty URI"));
+		g_dbus_method_invocation_return_gerror (invocation, error);
+		g_error_free (error);
+
+		return TRUE;
+	}
+
 	g_mutex_lock (priv->books_lock);
 	backend = g_hash_table_lookup (priv->backends, uri);
 
diff --git a/calendar/libedata-cal/e-data-cal-factory.c b/calendar/libedata-cal/e-data-cal-factory.c
index 26c6d6a..f675940 100644
--- a/calendar/libedata-cal/e-data-cal-factory.c
+++ b/calendar/libedata-cal/e-data-cal-factory.c
@@ -359,7 +359,7 @@ impl_CalFactory_getCal (EGdbusCalFactory *object, GDBusMethodInvocation *invocat
 	if (!str_uri) {
 		g_object_unref (source);
 
-		error = g_error_new (E_DATA_CAL_ERROR, NoSuchCal, _("Invalid source"));
+		error = g_error_new (E_DATA_CAL_ERROR, NoSuchCal, _("Empty URI"));
 		g_dbus_method_invocation_return_gerror (invocation, error);
 		g_error_free (error);
 
@@ -369,6 +369,9 @@ impl_CalFactory_getCal (EGdbusCalFactory *object, GDBusMethodInvocation *invocat
 	/* Parse the uri */
 	uri = e_uri_new (str_uri);
 	if (!uri) {
+		g_object_unref (source);
+		g_free (str_uri);
+
 		error = g_error_new (E_DATA_CAL_ERROR, NoSuchCal, _("Invalid URI"));
 		g_dbus_method_invocation_return_gerror (invocation, error);
 		g_error_free (error);
diff --git a/libedataserver/e-source.c b/libedataserver/e-source.c
index 8886892..f19cb05 100644
--- a/libedataserver/e-source.c
+++ b/libedataserver/e-source.c
@@ -373,7 +373,7 @@ e_source_update_from_xml_node (ESource *source,
 
 		if (relative_uri && g_str_equal ((const gchar *) relative_uri, "system") &&
 		    (g_str_has_prefix ((const gchar *) absolute_uri, "file:") || g_str_equal ((const gchar *) absolute_uri, "local:/system")))
-			source->priv->absolute_uri = NULL;
+			source->priv->absolute_uri = g_strdup ("local:system");
 		else
 			source->priv->absolute_uri = g_strdup ((gchar *)absolute_uri);
 		changed = TRUE;



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