Set the correct key management for WEP protected networks
authorMarcel Holtmann <marcel@holtmann.org>
Wed, 3 Dec 2008 12:15:53 +0000 (13:15 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 3 Dec 2008 12:15:53 +0000 (13:15 +0100)
plugins/supplicant.c

index b7d01cf8b5e1e57f4665777240820db7336cba16..39e1624de4c29a6de280fb5a835f016267ac0d45 100644 (file)
@@ -502,12 +502,26 @@ static int set_network(struct supplicant_task *task,
        connman_dbus_dict_append_array(&dict, "ssid",
                                        DBUS_TYPE_BYTE, &network, len);
 
-       if (passphrase && strlen(passphrase) > 0) {
+       if (g_ascii_strcasecmp(security, "wpa") == 0 ||
+                               g_ascii_strcasecmp(security, "wpa2") == 0) {
                const char *key_mgmt = "WPA-PSK";
                connman_dbus_dict_append_variant(&dict, "key_mgmt",
                                                DBUS_TYPE_STRING, &key_mgmt);
-               connman_dbus_dict_append_variant(&dict, "psk",
+
+               if (passphrase && strlen(passphrase) > 0)
+                       connman_dbus_dict_append_variant(&dict, "psk",
+                                               DBUS_TYPE_STRING, &passphrase);
+       } else if (g_ascii_strcasecmp(security, "wep") == 0) {
+               const char *key_mgmt = "NONE", *index = "0";
+               connman_dbus_dict_append_variant(&dict, "key_mgmt",
+                                               DBUS_TYPE_STRING, &key_mgmt);
+
+               if (passphrase && strlen(passphrase) > 0) {
+                       connman_dbus_dict_append_variant(&dict, "wep_key0",
                                                DBUS_TYPE_STRING, &passphrase);
+                       connman_dbus_dict_append_variant(&dict, "wep_tx_keyidx",
+                                               DBUS_TYPE_STRING, &index);
+               }
        } else {
                const char *key_mgmt = "NONE";
                connman_dbus_dict_append_variant(&dict, "key_mgmt",