Commit 20387d26 authored by Simon McVittie's avatar Simon McVittie Committed by David Zeuthen

GDBusProxy: if a well-known name is not owned, don't GetAll from the dbus-daemon

If you run:

    ( cd gio/tests && G_DBUS_DEBUG=all ./gdbus-proxy-well-known-name )

you can see that in the case where the name com.example.TestService isn't
owned yet, the GDBusProxy calls GetAll() with no destination, resulting
in an error reply from the peer (the dbus-daemon itself). That's clearly
not right!

However, if priv->name is NULL, that indicates the special case where we
really do want to talk directly to a peer, instead of via the bus daemon
(most likely to be used on peer-to-peer connections); in that special
case, do call GetAll().
Signed-off-by: Simon McVittie's avatarSimon McVittie <simon.mcvittie@collabora.co.uk>
Signed-off-by: default avatarDavid Zeuthen <davidz@redhat.com>
parent 2b0171a8
......@@ -1316,6 +1316,7 @@ async_init_get_name_owner_cb (GDBusConnection *connection,
gpointer user_data)
{
AsyncInitData *data = user_data;
gboolean get_all;
if (res != NULL)
{
......@@ -1350,7 +1351,25 @@ async_init_get_name_owner_cb (GDBusConnection *connection,
}
}
if (!(data->proxy->priv->flags & G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES))
get_all = TRUE;
if (data->proxy->priv->flags & G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES)
{
/* Don't load properties if the API user doesn't want them */
get_all = FALSE;
}
else if (data->proxy->priv->name_owner == NULL &&
data->proxy->priv->name != NULL)
{
/* Don't attempt to load properties if the name_owner is NULL (which
* usually means the name isn't owned), unless name is also NULL (which
* means we actually wanted to talk to the directly-connected process -
* either dbus-daemon or a peer - instead of going via dbus-daemon)
*/
get_all = FALSE;
}
if (get_all)
{
/* load all properties asynchronously */
g_dbus_connection_call (data->proxy->priv->connection,
......
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