/*
- * Bluetooth-frwk
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Hocheol Seo <hocheol.seo@samsung.com>
- * Girishashok Joshi <girish.joshi@samsung.com>
- * Chanyeol Park <chanyeol.park@samsung.com>
+ * 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.
#include "bt-request-sender.h"
#include "bt-event-handler.h"
+#ifdef TIZEN_DPM_ENABLE
+#include "bt-dpm.h"
+#endif
+
#ifdef RFCOMM_DIRECT
#define BT_TIMEOUT_MESSAGE "Did not receive a reply. Possible causes include: " \
gint compare_fd(gpointer *a, gpointer *b)
{
rfcomm_conn_info_t *node = (rfcomm_conn_info_t *)a;
- int fd = (int )*b;
- if (node->fd == fd)
+ int *fd = (int *)b;
+ if (node->fd == *fd)
return 0;
+
return 1;
}
static void __bt_free_conn(rfcomm_conn_info_t *conn)
BT_CHECK_PARAMETER(remote_uuid, return);
BT_CHECK_ENABLED(return);
+#ifdef TIZEN_DPM_ENABLE
+ if (_bt_check_dpm(BT_DPM_ADDRESS, (void *)remote_bt_address) == BT_DPM_RESTRICTED) {
+ BT_ERR("Blacklist device");
+ return BLUETOOTH_ERROR_ACCESS_DENIED;
+ }
+
+ if (_bt_check_dpm(BT_DPM_SPP, NULL) == BT_DPM_RESTRICTED ||
+ _bt_check_dpm(BT_DPM_HF_ONLY, NULL) == BT_DPM_RESTRICTED) {
+ BT_ERR("Not allow to connect the RFCOMM service");
+ return BLUETOOTH_ERROR_ACCESS_DENIED;
+ }
+
+ 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 *)remote_bt_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");
+ return BLUETOOTH_ERROR_ACCESS_DENIED;
+ }
+ }
+#endif
+
#ifdef RFCOMM_DIRECT
BT_INFO_C("<<<<<<<<< RFCOMM Connect request from app >>>>>>>>>>>");
int ret;
#endif
retv_if(length <= 0, BLUETOOTH_ERROR_INVALID_PARAM);
+#ifdef TIZEN_DPM_ENABLE
+ if (_bt_check_dpm(BT_DPM_SPP, NULL) == BT_DPM_RESTRICTED ||
+ _bt_check_dpm(BT_DPM_HF_ONLY, NULL) == BT_DPM_RESTRICTED) {
+ BT_ERR("Not allow to write RFCOMM data");
+ return BLUETOOTH_ERROR_ACCESS_DENIED;
+ }
+#endif
+
#ifdef RFCOMM_DIRECT
switch (privilege_token) {
case 0: