Fix some WPA Enterprise privacy issues
authorMarcel Holtmann <marcel@holtmann.org>
Fri, 8 Jan 2010 02:08:00 +0000 (18:08 -0800)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 8 Jan 2010 02:08:00 +0000 (18:08 -0800)
plugins/supplicant.c
src/config.c
src/service.c

index 4a7f524..ed176ed 100644 (file)
@@ -1795,10 +1795,11 @@ static int task_connect(struct supplicant_task *task)
 
        DBG("address %s security %s", address, security);
 
-       if (security == NULL && passphrase == NULL)
+       if (security == NULL)
                return -EINVAL;
 
-       if (g_str_equal(security, "none") == FALSE && passphrase == NULL)
+       if (passphrase == NULL && g_str_equal(security, "none") == FALSE &&
+                               g_str_equal(security, "ieee8021x") == FALSE)
                return -EINVAL;
 
        remove_network(task);
index 4b6e3ef..87c2bae 100644 (file)
@@ -120,7 +120,7 @@ static int load_service(GKeyFile *keyfile, const char *group,
 
        str = g_key_file_get_string(keyfile, group, "Name", NULL);
        if (str != NULL) {
-               g_free(service->type);
+               g_free(service->name);
                service->name = str;
        }
 
@@ -395,27 +395,27 @@ static void provision_service(gpointer key, gpointer value, gpointer user_data)
        __connman_service_set_immutable(service, TRUE);
        __connman_service_set_favorite(service, TRUE);
 
-       if (config->eap)
+       if (config->eap != NULL)
                __connman_service_set_string(service, "EAP", config->eap);
 
-       if (config->identity)
+       if (config->identity != NULL)
                __connman_service_set_string(service, "Identity",
                                                        config->identity);
 
-       if (config->ca_cert_file)
+       if (config->ca_cert_file != NULL)
                __connman_service_set_string(service, "CACertFile",
                                                        config->ca_cert_file);
 
-       if (config->client_cert_file)
+       if (config->client_cert_file != NULL)
                __connman_service_set_string(service, "ClientCertFile",
                                                config->client_cert_file);
 
-       if (config->private_key_file)
+       if (config->private_key_file != NULL)
                __connman_service_set_string(service, "PrivateKeyFile",
                                                config->private_key_file);
 
        if (g_strcmp0(config->private_key_passphrase_type, "fsid") == 0 &&
-                                               config->private_key_file) {
+                                       config->private_key_file != NULL) {
                char *fsid;
 
                fsid = config_pem_fsid(config->private_key_file);
@@ -426,7 +426,7 @@ static void provision_service(gpointer key, gpointer value, gpointer user_data)
                config->private_key_passphrase = fsid;
        }
 
-       if (config->private_key_passphrase) {
+       if (config->private_key_passphrase != NULL) {
                __connman_service_set_string(service, "PrivateKeyPassphrase",
                                                config->private_key_passphrase);
                /*
@@ -436,11 +436,9 @@ static void provision_service(gpointer key, gpointer value, gpointer user_data)
                 * service passphrase in order for the UI to request for an
                 * additional passphrase.
                 */
-               __connman_service_set_string(service, "Passphrase",
-                                               config->private_key_passphrase);
        }
 
-       if (config->phase2)
+       if (config->phase2 != NULL)
                __connman_service_set_string(service, "Phase2", config->phase2);
 }
 
index 24133d6..1d94a66 100644 (file)
@@ -377,10 +377,11 @@ static void passphrase_changed(struct connman_service *service)
                case CONNMAN_SERVICE_SECURITY_PSK:
                case CONNMAN_SERVICE_SECURITY_WPA:
                case CONNMAN_SERVICE_SECURITY_RSN:
-               case CONNMAN_SERVICE_SECURITY_8021X:
                        if (service->passphrase == NULL)
                                required = TRUE;
                        break;
+               case CONNMAN_SERVICE_SECURITY_8021X:
+                       break;
                }
                break;
        }
@@ -619,10 +620,11 @@ static DBusMessage *get_properties(DBusConnection *conn,
                case CONNMAN_SERVICE_SECURITY_PSK:
                case CONNMAN_SERVICE_SECURITY_WPA:
                case CONNMAN_SERVICE_SECURITY_RSN:
-               case CONNMAN_SERVICE_SECURITY_8021X:
                        if (service->passphrase == NULL)
                                required = TRUE;
                        break;
+               case CONNMAN_SERVICE_SECURITY_8021X:
+                       break;
                }
 
                connman_dbus_dict_append_basic(&dict, "PassphraseRequired",
@@ -1669,34 +1671,34 @@ static connman_bool_t prepare_network(struct connman_service *service)
 
 static void prepare_8021x(struct connman_service *service)
 {
-       if (service->eap)
+       if (service->eap != NULL)
                connman_network_set_string(service->network, "WiFi.EAP",
                                                                service->eap);
 
-       if (service->identity)
+       if (service->identity != NULL)
                connman_network_set_string(service->network, "WiFi.Identity",
                                                        service->identity);
 
-       if (service->ca_cert_file)
+       if (service->ca_cert_file != NULL)
                connman_network_set_string(service->network, "WiFi.CACertFile",
                                                        service->ca_cert_file);
 
-       if (service->client_cert_file)
+       if (service->client_cert_file != NULL)
                connman_network_set_string(service->network,
                                                "WiFi.ClientCertFile",
                                                service->client_cert_file);
 
-       if (service->private_key_file)
+       if (service->private_key_file != NULL)
                connman_network_set_string(service->network,
                                                "WiFi.PrivateKeyFile",
                                                service->private_key_file);
 
-       if (service->private_key_passphrase)
+       if (service->private_key_passphrase != NULL)
                connman_network_set_string(service->network,
                                        "WiFi.PrivateKeyPassphrase",
                                        service->private_key_passphrase);
 
-       if (service->phase2)
+       if (service->phase2 != NULL)
                connman_network_set_string(service->network, "WiFi.Phase2",
                                                        service->phase2);
 }
@@ -1736,10 +1738,11 @@ int __connman_service_connect(struct connman_service *service)
                case CONNMAN_SERVICE_SECURITY_PSK:
                case CONNMAN_SERVICE_SECURITY_WPA:
                case CONNMAN_SERVICE_SECURITY_RSN:
-               case CONNMAN_SERVICE_SECURITY_8021X:
                        if (service->passphrase == NULL)
                                return -ENOKEY;
                        break;
+               case CONNMAN_SERVICE_SECURITY_8021X:
+                       break;
                }
                break;
        }