Tizen 2.4 SDK Rev6 Release accepted/tizen_2.3.1_mobile accepted/tizen_2.3.1_wearable tizen_2.3.1 accepted/tizen/2.3.1/mobile/20160530.053518 accepted/tizen/2.3.1/wearable/20160530.053525 submit/tizen_2.3.1/20160530.021330
authorJaekyu Park <jk7744.park@samsung.com>
Fri, 27 May 2016 08:12:53 +0000 (17:12 +0900)
committerJaekyu Park <jk7744.park@samsung.com>
Fri, 27 May 2016 08:12:53 +0000 (17:12 +0900)
include/net_wifi_private.h
packaging/capi-network-wifi.spec
src/libnetwork.c
src/net_wifi_ap.c

index 7f206e8..0c1fef8 100755 (executable)
@@ -119,6 +119,9 @@ wifi_connection_state_e _wifi_convert_to_ap_state(net_state_type_t state);
 guint _wifi_callback_add(GSourceFunc func, gpointer user_data);
 void _wifi_callback_cleanup(void);
 
+int _wifi_libnet_check_get_privilege();
+int _wifi_libnet_check_profile_privilege();
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index 8ef81af..498a716 100644 (file)
@@ -1,6 +1,6 @@
 Name:          capi-network-wifi
 Summary:       Network Wi-Fi library in TIZEN C API
-Version:       1.0.44
+Version:       1.0.45
 Release:       1
 Group:         System/Network
 License:       Apache-2.0
index 4964147..7c8a727 100755 (executable)
@@ -1191,3 +1191,29 @@ void _wifi_callback_cleanup(void)
        g_slist_free(managed_idler_list);
        managed_idler_list = NULL;
 }
+
+int _wifi_libnet_check_get_privilege()
+{
+       int rv;
+
+       rv = net_check_get_privilege();
+       if (rv == NET_ERR_ACCESS_DENIED) {
+               WIFI_LOG(WIFI_ERROR, "Access denied"); //LCOV_EXCL_LINE
+               return WIFI_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
+       } else if (rv != NET_ERR_NONE)
+               return WIFI_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+
+       return WIFI_ERROR_NONE;
+}
+
+int _wifi_libnet_check_profile_privilege()
+{
+       int rv = net_check_profile_privilege();
+       if (rv == NET_ERR_ACCESS_DENIED) {
+               WIFI_LOG(WIFI_ERROR, "Access denied"); //LCOV_EXCL_LINE
+               return WIFI_ERROR_PERMISSION_DENIED; //LCOV_EXCL_LINE
+       } else if (rv != NET_ERR_NONE)
+               return WIFI_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+
+       return WIFI_ERROR_NONE;
+}
index 114bc73..467c1f4 100755 (executable)
@@ -505,6 +505,22 @@ EXPORT_API int wifi_ap_set_ip_config_type(wifi_ap_h ap, wifi_address_family_e ad
                return WIFI_ERROR_INVALID_PARAMETER;
        }
 
+       int rv = _wifi_libnet_check_get_privilege();
+       if (rv == WIFI_ERROR_PERMISSION_DENIED)
+               return rv;
+       else if (rv != WIFI_ERROR_NONE) {
+               WIFI_LOG(WIFI_ERROR, "Failed to get statistics");
+               return WIFI_ERROR_OPERATION_FAILED;
+       }
+
+       rv = _wifi_libnet_check_profile_privilege();
+       if (rv == WIFI_ERROR_PERMISSION_DENIED)
+               return rv;
+       else if (rv != WIFI_ERROR_NONE) {
+               WIFI_LOG(WIFI_ERROR, "Failed to get statistics");
+               return WIFI_ERROR_OPERATION_FAILED;
+       }
+
        net_profile_info_t *profile_info = ap;
 
        if (address_family == WIFI_ADDRESS_FAMILY_IPV4) {
@@ -605,6 +621,22 @@ EXPORT_API int wifi_ap_set_ip_address(wifi_ap_h ap, wifi_address_family_e addres
                return WIFI_ERROR_INVALID_PARAMETER;
        }
 
+       int rv = _wifi_libnet_check_get_privilege();
+       if (rv == WIFI_ERROR_PERMISSION_DENIED)
+               return rv;
+       else if (rv != WIFI_ERROR_NONE) {
+               WIFI_LOG(WIFI_ERROR, "Failed to get statistics");
+               return WIFI_ERROR_OPERATION_FAILED;
+       }
+
+       rv = _wifi_libnet_check_profile_privilege();
+       if (rv == WIFI_ERROR_PERMISSION_DENIED)
+               return rv;
+       else if (rv != WIFI_ERROR_NONE) {
+               WIFI_LOG(WIFI_ERROR, "Failed to get statistics");
+               return WIFI_ERROR_OPERATION_FAILED;
+       }
+
        net_profile_info_t *profile_info = ap;
 
        if (address_family == WIFI_ADDRESS_FAMILY_IPV4) {
@@ -670,6 +702,22 @@ EXPORT_API int wifi_ap_set_subnet_mask(wifi_ap_h ap, wifi_address_family_e addre
                return WIFI_ERROR_INVALID_PARAMETER;
        }
 
+       int rv = _wifi_libnet_check_get_privilege();
+       if (rv == WIFI_ERROR_PERMISSION_DENIED)
+               return rv;
+       else if (rv != WIFI_ERROR_NONE) {
+               WIFI_LOG(WIFI_ERROR, "Failed to get statistics");
+               return WIFI_ERROR_OPERATION_FAILED;
+       }
+
+       rv = _wifi_libnet_check_profile_privilege();
+       if (rv == WIFI_ERROR_PERMISSION_DENIED)
+               return rv;
+       else if (rv != WIFI_ERROR_NONE) {
+               WIFI_LOG(WIFI_ERROR, "Failed to get statistics");
+               return WIFI_ERROR_OPERATION_FAILED;
+       }
+
        net_profile_info_t *profile_info = ap;
 
        /* Based on the family of address provided subnet mask should be set.
@@ -745,6 +793,22 @@ EXPORT_API int wifi_ap_set_gateway_address(wifi_ap_h ap, wifi_address_family_e a
                return WIFI_ERROR_INVALID_PARAMETER;
        }
 
+       int rv = _wifi_libnet_check_get_privilege();
+       if (rv == WIFI_ERROR_PERMISSION_DENIED)
+               return rv;
+       else if (rv != WIFI_ERROR_NONE) {
+               WIFI_LOG(WIFI_ERROR, "Failed to get statistics");
+               return WIFI_ERROR_OPERATION_FAILED;
+       }
+
+       rv = _wifi_libnet_check_profile_privilege();
+       if (rv == WIFI_ERROR_PERMISSION_DENIED)
+               return rv;
+       else if (rv != WIFI_ERROR_NONE) {
+               WIFI_LOG(WIFI_ERROR, "Failed to get statistics");
+               return WIFI_ERROR_OPERATION_FAILED;
+       }
+
        net_profile_info_t *profile_info = ap;
        if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {
                if (gateway_address == NULL)
@@ -798,6 +862,22 @@ EXPORT_API int wifi_ap_set_proxy_address(wifi_ap_h ap, wifi_address_family_e add
                return WIFI_ERROR_INVALID_PARAMETER;
        }
 
+       int rv = _wifi_libnet_check_get_privilege();
+       if (rv == WIFI_ERROR_PERMISSION_DENIED)
+               return rv;
+       else if (rv != WIFI_ERROR_NONE) {
+               WIFI_LOG(WIFI_ERROR, "Failed to get statistics");
+               return WIFI_ERROR_OPERATION_FAILED;
+       }
+
+       rv = _wifi_libnet_check_profile_privilege();
+       if (rv == WIFI_ERROR_PERMISSION_DENIED)
+               return rv;
+       else if (rv != WIFI_ERROR_NONE) {
+               WIFI_LOG(WIFI_ERROR, "Failed to get statistics");
+               return WIFI_ERROR_OPERATION_FAILED;
+       }
+
        net_profile_info_t *profile_info = ap;
 
        if (proxy_address == NULL)
@@ -852,8 +932,23 @@ EXPORT_API int wifi_ap_set_proxy_type(wifi_ap_h ap, wifi_proxy_type_e proxy_type
                return WIFI_ERROR_INVALID_PARAMETER;
        }
 
+       int rv = _wifi_libnet_check_get_privilege();
+       if (rv == WIFI_ERROR_PERMISSION_DENIED)
+               return rv;
+       else if (rv != WIFI_ERROR_NONE) {
+               WIFI_LOG(WIFI_ERROR, "Failed to get statistics");
+               return WIFI_ERROR_OPERATION_FAILED;
+       }
+
+       rv = _wifi_libnet_check_profile_privilege();
+       if (rv == WIFI_ERROR_PERMISSION_DENIED)
+               return rv;
+       else if (rv != WIFI_ERROR_NONE) {
+               WIFI_LOG(WIFI_ERROR, "Failed to get statistics");
+               return WIFI_ERROR_OPERATION_FAILED;
+       }
+
        net_profile_info_t *profile_info = ap;
-       int rv;
 
        switch (proxy_type) {
        case WIFI_PROXY_TYPE_DIRECT:
@@ -927,6 +1022,22 @@ EXPORT_API int wifi_ap_set_dns_address(wifi_ap_h ap, int order, wifi_address_fam
                return WIFI_ERROR_INVALID_PARAMETER;
        }
 
+       int rv = _wifi_libnet_check_get_privilege();
+       if (rv == WIFI_ERROR_PERMISSION_DENIED)
+               return rv;
+       else if (rv != WIFI_ERROR_NONE) {
+               WIFI_LOG(WIFI_ERROR, "Failed to get statistics");
+               return WIFI_ERROR_OPERATION_FAILED;
+       }
+
+       rv = _wifi_libnet_check_profile_privilege();
+       if (rv == WIFI_ERROR_PERMISSION_DENIED)
+               return rv;
+       else if (rv != WIFI_ERROR_NONE) {
+               WIFI_LOG(WIFI_ERROR, "Failed to get statistics");
+               return WIFI_ERROR_OPERATION_FAILED;
+       }
+
        net_profile_info_t *profile_info = ap;
 
        if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {