[tracker/wip/carlosg/sandboxed-notifiers: 6/10] portal: Expand allowed graphs to full URIs for notifier filtering




commit 0407d687bfbb27c06ba0666df5dc944b3dc6b64b
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Feb 20 21:50:33 2021 +0100

    portal: Expand allowed graphs to full URIs for notifier filtering
    
    We get fully expanded graph names from TrackerNotifier events, but
    we allow prefixed names in flatpak rules. Expand the latter so we
    match both, as a last resort.
    
    This fixes propagation of changes from these graphs to the sandboxed
    applications.

 src/portal/tracker-portal-endpoint.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
---
diff --git a/src/portal/tracker-portal-endpoint.c b/src/portal/tracker-portal-endpoint.c
index c1d26bb83..79028a1b6 100644
--- a/src/portal/tracker-portal-endpoint.c
+++ b/src/portal/tracker-portal-endpoint.c
@@ -92,6 +92,26 @@ tracker_portal_endpoint_filter_graph (TrackerEndpointDBus *endpoint_dbus,
                        return FALSE;
                } else if (g_strcmp0 (graph_name, endpoint->graphs[i]) == 0) {
                        return FALSE;
+               } else {
+                       TrackerNamespaceManager *namespaces;
+                       gchar *expanded;
+
+                       /* We may have been given a prefixed name instead of an
+                        * URI, expand it in order to check with the given graph.
+                        *
+                        * FIXME: This is not going to work for prefixes outside
+                        * the well-known namespaces.
+                        */
+                       namespaces = tracker_namespace_manager_get_default ();
+                       expanded = tracker_namespace_manager_expand_uri (namespaces,
+                                                                        endpoint->graphs[i]);
+
+                       if (g_strcmp0 (graph_name, expanded) == 0) {
+                               g_free (expanded);
+                               return FALSE;
+                       }
+
+                       g_free (expanded);
                }
        }
 


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