Check SSID when loading wifi configuration file
[platform/core/connectivity/net-config.git] / src / ethernet.c
index a6ba2b4..89da94c 100644 (file)
@@ -29,7 +29,7 @@
 #include "wifi-power.h"
 #include "netsupplicant.h"
 
-#define EAPOL_STORAGEDIR       "/opt/usr/data/network/"
+#define EAPOL_STORAGEDIR       "/var/lib/connman/"
 #define ETH_IFNAME             "eth0"
 
 #define CONNMAN_CONFIG_FIELD_EAP_METHOD                "EAP"
@@ -45,7 +45,7 @@
 #define CONNMAN_CONFIG_FIELD_PHASE1            "Phase1"
 
 static Ethernet *ethernet_object = NULL;
-static gboolean g_eap_supported = FALSE;
+static gboolean g_eap_enabled = FALSE;
 netconfig_eapol_s eapol;
 
 Ethernet *get_ethernet_object(void)
@@ -87,69 +87,49 @@ static gboolean __netconfig_set_eap_config_file(GVariant *fields)
        g_variant_get(fields, "a{ss}", &iter);
        while (g_variant_iter_loop(iter, "{ss}", &field, &value)) {
                if (g_strcmp0(field, CONNMAN_CONFIG_FIELD_EAP_METHOD) == 0) {
-                       DBG("field: %s, value: %s", field, value);
-
                        if (value != NULL) {
                                fprintf (fp, "eap=%s\n", value);
                                eapol.eap_type = g_strdup(value);
                        }
                } else if (g_strcmp0(field, CONNMAN_CONFIG_FIELD_IDENTITY) == 0) {
-                       DBG("field: %s, value: %s", field, value);
-
                        if (value != NULL) {
                                fprintf (fp, "identity=\"%s\"\n", value);
                                eapol.identity = g_strdup(value);
                        }
                } else if (g_strcmp0(field, CONNMAN_CONFIG_FIELD_ANONYMOUS_IDENTITY) == 0) {
-                       DBG("field: %s, value: %s", field, value);
-
                        if (value != NULL) {
                                fprintf (fp, "anonymous_identity=\"%s\"\n", value);
                                eapol.anonymous_identity = g_strdup(value);
                        }
                } else if (g_strcmp0(field, CONNMAN_CONFIG_FIELD_PASSPHRASE) == 0) {
-                       DBG("field: %s, value: %s", field, value);
-
                        if (value != NULL)
                                fprintf (fp, "password=\"%s\"\n", value);
                } else if (g_strcmp0(field, CONNMAN_CONFIG_FIELD_CA_CERT_FILE) == 0) {
-                       DBG("field: %s, value: %s", field, value);
-
                        if (value != NULL) {
                                fprintf (fp, "ca_cert=\"%s\"\n", value);
                                eapol.ca_cert_file = g_strdup(value);
                        }
                } else if (g_strcmp0(field, CONNMAN_CONFIG_FIELD_CLIENT_CERT_FILE) == 0) {
-                       DBG("field: %s, value: %s", field, value);
-
                        if (value != NULL) {
                                fprintf (fp, "client_cert=\"%s\"\n", value);
                                eapol.client_cert_file = g_strdup(value);
                        }
                } else if (g_strcmp0(field, CONNMAN_CONFIG_FIELD_PVT_KEY_FILE) == 0) {
-                       DBG("field: %s, value: %s", field, value);
-
                        if (value != NULL) {
                                fprintf (fp, "private_key=\"%s\"\n", value);
                                eapol.private_key_file = g_strdup(value);
                        }
                } else if (g_strcmp0(field, CONNMAN_CONFIG_FIELD_PVT_KEY_PASSPHRASE) == 0) {
-                       DBG("field: %s, value: %s", field, value);
-
                        if (value != NULL) {
                                fprintf (fp, "private_key_passwd=\"%s\"\n", value);
                                eapol.private_key_password = g_strdup(value);
                        }
                } else if (g_strcmp0(field, CONNMAN_CONFIG_FIELD_PAC_FILE) == 0) {
-                       DBG("field: %s, value: %s", field, value);
-
                        if (value != NULL) {
                                fprintf (fp, "pac_file=\"%s\"\n", value);
                                eapol.pac_file = g_strdup(value);
                        }
                } else if (g_strcmp0(field, CONNMAN_CONFIG_FIELD_PHASE2) == 0) {
-                       DBG("field: %s, value: %s", field, value);
-
                        if (value != NULL) {
                                char str[50] = {0,};
                                sprintf(str, "auth=%s", value);
@@ -158,8 +138,6 @@ static gboolean __netconfig_set_eap_config_file(GVariant *fields)
                                eapol.phase2 = g_strdup(value);
                        }
                } else if (g_strcmp0(field, CONNMAN_CONFIG_FIELD_PHASE1) == 0) {
-                       DBG("field: %s, value: %s", field, value);
-
                        if (value != NULL) {
                                int peap_version;
                                char str[50] = {0,};
@@ -285,7 +263,7 @@ gboolean handle_enable_eap(Ethernet *object, GDBusMethodInvocation *invocation,
        /* TODO: Make below variable interface specific and set
        connMan profile associated with this interface as EAP enabled.
        */
-       g_eap_supported = enable;
+       g_eap_enabled = enable;
 
        if (enable == false) {
                int err = __netconfig_set_eapol_property(service, false);
@@ -300,19 +278,6 @@ gboolean handle_enable_eap(Ethernet *object, GDBusMethodInvocation *invocation,
        return TRUE;
 }
 
-gboolean handle_is_eap_supported(Ethernet *object, GDBusMethodInvocation *invocation)
-{
-       g_return_val_if_fail(object != NULL, TRUE);
-
-       DBG("handle_is_eap_supported");
-       gboolean value = FALSE;
-
-       value = g_eap_supported;
-
-       ethernet_complete_is_eap_supported(object, invocation, value);
-       return TRUE;
-}
-
 gboolean handle_set_eap_config(Ethernet *object, GDBusMethodInvocation *invocation,
                        const gchar *service, GVariant *fields)
 {
@@ -325,7 +290,7 @@ gboolean handle_set_eap_config(Ethernet *object, GDBusMethodInvocation *invocati
                return TRUE;
        }
 
-       if (g_eap_supported == FALSE) {
+       if (g_eap_enabled == FALSE) {
                netconfig_error_dbus_method_return(invocation,
                                                   NETCONFIG_ERROR_INTERNAL,
                                                   "EapNotEnabled");
@@ -373,8 +338,6 @@ void ethernet_object_create_and_init(void)
        /* EAP over Ethernet Service */
        g_signal_connect(ethernet_object, "handle-enable-eap",
                        G_CALLBACK(handle_enable_eap), NULL);
-       g_signal_connect(ethernet_object, "handle-is-eap-supported",
-                       G_CALLBACK(handle_is_eap_supported), NULL);
        g_signal_connect(ethernet_object, "handle-set-eap-config",
                        G_CALLBACK(handle_set_eap_config), NULL);