From 933512c8fa3e605b4b5d981c5b32da797aff1b43 Mon Sep 17 00:00:00 2001 From: Hyuk Lee Date: Wed, 1 Jun 2016 18:56:35 +0900 Subject: [PATCH] Add the privilege check for async GATT connection Change-Id: Ia5b7b6d28bd3a928298785bc3b6c017144e63672 Signed-off-by: Hyuk Lee --- bt-api/bt-device.c | 6 ++++++ bt-api/bt-hdp.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bt-api/bt-device.c b/bt-api/bt-device.c index d6bf2da..c3563e3 100644 --- a/bt-api/bt-device.c +++ b/bt-api/bt-device.c @@ -335,6 +335,12 @@ BT_EXPORT_API int bluetooth_connect_le(const bluetooth_device_address_t *device_ BT_CHECK_PARAMETER(device_address, return); BT_CHECK_ENABLED_ANY(return); + if (_bt_check_privilege(BT_CHECK_PRIVILEGE, BT_CONNECT_LE) + == BLUETOOTH_ERROR_PERMISSION_DEINED) { + BT_ERR("Don't have a privilege to use this API"); + return BLUETOOTH_ERROR_PERMISSION_DEINED; + } + BT_INIT_PARAMS(); BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param); diff --git a/bt-api/bt-hdp.c b/bt-api/bt-hdp.c index da56684..715a216 100755 --- a/bt-api/bt-hdp.c +++ b/bt-api/bt-hdp.c @@ -217,7 +217,7 @@ static int __bt_hdp_internal_create_application(unsigned int data_type, if (err) { BT_ERR("%s", err->message); if (g_strrstr(err->message, BT_ACCESS_DENIED_MSG)) - ret = BLUETOOTH_ERROR_ACCESS_DENIED; + ret = BLUETOOTH_ERROR_PERMISSION_DEINED; else ret = BLUETOOTH_ERROR_INTERNAL; g_clear_error(&err); -- 2.7.4