[tracker] Fixes NB#180236, tracker-store: check if user_data expected one only if proper message path and inte



commit da3702833120d7b6eddc911bd39b93d6fab14f89
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Tue Jul 20 17:03:49 2010 +0200

    Fixes NB#180236, tracker-store: check if user_data expected one only if proper message path and interface

 src/tracker-store/tracker-steroids.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/tracker-store/tracker-steroids.c b/src/tracker-store/tracker-steroids.c
index 8fae74b..7f6e99a 100644
--- a/src/tracker-store/tracker-steroids.c
+++ b/src/tracker-store/tracker-steroids.c
@@ -375,7 +375,7 @@ steroids_query (TrackerSteroids *steroids,
 		                          __FUNCTION__);
 
 		reply = dbus_message_new_error_printf (message,
-		                                       DBUS_ERROR_UNKNOWN_METHOD,   
+		                                       DBUS_ERROR_UNKNOWN_METHOD,
 		                                       UNKNOWN_METHOD_MESSAGE,
 		                                       "Query",
 		                                       dbus_message_get_signature (message),
@@ -637,9 +637,6 @@ tracker_steroids_connection_filter (DBusConnection *connection,
 	g_return_val_if_fail (connection != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
 	g_return_val_if_fail (message != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
 
-	steroids = user_data;
-	g_return_val_if_fail (TRACKER_IS_STEROIDS (steroids), DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
-
 	if (g_strcmp0 (TRACKER_STEROIDS_PATH, dbus_message_get_path (message))) {
 		return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 	}
@@ -648,6 +645,11 @@ tracker_steroids_connection_filter (DBusConnection *connection,
 		return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 	}
 
+	/* Only check if the user_data is our TrackerSteroids AFTER having checked that
+	 * the message matches expected path and interface. */
+	steroids = user_data;
+	g_return_val_if_fail (TRACKER_IS_STEROIDS (steroids), DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
+
 	if (!g_strcmp0 ("Query", dbus_message_get_member (message))) {
 		steroids_query (steroids, connection, message);
 		return DBUS_HANDLER_RESULT_HANDLED;



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