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;
+}
+
bool __libnet_check_feature_supported(const char *key, wifi_supported_feature_e feature)
{
if (!wifi_is_feature_checked[feature]) {
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"); //LCOV_EXCL_LINE
+ return WIFI_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+ }
+
+ 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"); //LCOV_EXCL_LINE
+ return WIFI_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+ }
+
net_profile_info_t *profile_info = ap;
if (address_family == WIFI_ADDRESS_FAMILY_IPV4)
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"); //LCOV_EXCL_LINE
+ return WIFI_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+ }
+
+ 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"); //LCOV_EXCL_LINE
+ return WIFI_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+ }
+
net_profile_info_t *profile_info = ap;
if (address_family == WIFI_ADDRESS_FAMILY_IPV4) {
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"); //LCOV_EXCL_LINE
+ return WIFI_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+ }
+
+ 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"); //LCOV_EXCL_LINE
+ return WIFI_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+ }
+
net_profile_info_t *profile_info = ap;
/* Based on the family of address provided subnet mask should be set.
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"); //LCOV_EXCL_LINE
+ return WIFI_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+ }
+
+ 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"); //LCOV_EXCL_LINE
+ return WIFI_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+ }
+
net_profile_info_t *profile_info = ap;
if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {
//LCOV_EXCL_START
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"); //LCOV_EXCL_LINE
+ return WIFI_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+ }
+
+ 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"); //LCOV_EXCL_LINE
+ return WIFI_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+ }
+
net_profile_info_t *profile_info = ap;
if (proxy_address == NULL)
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"); //LCOV_EXCL_LINE
+ return WIFI_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+ }
+
+ 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"); //LCOV_EXCL_LINE
+ return WIFI_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+ }
+
net_profile_info_t *profile_info = ap;
- int rv;
switch (proxy_type) {
//LCOV_EXCL_START
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"); //LCOV_EXCL_LINE
+ return WIFI_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+ }
+
+ 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"); //LCOV_EXCL_LINE
+ return WIFI_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
+ }
+
net_profile_info_t *profile_info = ap;
if (address_family == WIFI_ADDRESS_FAMILY_IPV6) {
return "Unknown";
}
+static bool __test_compare_ap_name(const char *ap_name, const char *ap_name_part)
+{
+ int ap_name_len = strlen(ap_name);
+ int ap_name_part_len = strlen(ap_name_part);
+
+ if (strncmp(ap_name, ap_name_part,
+ ap_name_len > ap_name_part_len ? ap_name_len : ap_name_part_len) == 0)
+ return true;
+ else
+ return false;
+}
+
static bool __test_found_ap_callback(wifi_ap_h ap, void *user_data)
{
int rv = 0;
return false;
}
- if (strstr(ap_name, ap_name_part) != NULL) {
+ if (__test_compare_ap_name(ap_name, ap_name_part)) {
bool required = false;
if (wifi_ap_is_passphrase_required(ap, &required) == WIFI_ERROR_NONE)
return false;
}
- if (strstr(ap_name, ap_name_part) != NULL) {
+ if (__test_compare_ap_name(ap_name, ap_name_part)) {
int user_sel;
char pin[32] = {0,};
return false;
}
- if (strstr(ap_name, ap_name_part) != NULL) {
+ if (__test_compare_ap_name(ap_name, ap_name_part)) {
rv = wifi_disconnect(ap, __test_disconnected_callback, NULL);
if (rv != WIFI_ERROR_NONE)
printf("Fail to disconnection reqeust %s : [%s]\n", ap_name, __test_convert_error_to_string(rv));
return false;
}
- if (strstr(ap_name, ap_name_part) != NULL) {
+ if (__test_compare_ap_name(ap_name, ap_name_part)) {
rv = wifi_forget_ap(ap);
if (rv != WIFI_ERROR_NONE)
printf("Fail to forget [%s] : %s\n", ap_name, __test_convert_error_to_string(rv));
return false;
}
- if (strstr(ap_name, ap_name_part) != NULL) {
+ if (__test_compare_ap_name(ap_name, ap_name_part)) {
wifi_security_type_e type;
if (wifi_ap_get_security_type(ap, &type) == WIFI_ERROR_NONE)
return false;
}
- if (strstr(ap_name, ap_name_part) != NULL) {
+ if (__test_compare_ap_name(ap_name, ap_name_part)) {
wifi_ip_config_type_e type;
int method;
int address_type;
}
printf("ap_name %s, user input name %s\n", ap_name, ap_name_part);
- if (strstr(ap_name, ap_name_part) != NULL) {
+ if (__test_compare_ap_name(ap_name, ap_name_part)) {
wifi_proxy_type_e type;
char proxy_addr[65];
int method;
}
printf("ap_name %s, user input name %s\n", ap_name, ap_name_part);
- if (strstr(ap_name, ap_name_part) != NULL) {
-
+ if (__test_compare_ap_name(ap_name, ap_name_part)) {
/* Basic info */
printf("ESSID : %s\n", ap_name);
int main(int argc, char **argv)
{
GMainLoop *mainloop;
+#if !GLIB_CHECK_VERSION(2, 36, 0)
g_type_init();
+#endif
mainloop = g_main_loop_new(NULL, FALSE);
GIOChannel *channel = g_io_channel_unix_new(0);