From 9c06e93f70d22379ef640405824c08748d3e79ec Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Fri, 24 Jan 2020 12:40:01 +0100 Subject: portal: Handle */default keywords in policy Those translate to CONSTRAINT GRAPH ALL and CONSTRAINT GRAPH DEFAULT, to let access to all graphs, or the default unnamed graph specifically. --- src/portal/tracker-portal-endpoint.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/portal') diff --git a/src/portal/tracker-portal-endpoint.c b/src/portal/tracker-portal-endpoint.c index cebd6b590..a357d5383 100644 --- a/src/portal/tracker-portal-endpoint.c +++ b/src/portal/tracker-portal-endpoint.c @@ -26,6 +26,9 @@ #include "tracker-portal-endpoint.h" +#define GRAPH_ALL "*" +#define GRAPH_DEFAULT "default" + typedef struct _TrackerPortalEndpoint TrackerPortalEndpoint; typedef struct _TrackerPortalEndpointClass TrackerPortalEndpointClass; @@ -75,7 +78,12 @@ tracker_portal_endpoint_filter_graph (TrackerEndpointDBus *endpoint_dbus, gint i; for (i = 0; endpoint->graphs[i]; i++) { - if (g_strcmp0 (graph_name, endpoint->graphs[i]) == 0) { + if (g_strcmp0 (endpoint->graphs[i], GRAPH_ALL) == 0) { + return FALSE; + } else if (!graph_name && + g_strcmp0 (endpoint->graphs[i], GRAPH_DEFAULT) == 0) { + return FALSE; + } else if (g_strcmp0 (graph_name, endpoint->graphs[i]) == 0) { return FALSE; } } @@ -99,7 +107,12 @@ tracker_portal_endpoint_add_prologue (TrackerEndpointDBus *endpoint_dbus) if (i != 0) g_string_append (str, ", "); - g_string_append_printf (str, "<%s>", endpoint->graphs[i]); + if (g_strcmp0 (endpoint->graphs[i], GRAPH_ALL) == 0) + g_string_append (str, "ALL"); + else if (g_strcmp0 (endpoint->graphs[i], GRAPH_DEFAULT) == 0) + g_string_append (str, "DEFAULT"); + else + g_string_append_printf (str, "<%s>", endpoint->graphs[i]); } endpoint->prologue = g_string_free (str, FALSE); -- cgit v1.2.1