summaryrefslogtreecommitdiff
path: root/src/libtracker-sparql/tracker-notifier.c
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2021-02-20 18:09:29 +0100
committerCarlos Garnacho <carlosg@gnome.org>2021-02-20 23:29:00 +0100
commit38b4de262d814bef71f41877791532ad8379e113 (patch)
tree0553b2a4b5dc4aedd79a43ae7f2c1921e9b5a054 /src/libtracker-sparql/tracker-notifier.c
parent17c8fff46e8648e79c321c14423b0ca3927a8738 (diff)
downloadtracker-38b4de262d814bef71f41877791532ad8379e113.tar.gz
libtracker-sparql: Add private call to get remote DBus service details
When subscribing a TrackerNotifier to notifications from a remote DBus service, we may need to perform translation of dbus names and object paths, as this connection may be sandboxed. Implement this plumbing so we may ask the TrackerSparqlConnection about the real DBus details behind a SPARQL DBus endpoint. Fixes: https://gitlab.gnome.org/GNOME/tracker/-/issues/287
Diffstat (limited to 'src/libtracker-sparql/tracker-notifier.c')
-rw-r--r--src/libtracker-sparql/tracker-notifier.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/libtracker-sparql/tracker-notifier.c b/src/libtracker-sparql/tracker-notifier.c
index cf1c9a9dd..fce0cbde5 100644
--- a/src/libtracker-sparql/tracker-notifier.c
+++ b/src/libtracker-sparql/tracker-notifier.c
@@ -50,6 +50,7 @@
#include "tracker-private.h"
#include "tracker-sparql-enum-types.h"
#include <libtracker-common/tracker-common.h>
+#include <direct/tracker-direct.h>
typedef struct _TrackerNotifierPrivate TrackerNotifierPrivate;
typedef struct _TrackerNotifierSubscription TrackerNotifierSubscription;
@@ -811,6 +812,7 @@ tracker_notifier_signal_subscribe (TrackerNotifier *notifier,
{
TrackerNotifierSubscription *subscription;
TrackerNotifierPrivate *priv;
+ gchar *dbus_name = NULL, *dbus_path = NULL;
g_return_val_if_fail (TRACKER_IS_NOTIFIER (notifier), 0);
g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), 0);
@@ -821,15 +823,21 @@ tracker_notifier_signal_subscribe (TrackerNotifier *notifier,
if (!object_path)
object_path = DEFAULT_OBJECT_PATH;
+ tracker_sparql_connection_lookup_dbus_service (priv->connection,
+ service,
+ object_path,
+ &dbus_name,
+ &dbus_path);
+
subscription = tracker_notifier_subscription_new (notifier, connection,
service, object_path);
subscription->handler_id =
g_dbus_connection_signal_subscribe (connection,
- service,
+ dbus_name ? dbus_name : service,
"org.freedesktop.Tracker3.Endpoint",
"GraphUpdated",
- object_path,
+ dbus_path ? dbus_path : object_path,
graph,
G_DBUS_SIGNAL_FLAGS_NONE,
graph_updated_cb,
@@ -839,6 +847,9 @@ tracker_notifier_signal_subscribe (TrackerNotifier *notifier,
GUINT_TO_POINTER (subscription->handler_id),
subscription);
+ g_free (dbus_name);
+ g_free (dbus_path);
+
return subscription->handler_id;
}