Fix the advertisement fail issue
[platform/core/connectivity/bluetooth-frwk.git] / bt-api / bt-network.c
index 4b79358..43453cd 100644 (file)
@@ -22,7 +22,7 @@
 #include "bt-request-sender.h"
 #include "bt-event-handler.h"
 
-#ifdef TIZEN_DPM_ENABLE
+#ifdef TIZEN_FEATURE_BT_DPM
 #include "bt-dpm.h"
 #endif
 
@@ -76,11 +76,11 @@ BT_EXPORT_API int bluetooth_network_connect(const bluetooth_device_address_t *de
                return BLUETOOTH_ERROR_PERMISSION_DEINED;
        }
 
-#ifdef TIZEN_DPM_ENABLE
+#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_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 
        switch (role) {
@@ -100,10 +100,10 @@ BT_EXPORT_API int bluetooth_network_connect(const bluetooth_device_address_t *de
        if (_bt_check_dpm(BT_DPM_UUID, uuid) == BT_DPM_RESTRICTED) {
                BT_ERR("Blacklist uuid");
                g_free(uuid);
-               return BLUETOOTH_ERROR_ACCESS_DENIED;
+               return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
        }
 
-       if (_bt_check_dpm(BT_DPM_DESKTOP, NULL) ==      BT_DPM_RESTRICTED) {
+       if (_bt_check_dpm(BT_DPM_DESKTOP, NULL) == BT_DPM_RESTRICTED) {
                char address[BT_ADDRESS_STRING_SIZE] = { 0 };
                bluetooth_device_class_t dev_class;
 
@@ -112,7 +112,8 @@ BT_EXPORT_API int bluetooth_network_connect(const bluetooth_device_address_t *de
 
                if (dev_class.major_class == BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER) {
                        BT_ERR("Reject a authorization due to MDM Policy");
-                       return BLUETOOTH_ERROR_ACCESS_DENIED;
+                       g_free(uuid);
+                       return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
                }
        }
        g_free(uuid);