mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
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 <simon.mcvittie@collabora.co.uk> Signed-off-by: David Zeuthen <davidz@redhat.com>
This commit is contained in:
parent
2b0171a808
commit
20387d262f
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user