[tracker-miners/wip/carlosg/dbus-api-changes: 9/13] tracker-index: Move files_indexed/graph properties to a separate interface
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/carlosg/dbus-api-changes: 9/13] tracker-index: Move files_indexed/graph properties to a separate interface
- Date: Sat, 20 Jun 2020 21:57:37 +0000 (UTC)
commit 56725149702c49f8734986d3c5263cf70650a503
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Jun 20 19:51:39 2020 +0200
tracker-index: Move files_indexed/graph properties to a separate interface
This is not the "public API" that we intend applications to use, better
to keep the XML definition for it as clean as possible.
Technically this object/interface is still available to clients, if this
DBus name were made available on a sandbox. And technically letting
sandboxed clients potentially deduce IndexFile requests from other
clients is an information leak, it is just not one to care hard about.
These properties could presumably turn into targeted signals to
tracker-miner-fs/tracker-extract DBus names, and DBus name checks on
respective DBus requests to ensure no one else has access to these
properties. Let's go for simplicity at the moment, it's an implementation
detail and may change anytime.
src/tracker-index/meson.build | 12 +++++++++--
.../org.freedesktop.Tracker3.Miner.Files.Index.xml | 2 --
.../org.freedesktop.Tracker3.Miner.Files.Proxy.xml | 6 ++++++
src/tracker-index/tracker-miner-files-index.c | 23 ++++++++++++++++++++--
4 files changed, 37 insertions(+), 6 deletions(-)
---
diff --git a/src/tracker-index/meson.build b/src/tracker-index/meson.build
index 50e3b37be..b92da668e 100644
--- a/src/tracker-index/meson.build
+++ b/src/tracker-index/meson.build
@@ -11,19 +11,27 @@ tracker_index_deps = [
]
dbus_index_files_interface = files('org.freedesktop.Tracker3.Miner.Files.Index.xml')
+dbus_index_proxy_interface = files('org.freedesktop.Tracker3.Miner.Files.Proxy.xml')
-index_files_built_sources = gnome.gdbus_codegen('tracker-dbus-files-index',
+built_sources = []
+built_sources += gnome.gdbus_codegen('tracker-dbus-files-index',
dbus_index_files_interface,
interface_prefix: 'org.freedesktop.Tracker3',
namespace: 'TrackerDBus',
)
+built_sources += gnome.gdbus_codegen('tracker-dbus-files-proxy',
+ dbus_index_proxy_interface,
+ interface_prefix: 'org.freedesktop.Tracker3',
+ namespace: 'TrackerDBus',
+)
+
install_data(dbus_index_files_interface,
install_dir: join_paths(get_option('prefix'), get_option('datadir'), 'dbus-1', 'interfaces')
)
executable('tracker-index-@0@'.format(tracker_api_major),
- sources + index_files_built_sources,
+ sources + built_sources,
dependencies: tracker_index_deps,
c_args: tracker_c_args,
install: true,
diff --git a/src/tracker-index/org.freedesktop.Tracker3.Miner.Files.Index.xml
b/src/tracker-index/org.freedesktop.Tracker3.Miner.Files.Index.xml
index c2fdb86d8..12c35e493 100644
--- a/src/tracker-index/org.freedesktop.Tracker3.Miner.Files.Index.xml
+++ b/src/tracker-index/org.freedesktop.Tracker3.Miner.Files.Index.xml
@@ -4,7 +4,5 @@
<arg type='s' name='file_uri' direction='in' />
<arg type='as' name='graphs' direction='in' />
</method>
- <property name='Graphs' type='as' access='read' />
- <property name='IndexedFiles' type='as' access='read' />
</interface>
</node>
diff --git a/src/tracker-index/org.freedesktop.Tracker3.Miner.Files.Proxy.xml
b/src/tracker-index/org.freedesktop.Tracker3.Miner.Files.Proxy.xml
new file mode 100644
index 000000000..a04161ab1
--- /dev/null
+++ b/src/tracker-index/org.freedesktop.Tracker3.Miner.Files.Proxy.xml
@@ -0,0 +1,6 @@
+<node>
+ <interface name='org.freedesktop.Tracker3.Miner.Files.Proxy'>
+ <property name='Graphs' type='as' access='read' />
+ <property name='IndexedFiles' type='as' access='read' />
+ </interface>
+</node>
diff --git a/src/tracker-index/tracker-miner-files-index.c b/src/tracker-index/tracker-miner-files-index.c
index 44902fa12..401f4e644 100644
--- a/src/tracker-index/tracker-miner-files-index.c
+++ b/src/tracker-index/tracker-miner-files-index.c
@@ -24,6 +24,7 @@
#include <libtracker-miner/tracker-miner.h>
#include "tracker-dbus-files-index.h"
+#include "tracker-dbus-files-proxy.h"
#include "tracker-miner-files-index.h"
#include "tracker-miner-files-peer-listener.h"
@@ -37,6 +38,7 @@
typedef struct {
TrackerMinerFilesPeerListener *peer_listener;
TrackerDBusMinerFilesIndex *skeleton;
+ TrackerDBusMinerFilesProxy *proxy_skeleton;
GDBusConnection *d_connection;
GArray *indexed_files;
GStrv graphs;
@@ -102,6 +104,7 @@ index_finalize (GObject *object)
TrackerMinerFilesIndexPrivate *priv = TRACKER_MINER_FILES_INDEX_GET_PRIVATE (object);
g_object_unref (priv->skeleton);
+ g_object_unref (priv->proxy_skeleton);
if (priv->d_connection) {
g_object_unref (priv->d_connection);
@@ -121,7 +124,8 @@ update_indexed_files (TrackerMinerFilesIndex *index)
priv = TRACKER_MINER_FILES_INDEX_GET_PRIVATE (index);
- tracker_dbus_miner_files_index_set_indexed_files (priv->skeleton, (const gchar * const *)
priv->indexed_files->data);
+ tracker_dbus_miner_files_proxy_set_indexed_files (priv->proxy_skeleton,
+ (const gchar * const *) priv->indexed_files->data);
}
static void
@@ -196,7 +200,8 @@ peer_listener_graphs_changed (TrackerMinerFilesPeerListener *listener,
g_strfreev (priv->graphs);
priv->graphs = g_strdupv (graphs);
- tracker_dbus_miner_files_index_set_graphs (priv->skeleton, (const gchar * const *) priv->graphs);
+ tracker_dbus_miner_files_proxy_set_graphs (priv->proxy_skeleton,
+ (const gchar * const *) priv->graphs);
}
static void
@@ -213,6 +218,8 @@ tracker_miner_files_index_init (TrackerMinerFilesIndex *object)
priv = TRACKER_MINER_FILES_INDEX_GET_PRIVATE (object);
+ priv->proxy_skeleton = tracker_dbus_miner_files_proxy_skeleton_new ();
+
priv->skeleton = tracker_dbus_miner_files_index_skeleton_new ();
g_signal_connect (priv->skeleton, "handle-index-file",
G_CALLBACK (tracker_miner_files_index_handle_index_file),
@@ -266,6 +273,18 @@ tracker_miner_files_index_new (void)
return NULL;
}
+ if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (priv->proxy_skeleton),
+ priv->d_connection,
+ TRACKER_MINER_DBUS_NAME_PREFIX "Files.Proxy",
+ &error)) {
+ g_critical ("Could not register the D-Bus object %s, %s",
+ TRACKER_MINER_DBUS_NAME_PREFIX "Files.Proxy",
+ error ? error->message : "no error given.");
+ g_clear_error (&error);
+ g_object_unref (miner);
+ return NULL;
+ }
+
priv->full_path = full_path;
priv->peer_listener = tracker_miner_files_peer_listener_new (priv->d_connection);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]