diff options
author | Carlos Garnacho <carlosg@gnome.org> | 2020-01-24 12:40:01 +0100 |
---|---|---|
committer | Carlos Garnacho <carlosg@gnome.org> | 2020-07-17 09:33:38 +0200 |
commit | 9c06e93f70d22379ef640405824c08748d3e79ec (patch) | |
tree | b67373ccdd907fae282ad7ba3ea41b371240bf05 /src/portal | |
parent | 48811ccfe27965e1ceaeacf34303f103da591ea6 (diff) | |
download | tracker-9c06e93f70d22379ef640405824c08748d3e79ec.tar.gz |
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.
Diffstat (limited to 'src/portal')
-rw-r--r-- | src/portal/tracker-portal-endpoint.c | 17 |
1 files changed, 15 insertions, 2 deletions
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); |