Propagate WiFi.Security information properly
authorMarcel Holtmann <marcel@holtmann.org>
Wed, 3 Dec 2008 12:04:11 +0000 (13:04 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 3 Dec 2008 12:04:11 +0000 (13:04 +0100)
plugins/supplicant.c
plugins/supplicant.h
plugins/wifi.c

index cdaea16..b7d01cf 100644 (file)
@@ -475,8 +475,8 @@ static int disable_network(struct supplicant_task *task)
 }
 
 static int set_network(struct supplicant_task *task,
-                                       const unsigned char *network, int len,
-                                                       const char *passphrase)
+                               const unsigned char *network, int len,
+                               const char *security, const char *passphrase)
 {
        DBusMessage *message, *reply;
        DBusMessageIter array, dict;
@@ -1023,7 +1023,7 @@ int __supplicant_scan(struct connman_element *element)
 
 int __supplicant_connect(struct connman_element *element,
                                const unsigned char *ssid, int ssid_len,
-                                                       const char *passphrase)
+                               const char *security, const char *passphrase)
 {
        struct supplicant_task *task;
 
@@ -1038,7 +1038,7 @@ int __supplicant_connect(struct connman_element *element,
        select_network(task);
        disable_network(task);
 
-       set_network(task, ssid, ssid_len, passphrase);
+       set_network(task, ssid, ssid_len, security, passphrase);
 
        enable_network(task);
 
index 2e2e4ea..fa10a69 100644 (file)
@@ -68,5 +68,5 @@ int __supplicant_scan(struct connman_element *element);
 
 int __supplicant_connect(struct connman_element *element,
                                const unsigned char *ssid, int ssid_len,
-                                                       const char *passphrase);
+                               const char *security, const char *passphrase);
 int __supplicant_disconnect(struct connman_element *element);
index 0e1526e..294b771 100644 (file)
@@ -60,7 +60,7 @@ static void network_remove(struct connman_element *element)
 
 static int network_enable(struct connman_element *element)
 {
-       char *identifier, *passphrase = NULL;
+       char *identifier, *security = NULL, *passphrase = NULL;
        unsigned char *ssid;
        int ssid_len;
 
@@ -83,12 +83,19 @@ static int network_enable(struct connman_element *element)
                }
        }
 
+       if (connman_element_get_static_property(element,
+                                       "WiFi.Security", &security) == FALSE)
+               connman_element_get_value(element,
+                               CONNMAN_PROPERTY_ID_WIFI_SECURITY, &security);
+
        connman_element_get_value(element,
                        CONNMAN_PROPERTY_ID_WIFI_PASSPHRASE, &passphrase);
 
-       DBG("identifier %s passhprase %s", identifier, passphrase);
+       DBG("identifier %s security %s passhprase %s",
+                                       identifier, security, passphrase);
 
-       if (__supplicant_connect(element, ssid, ssid_len, passphrase) < 0)
+       if (__supplicant_connect(element, ssid, ssid_len,
+                                               security, passphrase) < 0)
                connman_error("Failed to initiate connect");
 
        return 0;