X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=bt-api%2Fbt-network.c;h=43453cde2be6e591fae7b4336fbb5549679f6447;hb=39ba85ec55b2de81bb872bacb035f6731e56086e;hp=987b45d9893ddcee8be79be430043387542bd773;hpb=45b67c424f9352ccdce42e96542132ac069ddd2b;p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git diff --git a/bt-api/bt-network.c b/bt-api/bt-network.c index 987b45d..43453cd 100644 --- a/bt-api/bt-network.c +++ b/bt-api/bt-network.c @@ -1,11 +1,5 @@ /* - * Bluetooth-frwk - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: Hocheol Seo - * Girishashok Joshi - * Chanyeol Park + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +22,10 @@ #include "bt-request-sender.h" #include "bt-event-handler.h" +#ifdef TIZEN_FEATURE_BT_DPM +#include "bt-dpm.h" +#endif + BT_EXPORT_API int bluetooth_network_activate_server() { int result; @@ -78,6 +76,49 @@ BT_EXPORT_API int bluetooth_network_connect(const bluetooth_device_address_t *de return BLUETOOTH_ERROR_PERMISSION_DEINED; } +#ifdef TIZEN_FEATURE_BT_DPM + char *uuid = NULL; + if (_bt_check_dpm(BT_DPM_ADDRESS, (void *)device_address) == BT_DPM_RESTRICTED) { + BT_ERR("Blacklist device"); + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; + } + + switch (role) { + case BLUETOOTH_NETWORK_PANU_ROLE: + uuid = g_strdup(BT_PAN_PANU_UUID); + break; + case BLUETOOTH_NETWORK_NAP_ROLE: + uuid = g_strdup(BT_PAN_NAP_UUID); + break; + case BLUETOOTH_NETWORK_GN_ROLE: + uuid = g_strdup(BT_PAN_GN_UUID); + break; + default: + break; + } + + if (_bt_check_dpm(BT_DPM_UUID, uuid) == BT_DPM_RESTRICTED) { + BT_ERR("Blacklist uuid"); + g_free(uuid); + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; + } + + if (_bt_check_dpm(BT_DPM_DESKTOP, NULL) == BT_DPM_RESTRICTED) { + char address[BT_ADDRESS_STRING_SIZE] = { 0 }; + bluetooth_device_class_t dev_class; + + _bt_convert_addr_type_to_string(address, (unsigned char *)device_address->addr); + _bt_get_cod_by_address(address, &dev_class); + + if (dev_class.major_class == BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER) { + BT_ERR("Reject a authorization due to MDM Policy"); + g_free(uuid); + return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION; + } + } + g_free(uuid); +#endif + user_info = _bt_get_user_data(BT_COMMON); retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);