From c25b651557ff50093412306a0a824c1dbb59fe8f Mon Sep 17 00:00:00 2001 From: Wootak Jung Date: Thu, 7 Feb 2019 16:47:03 +0900 Subject: [PATCH] Fix dbus connection to shared from private Shared connection should be used because rfcomm interface was registered on shared connection not private. Otherwise, dbus rejection is occured because dbus policy is only applied on shared connection not private. Change-Id: I49ca31b06deeec8c9092fd99342d22d0b9290229 --- bt-api/bt-common.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bt-api/bt-common.c b/bt-api/bt-common.c index 97f1be5..c98fb07 100644 --- a/bt-api/bt-common.c +++ b/bt-api/bt-common.c @@ -897,7 +897,10 @@ static GDBusProxy *__bt_gdbus_get_profile_proxy(void) if (profile_gproxy) return profile_gproxy; - gconn = _bt_get_system_private_conn(); + /* Shared connection should be used because rfcomm interface was registered + * on shared connection not private. Otherwise, dbus rejection is occured + * because dbus policy is only applied on shared connection not private. */ + gconn = _bt_get_system_shared_conn(); if (gconn == NULL) return NULL; @@ -1223,7 +1226,7 @@ int _bt_register_profile_ex(bt_register_profile_info_t *info, gboolean use_defau NULL, &err); if (err) { g_dbus_error_strip_remote_error(err); - BT_ERR("RegisterProfile failed: %s", err->message); + BT_ERR("RegisterProfile2 failed: %s", err->message); if (g_strrstr(err->message, BT_ACCESS_DENIED_MSG)) result = BLUETOOTH_ERROR_ACCESS_DENIED; @@ -1291,7 +1294,7 @@ int _bt_register_profile_platform(bt_register_profile_info_t *info, gboolean use if (err) { g_dbus_error_strip_remote_error(err); - BT_ERR("RegisterProfile failed: %s", err->message); + BT_ERR("RegisterProfile1 failed: %s", err->message); if (g_strrstr(err->message, BT_ACCESS_DENIED_MSG)) result = BLUETOOTH_ERROR_ACCESS_DENIED; -- 2.7.4