From: Lukasz Skalski Date: Mon, 29 Aug 2016 14:17:54 +0000 (+0200) Subject: kdbus: always use well-known names for proxy X-Git-Tag: submit/tizen/20160905.073119~2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F72%2F86072%2F1;p=platform%2Fupstream%2Fglib.git kdbus: always use well-known names for proxy If proxy->priv->name is a well-known name (what just means that we created proxy for well-known name) then proxy->priv->name_owner points to current name owner (unique id or NULL if name currently doesn't have any owner). If we have following scenario: 1) server termination 2) g_dbus_proxy_call() to server 2a) get_destination_for_call() 3) on_name_owner callback, which set proxy->priv->name_owner to NULL then get_destination_for_call() function will return proxy->priv->name_owner value (which is unique id of previous name owner). To avoid above race condition it will be better if we 'always' return well-known name (without checking name_owner value). Change-Id: I31f7edb56d8434e26a15efe260c1b737486da93e --- diff --git a/gio/gdbusproxy.c b/gio/gdbusproxy.c index 33492b7..bb10696 100644 --- a/gio/gdbusproxy.c +++ b/gio/gdbusproxy.c @@ -2648,26 +2648,10 @@ out: static const gchar * get_destination_for_call (GDBusProxy *proxy) { - const gchar *ret; - - ret = NULL; - - /* If proxy->priv->name is a unique name, then proxy->priv->name_owner - * is never NULL and always the same as proxy->priv->name. We use this - * knowledge to avoid checking if proxy->priv->name is a unique or - * well-known name. - */ - ret = proxy->priv->name_owner; - if (ret != NULL) - goto out; - if (proxy->priv->flags & G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START) - goto out; - - ret = proxy->priv->name; + return proxy->priv->name_owner; - out: - return ret; + return proxy->priv->name; } /* ---------------------------------------------------------------------------------------------------- */