Commit 22a988d5 authored by Zeeshan Ali's avatar Zeeshan Ali

agent: Fixed object path

There is no need for object paths to be unique on the bus and having a
fixed path will allow us to use it in DBus policy.
parent 4399bce0
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
#include "gclue-service-agent.h" #include "gclue-service-agent.h"
#define AGENT_PATH "/org/freedesktop/GeoClue2/Agent"
static void static void
gclue_service_agent_agent_iface_init (GClueAgentIface *iface); gclue_service_agent_agent_iface_init (GClueAgentIface *iface);
static void static void
...@@ -163,6 +165,7 @@ on_manager_proxy_ready (GObject *source_object, ...@@ -163,6 +165,7 @@ on_manager_proxy_ready (GObject *source_object,
gpointer user_data) gpointer user_data)
{ {
GTask *task = G_TASK (user_data); GTask *task = G_TASK (user_data);
GClueAgent *agent;
GDBusProxy *proxy; GDBusProxy *proxy;
GError *error = NULL; GError *error = NULL;
...@@ -195,23 +198,19 @@ gclue_service_agent_init_async (GAsyncInitable *initable, ...@@ -195,23 +198,19 @@ gclue_service_agent_init_async (GAsyncInitable *initable,
gpointer user_data) gpointer user_data)
{ {
GTask *task; GTask *task;
char *path;
GError *error = NULL; GError *error = NULL;
task = g_task_new (initable, cancellable, callback, user_data); task = g_task_new (initable, cancellable, callback, user_data);
path = g_strdup_printf ("/org/freedesktop/GeoClue2/Agent/%u", getuid ());
if (!g_dbus_interface_skeleton_export if (!g_dbus_interface_skeleton_export
(G_DBUS_INTERFACE_SKELETON (initable), (G_DBUS_INTERFACE_SKELETON (initable),
GCLUE_SERVICE_AGENT (initable)->priv->connection, GCLUE_SERVICE_AGENT (initable)->priv->connection,
path, AGENT_PATH,
&error)) { &error)) {
g_task_return_error (task, error); g_task_return_error (task, error);
g_object_unref (task); g_object_unref (task);
g_free (path);
return; return;
} }
g_free (path);
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_NONE, G_DBUS_PROXY_FLAGS_NONE,
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
This is the interface all application-authorizing agents must implement. This is the interface all application-authorizing agents must implement.
There must be a separate agent object for every logged-in user on path There must be a separate agent object for every logged-in user on path
"/org/freedesktop/GeoClue2/Agent/${UID}". "/org/freedesktop/GeoClue2/Agent".
--> -->
<interface name="org.freedesktop.GeoClue2.Agent"> <interface name="org.freedesktop.GeoClue2.Agent">
......
...@@ -285,7 +285,7 @@ out: ...@@ -285,7 +285,7 @@ out:
add_agent_data_free (data); add_agent_data_free (data);
} }
#define AGENT_PATH "/org/freedesktop/GeoClue2/Agent/%u" #define AGENT_PATH "/org/freedesktop/GeoClue2/Agent"
static void static void
on_agent_info_new_ready (GObject *source_object, on_agent_info_new_ready (GObject *source_object,
...@@ -294,7 +294,6 @@ on_agent_info_new_ready (GObject *source_object, ...@@ -294,7 +294,6 @@ on_agent_info_new_ready (GObject *source_object,
{ {
AddAgentData *data = (AddAgentData *) user_data; AddAgentData *data = (AddAgentData *) user_data;
GError *error = NULL; GError *error = NULL;
char *path;
GClueConfig *config; GClueConfig *config;
data->info = gclue_client_info_new_finish (res, &error); data->info = gclue_client_info_new_finish (res, &error);
...@@ -322,16 +321,13 @@ on_agent_info_new_ready (GObject *source_object, ...@@ -322,16 +321,13 @@ on_agent_info_new_ready (GObject *source_object,
return; return;
} }
path = g_strdup_printf (AGENT_PATH,
gclue_client_info_get_user_id (data->info));
gclue_agent_proxy_new_for_bus (G_BUS_TYPE_SYSTEM, gclue_agent_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_NONE, G_DBUS_PROXY_FLAGS_NONE,
gclue_client_info_get_bus_name (data->info), gclue_client_info_get_bus_name (data->info),
path, AGENT_PATH,
NULL, NULL,
on_agent_proxy_ready, on_agent_proxy_ready,
user_data); user_data);
g_free (path);
} }
static gboolean static gboolean
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment