[evolution-data-server/email-factory] Bug #644532 - Crash when opening ESource with local:/system URI (cherry picked from commit 1443076ae



commit a9f507a15fba6fdc339012f805b4bf9ba626e3d8
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
    (cherry picked from commit 1443076ae96133f7046f7ea96cb39352f0ca4508)

 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 77e7379..310ee2b 100644
--- a/addressbook/libedata-book/e-data-book-factory.c
+++ b/addressbook/libedata-book/e-data-book-factory.c
@@ -323,6 +323,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 72617e3..a69e323 100644
--- a/calendar/libedata-cal/e-data-cal-factory.c
+++ b/calendar/libedata-cal/e-data-cal-factory.c
@@ -355,7 +355,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);
 
@@ -365,6 +365,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 e5a8f54..b70281d 100644
--- a/libedataserver/e-source.c
+++ b/libedataserver/e-source.c
@@ -345,7 +345,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]