#define WIFI_MAC_ADDR_LENGTH 17
#define WIFI_MAC_ADDR_PATH "/sys/class/net/%s/address"
+#define WIFI_CONFIG_PREFIX "wifi_"
+#define MAC_ADDRESS_LENGTH 12
+#define WIFI_PREFIX_LENGTH MAC_ADDRESS_LENGTH + 6 /* wifi_485a3f2f506a_ */
+#define PROFILE_PREFIX_LENGTH WIFI_PREFIX_LENGTH + 21 /* /net/connman/service/wifi_485a3f2f506a_ */
+#define WIFI_CONFIG_ID_LENGTH 82 /* SSID(in hex) + "_managed_ieee8021x" */
+
/**
* This enumeration is used in frame id value in vsie method calls
*/
#include "netdbus.h"
#include "neterror.h"
#include "emulator.h"
+#include "wifi-config.h"
#include "wifi-state.h"
#include "wifi-power.h"
#include "network-state.h"
const char *ifname = NULL;
char *mac_addr = NULL;
+ if (strlen(profile) <= PROFILE_PREFIX_LENGTH) {
+ ERR("Invalid profile");
+ return NULL;
+ }
+
mac_addr = __netconfig_get_mac_address(profile);
ifname = wifi_state_get_interface_name(mac_addr);
#define WIFI_SECURITY_EAP "ieee8021x"
#define WIFI_SECURITY_SAE "sae"
-#define WIFI_CONFIG_PREFIX "wifi_"
-#define MAC_ADDRESS_LENGTH 12
-#define WIFI_PREFIX_LENGTH MAC_ADDRESS_LENGTH + 6 /* wifi_485a3f2f506a_ */
-#define PROFILE_PREFIX_LENGTH WIFI_PREFIX_LENGTH + 21 /* /net/connman/service/wifi_485a3f2f506a_ */
-#define WIFI_CONFIG_ID_LENGTH 82 /* SSID(in hex) + "_managed_ieee8021x" */
-
#define NET_DNS_ADDR_MAX 2
#define MAX_WIFI_PROFILES 200
gchar *g_name = NULL;
gboolean ret = FALSE;
+ if (__netconfig_is_valid_config_id(config_id) == FALSE) {
+ ERR("Invalid config_id [%s]", config_id);
+ return FALSE;
+ }
+
ret = __get_mac_address(interface_name, &mac_address);
if ((ret != TRUE) || (strlen(mac_address) == 0)) {
ERR("Cannot get WIFI MAC address");