summaryrefslogtreecommitdiffstats
path: root/lib/network/connection/wireless.pm
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-03-31 09:57:00 +0000
committerOlivier Blin <oblin@mandriva.com>2008-03-31 09:57:00 +0000
commit28e8f93e28e92e3a0976dcd36aec43b87dc935a4 (patch)
treef4dbc9ff8ba27cdbcce9ee6207d895fb2f074753 /lib/network/connection/wireless.pm
parent450a328b66484466675199cc1b2d4738844a73d9 (diff)
downloaddrakx-net-28e8f93e28e92e3a0976dcd36aec43b87dc935a4.tar
drakx-net-28e8f93e28e92e3a0976dcd36aec43b87dc935a4.tar.gz
drakx-net-28e8f93e28e92e3a0976dcd36aec43b87dc935a4.tar.bz2
drakx-net-28e8f93e28e92e3a0976dcd36aec43b87dc935a4.tar.xz
drakx-net-28e8f93e28e92e3a0976dcd36aec43b87dc935a4.zip
do not convert WEP keys longer than maximum key length for wpa_supplicant (currently 16)
Diffstat (limited to 'lib/network/connection/wireless.pm')
-rw-r--r--lib/network/connection/wireless.pm8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/network/connection/wireless.pm b/lib/network/connection/wireless.pm
index a8ccd78..59d1da2 100644
--- a/lib/network/connection/wireless.pm
+++ b/lib/network/connection/wireless.pm
@@ -36,6 +36,8 @@ sub get_metric { 35 }
#- class attributes:
#- network: ID of the selected network
+my $wpa_supplicant_max_wep_key_len = 16;
+
our %wireless_enc_modes = (
none => N_("None"),
open => N_("Open WEP"),
@@ -691,7 +693,11 @@ sub convert_wep_key_for_iwconfig {
sub convert_wep_key_for_wpa_supplicant {
my ($key, $force_ascii) = @_;
- !$force_ascii && get_hex_key($key) || qq("$key");
+ if (my $hex_key = !$force_ascii && get_hex_key($key)) {
+ return length($hex_key) <= $wpa_supplicant_max_wep_key_len * 2 && $hex_key;
+ } else {
+ return length($key) <= $wpa_supplicant_max_wep_key_len && qq("$key");
+ }
}
sub get_wep_key_from_iwconfig {